Skip to content

fix(player): return no marker occurrence before the first one starts - #1278

Merged
Quick104 merged 1 commit into
Silo-Server:codex/theintrodb-marker-syncfrom
Pasithea0:fix/player-marker-occurrence
Sep 21, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:codex/theintrodb-marker-syncfrom
Pasithea0:fix/player-marker-occurrence

Conversation

@Pasithea0

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1120

Review follow-up to #1275.

markerOccurrenceAtTime seeded its result with occurrences[0], so a playhead
before the first occurrence of that kind returned a range that had not started
yet. Every current caller re-checks the playhead (the intro prompt requires
currentTime inside the range, and the skip pill and recap auto-skip do the
same), so no skip was offered early, but the helper's contract only held by
accident for the next caller. The three multi-occurrence helpers the player
relies on, and the realtime marker_segments payload, also had no tests.

Approach

Start from null in markerOccurrenceAtTime, which makes the contract exact:
the last occurrence that has started, or none. The previous occurrence is still
kept after it ends, so an intro skip can still be undone.

Add unit tests for the helpers: resolveMarkerRegions (complete occurrence list
preferred over the singular fields, singular fallback, unusable ranges dropped,
ordering by start time), markerOccurrenceAtTime (before the first occurrence,
inside it, between occurrences, other kinds), and resolveAutoplayMarker
(closing credits only, the narrative gap before them never spanned, preview
counted only when previews may autoplay next).

Validation

pnpm install --frozen-lockfile, then pnpm vitest run src/player/utils/watchPageMarkers.test.ts: 13 tests pass, including the new
pre-start case. pnpm exec tsc --noEmit and prettier --check on both changed
files are clean.

No manual playback against a running server was done; this change is mechanical
and covered by the unit tests.

Risks

None identified. The helper's only behavior change is returning null where it
previously returned a not-yet-started occurrence, and no caller depended on
that.

Checklist

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

AI Disclosure

  • Harness: Hermes Agent desktop (Nous Research)
  • Tool(s): Hermes Agent tool calls, pnpm, vitest, TypeScript and Prettier
  • Model(s): deepseek/deepseek-v4.1-flash
  • Involvement: AI-assisted. The diff is agent-authored from a review of feat(markers): enable TheIntroDB with local fallback and daily sync #1275
    that the requesting developer directed, verified by the test run above, and the
    pull request was opened at their instruction. Maintainer review pending.
  • Adversarial review: the parent change was reviewed by four parallel agent
    reviewers, and this finding came from the web player slice. The reviewer's
    claim that the helper could produce a wrong skip button or countdown was
    refuted by the call sites (each re-checks the playhead), and the remaining
    contract problem is what this patch fixes. This patch itself has not had a
    separate adversarial pass; the evidence for it is the test run above.

markerOccurrenceAtTime seeded its result with occurrences[0], so a playhead
before the first occurrence of that kind returned a range that had not started
yet. Every current caller re-checks the playhead (the intro prompt needs
currentTime inside the range, the skip pill and the recap auto-skip do the same),
so no skip was offered early, but the helper's contract only held by accident for
the next caller.

Start from null, which makes the contract exact: the last occurrence that has
started, or none. The previous occurrence is still kept after it ends so an intro
skip can be undone.

Adds the missing tests for the multi-occurrence helpers used by the player:
resolveMarkerRegions (complete list preferred, singular fallback, ordering),
markerOccurrenceAtTime (pre-start, inside, between, other kinds) and
resolveAutoplayMarker (closing credits only, narrative gaps never spanned,
preview only when previews may autoplay next).

(cherry picked from commit 4256214)
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

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: fc5f0a04-afcd-4d43-b1da-a9fc07a31dd0

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.

@greptile-apps

greptile-apps Bot commented Sep 21, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified.

Reviews (1) · Last reviewed commit: "fix(player): report no occurrence before..."

@Quick104
Quick104 merged commit 313bac7 into Silo-Server:codex/theintrodb-marker-sync Sep 21, 2026
6 checks passed
@Pasithea0
Pasithea0 deleted the fix/player-marker-occurrence branch September 21, 2026 19:28
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.

2 participants