Skip to content

fix(video): make one-frame scene sampling deterministic - #11344

Merged
diegosouzapw merged 2 commits into
release/v3.8.50from
fix/v3850-video-fu02-sampler
Aug 24, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.50from
fix/v3850-video-fu02-sampler

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Summary

  • Make scene_aware Video Bridge sampling deterministic when the caller allows only one frame.
  • Fall back to the midpoint of the active full-video or focus window and report policyEffective: "uniform", because one scene candidate cannot preserve both temporal ends.
  • Add an opt-in real-FFmpeg fixture matrix covering rapid edge cuts, a one-frame budget, static and gradual scenes, sub-second clips, and detector failure.

Related Issues

Validation

Choose the change type and focused loop from the
Contribution Golden Path. The full unit suite,
Vitest, the 60% coverage gate, and the production build all run in CI on this PR (#8329):

  • Change type: other — Video Bridge guardrail/runtime
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR
  • SonarQube is temporarily opt-in while the private project has no quota; it is not a PR gate.

Post-rebase evidence against the then-live release/v3.8.50 tip:

  • Video Bridge unit matrix: 42/42 PASS.
  • Real FFmpeg integration matrix: 7/7 PASS with physical FFV1/Matroska fixtures.
  • npm run typecheck:core: PASS.
  • npm run typecheck:noimplicit:core: BASE-RED outside this PR in
    open-sse/translator/response/openai-responses/pureHelpers.ts (implicit-any
    diagnostics from the current release tip); this branch changes neither that file nor
    the no-implicit config.
  • npm run check:docs-all: PASS; only the existing soft executor-count/version notices were reported.
  • Focused ESLint, Prettier, changelog integrity, and git diff --check: PASS.
  • The full npm run lint passed before the final base-only rebase; the affected files were linted again after rebase.

Tests Added Or Updated

  • tests/unit/guardrails/videoBridgeSampler.test.ts
  • tests/integration/video-bridge-sampler-ffmpeg.test.ts

The real-FFmpeg matrix is intentionally opt-in because FFmpeg is an optional operational dependency:

RUN_VIDEO_BRIDGE_FFMPEG=1 node --import tsx/esm --test \
  tests/integration/video-bridge-sampler-ffmpeg.test.ts

Without the environment variable, the integration collector records an explicit skip instead of hiding the missing runtime dependency.

Coverage Notes

  • The unit regression proves the exact former failure: candidates at 0.25s and 7.75s with a one-frame budget previously selected the final candidate and still claimed scene_aware; it now selects the deterministic 4s midpoint and reports uniform.
  • A focused-window case proves [2s, 8s] resolves to 5s and retains the normalized focus metadata.
  • The integration test executes real ffprobe/ffmpeg commands and verifies extraction, not only selection helpers.
  • This slice does not change segment_aware behavior or the FU-07 structural sampler.

Reviewer Notes

  • Scope is limited to the FU-02 one-frame acceptance gap. It does not touch Video Bridge cache identity, subtitle extraction, Audio Bridge fusion, drill-down, contact-sheet composition, or FU-07.
  • No migration or feature flag is involved.
  • The active release branch is moving quickly; the branch was rebased and the focused gates above were rerun immediately before publication.

@diegosouzapw
diegosouzapw marked this pull request as draft August 24, 2026 06:02
@diegosouzapw

Copy link
Copy Markdown
Owner Author

Exact-base CI classification (snapshot: 2026-08-24 07:17 UTC; base dafb4ae808305c9287c751cf1ce16fe2234ba073, head 6f8a2a348b7be6c3edb6c0903e4b9f8f9c0d8e5e):

  • Unit Tests fast-path (1/4) — BASE-RED: the PR reports OpenAPI coverage 34.5% (344/996) versus the 34.6% floor. Running the same test on the exact base produced the same 34.5% (344/996) result; this PR does not change the OpenAPI/routes/test surface.
  • Fast Production Build — INFRA/cancelled: the runner was shut down during the optimized production build, without a compile/type diagnostic. The exact-base build was cancelled at the same phase.
  • DAST — not started: the runner terminated the prerequisite CLI build; server startup and the Schemathesis/promptfoo checks were never reached.
  • The release branch remains independently base-red in 🔴 Release branch not green: release/v3.8.50 #9985 (releaseGreen:false, unrelated ESLint JSON parsing failure).

No PR-specific defect is proven by these failures, so no noise commit was added. This is not a claim that the full CI suite is green; the PR remains open and draft.

@diegosouzapw
diegosouzapw marked this pull request as ready for review August 24, 2026 12:24
@diegosouzapw
diegosouzapw merged commit 04d2a60 into release/v3.8.50 Aug 24, 2026
28 of 33 checks passed
diegosouzapw pushed a commit that referenced this pull request Aug 24, 2026
…11382/#11383 growth

These entries were already validated in an earlier merge-batch worktree but
never reached origin (worktree discarded before pushing). Re-adding them
here since #11355's test/route.ts growth (1215->1237) is now live on
origin/release/v3.8.50 and fails the frozen cap otherwise.
@diegosouzapw
diegosouzapw deleted the fix/v3850-video-fu02-sampler branch August 25, 2026 02:37
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…#11344)

Merged via consolidated batch validation. Makes scene_aware Video Bridge sampling deterministic for a one-frame budget: falls back to the midpoint of the active full-video/focus window and reports policyEffective: uniform (a single scene candidate can't preserve both temporal ends). Adds opt-in real-FFmpeg fixture matrix (rapid edge cuts, one-frame budget, static/gradual scenes, sub-second clips, detector failure). Static gates green; own regression suite (videoBridgeSampler.test.ts, video-bridge-sampler-ffmpeg.test.ts) passed in the combined-batch run. Related to diegosouzapw#9760. Thanks!
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…apw#11344/diegosouzapw#11381/diegosouzapw#11362/diegosouzapw#11382/diegosouzapw#11383 growth

These entries were already validated in an earlier merge-batch worktree but
never reached origin (worktree discarded before pushing). Re-adding them
here since diegosouzapw#11355's test/route.ts growth (1215->1237) is now live on
origin/release/v3.8.50 and fails the frozen cap otherwise.
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