Skip to content

test(recording): make the re-index suite run off Linux - #260

Merged
EtienneLescot merged 1 commit into
release/v1.9.0from
fix/webm-seek-index-tests-platform
Aug 4, 2026
Merged

test(recording): make the re-index suite run off Linux#260
EtienneLescot merged 1 commit into
release/v1.9.0from
fix/webm-seek-index-tests-platform

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

npx vitest --run currently shows 6 red tests on a clean checkout for anyone on macOS or Windows. They are environmental, not a regression — but nothing says so, and working that out by hand costs every new contributor the same half hour.

Cause

reindexRecordingOnDisk is Linux-gated by intent (webm-seek-index.ts:62) — Windows and macOS record through native helpers that already write indexed files, so re-muxing their output would be pure cost:

if (process.platform !== "linux") {
    return { reindexed: false, reason: "unsupported-platform" };
}

Six cases in the suite inject a fake remux service and assert the remuxed result. Off Linux they stop at that guard and fail. Worth noting they weren't just failing — they were asserting nothing about the wrapper at all on those platforms.

Fix

Pin process.platform to linux in beforeEach, restore the real value in afterEach. The technique is the one the suite's own last case already used inline; hoisting it drops the per-test save/restore boilerplate and makes the restore hold even when a case throws part-way through.

The guard stays covered — now parametrised over both platforms it exists for rather than win32 alone, so the Linux pin can't quietly become the only thing the suite ever exercises.

No production code changes. Test file only.

Verification

The cases still have teeth — this is the part that mattered, since they had been passing vacuously. Removing the empty-output size check from reindexRecordingOnDisk fails the truncated-file case:

× keeps the original when the remux leaves a truncated 0-byte file
  Tests  1 failed | 7 passed (8)

Implementation restored byte-identical afterwards (empty diff).

Full suite on macOS, from 6 failures to none:

Test Files  137 passed (137)
     Tests  1626 passed | 1 skipped (1627)

tsc --noEmit clean, Biome clean (13 warnings, unchanged from baseline).

reindexRecordingOnDisk is Linux-gated by intent — Windows and macOS
record through native helpers that write indexed files at the source, so
the wrapper returns `unsupported-platform` before touching anything
else. The suite never accounted for that: six of its cases inject a fake
remux service and assert the remuxed result, so on a macOS or Windows
checkout they stop at the guard and fail. They were red on a clean tree,
for environmental reasons, with nothing to distinguish them from a real
regression.

Pin process.platform to linux in beforeEach and restore the real value
in afterEach, so the cases exercise the wrapper's own logic on every
platform. The technique is the one the suite's last case already used
inline; hoisting it removes the per-test save/restore boilerplate and
makes the restore hold even when a case throws part-way.

The guard itself stays covered, now over both platforms it exists for
rather than win32 alone, so pinning to Linux can't quietly become the
only thing the suite exercises.

No production code changes. Verified the cases still have teeth:
removing the empty-output size check from reindexRecordingOnDisk fails
the truncated-file case, which had been passing vacuously on macOS.

`npx vitest --run` is now green on macOS: 137 files, 1626 passing.
@coderabbitai

coderabbitai Bot commented Aug 4, 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cfa6661-17ba-4c1b-be7a-69bc6be490af

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.

@EtienneLescot
EtienneLescot merged commit 13a4fc0 into release/v1.9.0 Aug 4, 2026
12 checks passed
@EtienneLescot
EtienneLescot deleted the fix/webm-seek-index-tests-platform branch August 4, 2026 22:02
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