Skip to content

feat(markers): re-detect intro, credits, or all markers for an item - #1591

Merged
Quick104 merged 5 commits into
mainfrom
outro/redetect-markers
Sep 27, 2026
Merged

Quick104 merged 5 commits into
mainfrom
outro/redetect-markers

Conversation

@Quick104

@Quick104 Quick104 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1147
Validation tasks: none

Admins can rerun local detection for an episode's intro, or refresh all of an item's markers, but they cannot rerun credits detection on its own, and they have no way to rerun detection for a movie's credits. After fixing a file or disagreeing with a detected credits range, the only option is a full refresh, which also contacts online providers. This change adds an admin operation that reruns local detection for one kind of marker, or both, on an episode or a movie.

Approach

  • API: POST /api/v2/admin/items/{id}/redetect-markers takes an optional kind of intro, credits, or all (the default) and answers 202. Episodes run the chosen kinds. Movies accept credits or all; intro on a movie, or an unknown kind, is a 422 validation problem. It reuses the handler path of refresh-markers and redetect-intro, so eligibility, mode, and in-flight rules are the same. The frozen /api/v1 routes and v2 redetect-intro are unchanged.
  • Capability: the admin marker capability document gains redetect_markers: true, and its movie_credits description now names this operation too.
  • Web: an episode's action menu opens a small dialog to choose intro, credits, or both; a movie's menu offers Re-detect Credits.

Validation

  • Handler and v2 transport tests for each kind on episodes and movies, the 422 cases, and the capability document: pass. OpenAPI, web types, fixtures, and the route inventory are current.
  • Web tests for the dialog, the action menu, and the query hook; tsc, Prettier, and ESLint: pass.
  • Postgres-backed marker and task tests: pass.
  • On a test server: movie credits 202, episode credits 202, movie intro 422, unknown kind 422; the movie menu's Re-detect Credits queued detection and showed its toast.
  • TestAdminSubtitleListPageDB and TestAdminResourceCapabilitiesAndScope fail locally, as they do on main in the same environment.
  • make lint-changed: pass.

Risks

A new additive v2 operation and capability field. The system-info fixture's contract digest changes, so the copies of get_system_info_ok.json in silo-apple and silo-android need the same update. Clients need no other change; they can offer the action once they see redetect_markers.

Checklist

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

AI Disclosure

  • Harness: Claude Code (in T3 Code), using its Workflow tool to run subagents
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5[1m] (main session), claude-opus-5-5 (implementation and merge subagents)
  • Involvement: Fully AI-generated, not yet human verified
  • Adversarial review: The main session reviewed each subagent commit and re-ran the Go, web, contract, and database checks itself. Reconciling this change with the reviewed credits series consolidated two copies of the marker-kind handling into one; no separate adversarial review agent ran on this change.

🤖 Generated with Claude Code

Note

Add admin re-detection of intro, credits, or all markers for an item

  • Adds POST /api/v2/admin/items/{id}/redetect-markers, which accepts an optional kind of intro, credits, or all (default all) and returns HTTP 202, with HTTP 409 for conflicts (see admin_catalog_intro.go and admin_intro.go).
  • Extends the marker capability response with redetect_markers; admin UI pages use this to decide whether the new action is available.
  • Adds a RedetectMarkersDialog picker and updates the ActionBar overflow menu. Episodes show a generic re-detect action with a kind picker; movies show a direct credits-only action gated on both redetect_markers and movie_credits.
  • Replaces the old intro-only re-detection flow in EpisodeContent/MovieContent with the useRedetectItemMarkers mutation hook.
  • Behavioral Change: the ActionBar re-detection callback contract changes from an intro-only callback to onRedetectMarkers(kind) with a shared pending flag; the previous intro-only menu action is gone, replaced by generic or direct-kind actions. When the new route 404s, only episode intro requests fall back to the legacy episode-only operation; other kinds surface the error. In-flight re-detection for the same item is deduplicated across marker kinds and returns already_running.

Macroscope summarized 805a315.

Admins can now rerun local marker detection for one kind at a time through
POST /api/v2/admin/items/{id}/redetect-markers, which takes an optional kind
of intro, credits, or all. Episodes run the chosen kinds; movies accept
credits or all and reject intro with a validation error. The marker
capability document gains redetect_markers so clients can detect the
operation. The web item page offers a Re-detect Markers dialog for episodes
and a Re-detect Credits action for movies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kody-ai

kody-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 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-27T20:21:22.412297Z c3f8d0b 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.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 803b4e7c-c810-4464-9ba8-d68331c06a9b

📥 Commits

Reviewing files that changed from the base of the PR and between 13763f5 and 805a315.

📒 Files selected for processing (45)
  • contracts/api/v2/fixtures/admin_item_markers_redetect.json
  • contracts/api/v2/fixtures/admin_item_markers_redetect_unknown_kind.json
  • contracts/api/v2/fixtures/admin_marker_capabilities.json
  • contracts/api/v2/fixtures/admin_network_access_status_not_found.json
  • contracts/api/v2/fixtures/admin_network_access_unknown_host.json
  • contracts/api/v2/fixtures/admin_subtitle_metadata_precondition_required.json
  • contracts/api/v2/fixtures/get_system_info_ok.json
  • contracts/api/v2/fixtures/index.json
  • contracts/api/v2/fixtures/list_series_seasons_invalid_artwork.json
  • contracts/api/v2/fixtures/login_provider_null.json
  • contracts/api/v2/fixtures/playback_installation_changed.json
  • contracts/api/v2/fixtures/playback_invalid_protocol.json
  • contracts/api/v2/fixtures/playback_progress_conflict.json
  • contracts/api/v2/fixtures/start_device_login_temporary_null.json
  • contracts/api/v2/fixtures/theme_songs_playback_not_acceptable.json
  • contracts/api/v2/fixtures/theme_songs_playback_unauthorized.json
  • contracts/api/v2/migration.json
  • contracts/api/v2/openapi.json
  • docs/admin-catalog-api.md
  • docs/architecture/intro-detection.md
  • docs/markers-api.md
  • internal/api/handlers/admin_intro.go
  • internal/api/handlers/admin_intro_test.go
  • internal/api/testdata/media_routes.txt
  • internal/apiv2/admin_catalog_intro.go
  • internal/apiv2/admin_catalog_intro_test.go
  • internal/apiv2/document_test.go
  • internal/contractledger/ledger_test.go
  • internal/intromarkers/analyzer.go
  • internal/intromarkers/analyzer_credits_test.go
  • web/src/api/v2/operations.ts
  • web/src/api/v2/schema.ts
  • web/src/components/markers/RedetectMarkersDialog.tsx
  • web/src/hooks/queries/admin/intro.v2.test.ts
  • web/src/hooks/queries/admin/markers-redetect.v2.test.ts
  • web/src/hooks/queries/admin/markers.ts
  • web/src/hooks/queries/items.test.ts
  • web/src/hooks/queries/items.ts
  • web/src/hooks/queries/keys.ts
  • web/src/pages/ItemDetail/EpisodeContent.test.tsx
  • web/src/pages/ItemDetail/EpisodeContent.tsx
  • web/src/pages/ItemDetail/MovieContent.test.tsx
  • web/src/pages/ItemDetail/MovieContent.tsx
  • web/src/pages/ItemDetail/components/ActionBar.menu.test.tsx
  • web/src/pages/ItemDetail/components/ActionBar.tsx

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 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: dc7efb1a52

ℹ️ 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 thread web/src/api/v2/schema.ts Resolved
During a rolling deploy or rollback the web bundle can be newer than the
API node that answers. Read GET /api/v2/admin/markers/capabilities and
offer the redetect-markers picker and movie Re-detect Credits only when
redetect_markers is true. Otherwise episodes keep the intro-only
redetect-intro action and movies show no re-detect action.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kody-ai

kody-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

@macroscopeapp

macroscopeapp Bot commented Sep 27, 2026

Copy link
Copy Markdown

Validation tasks: relates to #1149 C1 points to a playback Skip-control check, not the new admin re-detection action. The directly related marker cases (#1148/#1149, silo-apple#311/#312, silo-android#321/#322) and marker-edit persistence cases (#1151 C2 and #1153 C2) are all Not run; no recorded result is invalidated or unblocked.

Suggested fix: replace the line with Validation tasks: none.

Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.

Posted via Macroscope — v1 validation impact

@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: 55263982b9

ℹ️ 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 thread web/src/hooks/queries/admin/markers.ts Resolved
@Quick104

Copy link
Copy Markdown
Contributor Author

Updated the Validation tasks: line to none: this adds an admin re-detection action and does not change the playback skip behavior #1149 C1 checks.

Quick104 and others added 2 commits September 27, 2026 16:16
…orts movie credits

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… redetect-markers

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kody-ai

kody-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

Comment thread web/src/hooks/queries/items.ts Resolved
The episode-only redetect-intro operation cannot re-detect credits, so an
"all" request that reached a node without redetect-markers reported success
after re-running intros alone. Only intro requests fall back now; other
kinds show the error.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@kody-ai

kody-ai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

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