# Mission 001 — Read-only analysis report

## Executive summary
- What is failing?
- What the server returns (keys, counts), based on Debug report.
- Most likely root cause.

## Observations from Debug report
Paste the relevant lines and interpret them.

## Hypotheses (ranked)
1) ...
2) ...
3) ...

## Response-shape inventory
List the shapes we must support and where they typically appear in YouTube browse responses:
- appendContinuationItemsAction
- reloadContinuationItemsCommand
- onResponseReceivedActions[*].appendContinuationItemsAction
- onResponseReceivedActions[*].reloadContinuationItemsCommand
- frameworkUpdates.entityBatchUpdate.mutations (if present)

## Proposed extraction algorithm (pseudocode)
Write pseudocode that:
- Locates actions (all shapes)
- Collects continuationItems arrays
- Extracts playlistVideoRenderers from rich wrappers
- Extracts continuationItemRenderer token + clickTrackingParams
- Returns `{items, continuation, trackingParams}`

## Minimal instrumentation plan
Where to add logs (keys-only, counts-only):
- log count of action nodes and continuationItems length
- sample one action’s keys path
- ensure no sensitive data leaks

## Patch plan (no code yet)
Files/functions to change:
- `src/content/content_bridge.js`
  - `extractItemsAndContinuationFromBrowseResponse`
  - `extractPlaylistVideoRenderers`
  - `pickContinuationFromListContents` (token selection)
- `src/content/page_context.js` (only if context missing)
- tests/manual steps updates

## Risks / unknowns
Split into two buckets:

**Parser-only fixes (preferred):**
- Continuation items exist under an unhandled action/path (e.g., `onResponseReceivedActions[*].appendContinuationItemsAction`).
- Items are represented as different renderer/entity shapes (need additional normalization).
- Token/tracking extraction is selecting the wrong continuation item.

**Auth/session-dependent changes (avoid if possible):**
- Continuation requires additional headers/fields that vary by user/session.
- Consent/age-gate/region restrictions affecting some accounts.
- Other extensions/network blockers modifying requests.

For each risk, note how we would detect it using **keys-only** logs and how to mitigate.

## Acceptance criteria mapping

Explain how the patch would satisfy ACCEPTANCE.md.
