Skip to content

fix(exam): cross-platform fallback for the labelling/replay harness - #15

Open
Munawarx wants to merge 1 commit into
Nazim22:mainfrom
Munawarx:fix/cross-platform-exam-harness
Open

fix(exam): cross-platform fallback for the labelling/replay harness#15
Munawarx wants to merge 1 commit into
Nazim22:mainfrom
Munawarx:fix/cross-platform-exam-harness

Conversation

@Munawarx

Copy link
Copy Markdown
Contributor

Summary

scripts/label-corpus.js hard-threw on non-Linux hosts (race-safe exam I/O requires Linux /proc/self/fd and O_NOFOLLOW), blocking contributors on macOS/Windows from running or developing the exam/replay harness locally. This adds a best-effort cross-platform fallback that preserves symlink-component rejection (not race-safe) so the harness runs off-Linux for development, while the Linux race-safe path is unchanged and remains the authoritative release-gating run.

Changes

  • scripts/label-corpus.js: openAnchoredDirectory branches on platform — Linux keeps the /proc/self/fd + O_NOFOLLOW race-safe path; other platforms use path.resolve + statSync symlink checks (returning a marker so readRegularNoFollow/writePrivate use normal paths and skip fd closes).
  • docs/REPLAY.md: add a Platform support section stating Linux is authoritative, off-Linux is best-effort dev-only.

Why

Verification

  • node -e "require('./scripts/label-corpus.js').openAnchoredDirectory(process.cwd())" → no longer throws on win32 (returns {__crossPlatformDir: ...}).
  • Linux path is byte-for-byte the original race-safe logic; CI remains ubuntu-latest so the gating exam is unaffected.
  • No router / contract-engine / schema / security-boundary changes.

Trade-offs

  • The off-Linux path is not race-safe (a TOCTOU window exists). This is acceptable because it is dev-only and explicitly documented; the release-gating run is Linux. If the maintainer prefers, the alternative is to keep the hard throw and rely on containers — but that excludes native Windows/macOS contributors.

Files

  • scripts/label-corpus.js
  • docs/REPLAY.md

Co-Authored-By: Hermes Agent noreply@hermes.ai

label-corpus.js hard-threw on non-Linux ('race-safe exam I/O requires Linux').
Add a best-effort cross-platform path (still rejects symlink components, not
race-safe) so contributors on macOS/Windows can run/develop the harness
locally. The Linux /proc/self/fd + O_NOFOLLOW race-safe path is unchanged and
remains the authoritative release-gating run (CI stays ubuntu-latest).
Documents the caveat in docs/REPLAY.md. Extends PR Nazim22#6 (Linux-only docs).

Verified openAnchoredDirectory no longer throws on win32. No router/contract
changes.

Co-Authored-By: Hermes Agent <noreply@hermes.ai>
@Munawarx

Copy link
Copy Markdown
Contributor Author

Tracking our current contribution set for Leadline (Munawarx). All are independent, each on its own branch:

Each PR is self-contained and ready to review independently. Happy to split, adjust, or rebase any of them. Co-Authored-By: Hermes Agent noreply@hermes.ai

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