Skip to content

fix(apiv2): remove legacy web transport and URL leaks - #1051

Merged
Quick104 merged 7 commits into
apiv2from
t3code/simplify-api-v2-migration
Sep 12, 2026
Merged

Quick104 merged 7 commits into
apiv2from
t3code/simplify-api-v2-migration

Conversation

@Quick104

Copy link
Copy Markdown
Contributor

Problem

Related issue: #135

The API v2 migration still returned legacy asset URLs, the migration ledger extractor ignored the migrated web client, and the web bundle retained an unused v1 transport and stale v1 URL documentation.

Approach

The v2 branding upload adapter now constructs its response URL from the v2 route and content reference. The consumer extractor recognizes typed v2("METHOD /api/v2/...") calls and preserves their method and path. The unused v1 transport wrappers and their tests were removed. The remaining v2 playback-session example now uses a neutral media URL. Generated OpenAPI output was refreshed.

Validation

  • go test -count=2 ./internal/apiv2 ./internal/contractledger ./internal/routeinventory passed before the final generated-artifact update; the focused post-update run for branding and artifact consistency passed twice.
  • make verify-migration-ledger passed.
  • The extractor now finds 553 web v2 call sites from the current source.
  • git diff --check passed.
  • Web tests and automatic web type generation were not run because web/node_modules is absent; the generated TypeScript schema was updated to match the regenerated OpenAPI example.

Risks

The web client no longer exposes the bridge-only v1 transport helpers. Operational health probes and server-side compatibility URL adapters remain unchanged.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Codex API agent harness
  • Tool(s): functions.exec, git, GitHub CLI
  • Model(s): GPT-6 (Codex)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: Primary review covered the complete branch diff, v1 route inventory, migration extractor, generated artifacts, and focused tests. Independent subagent review was unavailable because the review agents returned service rate-limit errors; no unresolved findings were suppressed.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b5e218bb-595b-4ca0-be5e-a528abafc455

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T16:33:20.302975Z eab1c65 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Sep 12, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The PR should not merge until the v2 consumer extractor records conditional operation-key calls, otherwise migration verification omits two active vote consumers.

Findings

  1. P1 Variable operation keys are skipped

Reviews (1) · Last reviewed commit: "fix(apiv2): remove legacy web transport ..."

# The optional generic allows one level of nesting (api<Partial<Progress>>(...)).
WEB_CALL = re.compile(
r"\b(api|apiResponse|apiKeepalive|apiDownload|apiBlob|apiWithProfileRequestContext|apiFetch|fetch|apiFormData|apiUpload|playerFetch)\s*(<(?:[^<>]|<[^<>]*>)*>)?\s*\("
r"\b(v2|api|apiResponse|apiKeepalive|apiDownload|apiBlob|apiWithProfileRequestContext|apiFetch|fetch|apiFormData|apiUpload|playerFetch)\s*(<(?:[^<>]|<[^<>]*>)*>)?\s*\("

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Variable operation keys are skipped

The scanner now recognizes literal v2("METHOD /api/v2/…") calls, but it still discards calls whose first argument is an identifier. setRoomSuggestionVote calls v2(operation, …), where operation selects the POST or DELETE vote route, so neither consumer is credited and migration-ledger verification can pass with both active operations missing. Resolve statically assigned conditional keys or otherwise record both branches, and add coverage for this call form.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1ffdd6ce3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

SeasonNumber *int `json:"season_number" nullable:"true" doc:"null unless an episode" example:"1"`
EpisodeNumber *int `json:"episode_number" nullable:"true" doc:"null unless an episode" example:"1"`
PosterURL string `json:"poster_url" doc:"Where to fetch the poster; empty when there is none" example:"/api/v1/images/poster/42"`
PosterURL string `json:"poster_url" doc:"Where to fetch the poster; empty when there is none" example:"https://media.example/poster.jpg"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh the playback-session fixture with the new example

Changing this schema example leaves the committed contracts/api/v2/fixtures/list_household_sessions_ok.json response advertising /api/v1/images/poster/42 and /api/v1/images/poster/7, sourced from the unchanged fixtures in internal/apiv2/pilot_fakes_test.go. Contract consumers therefore receive contradictory examples and may continue treating URLs from the namespace that becomes a 410 Gone tombstone at 1.0 as valid v2 data; update the fixture source and regenerate the success fixture with this change.

AGENTS.md reference: AGENTS.md:L193-L199

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b482c165ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

lit = first_string_literal(first) if first[:1] in ('"', "'", "`") else None
literals = [lit] if lit is not None else []
if not literals:
var = re.match(r"(\w+)\s*(?:,|$)", first)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Extract inline conditional v2 operations

When v2 receives an inline conditional expression, this regex accepts only a variable followed immediately by a comma or the end of the arguments, so calls such as the poster/backdrop upload in web/src/api/adminCollections.ts and the user/admin collection operations in web/src/hooks/queries/collections.ts produce no records for either route. Regenerating the migration ledger can therefore omit real first-party consumers and misclassify routes while the v1 namespace is being retired; parse direct conditional operation expressions as well as assigned conditionals.

AGENTS.md reference: AGENTS.md:L193-L199

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b390016a9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

method = web_method(args)
if fn == "v2":
method = lit.split(None, 1)[0]
record("web", WEB_BASE, fp, line, method, path, lit, [generic], via)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Regenerate the ledger after recognizing v2 calls

The extractor now records the migrated v2 calls, but the committed contracts/api/v2/migration.json was not rebuilt: it still attributes 606 web call sites to 550 legacy /api/v1 rows and records none on the v2 delegation rows. Freshly running extract_consumers.py, match_consumers.py, and build_ledger.py removes the obsolete mechanical v1 evidence and assigns the current calls to /api/v2/*; verify-migration-ledger does not detect this drift because its new Python check validates only one extractor result, not the committed ledger. Refresh the ledger or add a generated-artifact comparison so retirement decisions are not made from pre-migration consumer data.

AGENTS.md reference: AGENTS.md:L193-L199

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eab1c65a15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 8505 to +8507
"consumers": [
"unused"
"web"
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the stale unused-consumer note

The regenerated entry now records the web client as a consumer of the legacy Jellyfin Web update route, but its notes field still says that no first-party or internal consumer was found. Because this ledger is used to support the /api/v1 retirement, those opposing claims make it unclear whether the route is unused or represented by the shared v2 install operation; update the curated note, and preferably the generator's handling of unused-to-used transitions, together with this evidence.

AGENTS.md reference: AGENTS.md:L193-L199

Useful? React with 👍 / 👎.

@Quick104
Quick104 merged commit 507c1c2 into apiv2 Sep 12, 2026
7 of 8 checks passed
@Quick104
Quick104 deleted the t3code/simplify-api-v2-migration branch September 12, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant