Skip to content

test(link): run the activity-holds directory-sync seam on Windows too - #8628

Merged
lidge-jun merged 2 commits into
devfrom
fix/dev-red-activity-holds-sync-seam
Nov 13, 2026
Merged

lidge-jun merged 2 commits into
devfrom
fix/dev-red-activity-holds-sync-seam

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

The 14-shard Windows dev batch (run 43343080374, windows 11/14) failed tests/clients/link-ws-activity-holds-operator.test.ts:108, clear (D8) > a clear whose directory sync fails after the rename keeps the link held across a restart (T5d3a-R1-01). The case was added with the store in #8593. The test injects a failure through the syncDir write hook, but durableWrite in src/link/ws-activity-holds.ts called that hook only inside its POSIX branch. On Windows the injected failure never fired, so clear returned { ok: true, cleared: ... } instead of { ok: false, reason: "write-failed" }.

The hook now marks the post-rename durability point on every platform, so the callers' handling of "the rename landed but is reported as not durable" runs under test on Windows too. The real chmod and directory fsync stay POSIX-only (NTFS journals the rename), and the hook is undefined outside tests, so production behavior is unchanged. A new case runs the same D8 scenario with process.platform reported as win32, so the Windows path is pinned on every runner.

Verification

  • Windows reproduced on Linux with a scratch preload that reports process.platform as win32: bun test --preload <win32> tests/clients/link-ws-activity-holds-operator.test.ts gave 11 pass, 1 fail (the CI case) before, 12 pass, 0 fail after.
  • Same file without the preload: 12 pass, 0 fail.
  • Regression case added in the follow-up commit: against dev's src/link/ws-activity-holds.ts the file gives 12 pass, 1 fail (the new win32 case); with this PR, 13 pass, 0 fail.
  • bun run typecheck: exit 0. bun run structure:check: passed.
  • NOT RUN: a real Windows runner (PR CI has no Windows shards; the maintainer's next dev batch covers it), and the full suite.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Bug Fixes
    • File writes now apply target permissions before post-rename handling on non-Windows systems. Post-rename handling also runs on Windows, improving consistency across platforms.
    • Directory synchronization continues after post-rename handling on non-Windows systems.

The clear (D8) case "a clear whose directory sync fails after the rename keeps the
link held across a restart" failed on the 14-shard Windows batch: durableWrite called
the syncDir test hook only inside the POSIX branch, so on Windows the injected failure
never fired and the clear reported success.

The hook now marks the post-rename durability point on every platform; the real chmod
and directory fsync stay POSIX-only, so production behavior is unchanged. Reproduced on
Linux by reporting process.platform as win32 (11 pass, 1 fail before; 12 pass after).
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 02:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T02:44:14.966001Z 6c980fb PR opened
ℹ️ 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.

@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • missing_regression_test — Behavior changed under src/ or gui/src/ without a test change. Add focused coverage or obtain test-exception-approved.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

durableWrite now calls syncDir after rename on every platform. Non-Windows systems apply target permissions before the hook and perform directory fsync afterward. The directory-sync failure test also runs with Windows platform behavior.

Changes: Directory sync hook

Layer / File(s) Summary
Hook ordering and platform behavior
src/link/ws-activity-holds.ts, tests/clients/link-ws-activity-holds-operator.test.ts
syncDir documentation and durableWrite now specify and implement the hook call after rename on every platform. Directory open and fsync remain limited to non-Windows systems. The directory-sync failure scenario is extracted into a helper and reused in a test that sets process.platform to win32, restoring the original platform descriptor in a finally block.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Merge Risk: Minimal · up to 54c8a

This change makes a test hook run on Windows as well as POSIX, with no production behavior change. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the test change: running the activity-holds directory-sync seam on Windows too. The changeset does this. The hook in src/link/ws-activity-holds.ts now runs after rename on every platfo…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the test change: running the activity-holds directory-sync seam on Windows too. The changeset does this. The hook in src/link/ws-activity-holds.ts now runs after rename on every platform, and a new test in tests/clients/link-ws-activity-holds-operator.test.ts sets process.platform to win32. The title covers the main change but omits the production-side hook timing change, which is acceptable because the title does not need every detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6c980fb and 54c8ab9.

Files selected for processing: 1

  • tests/clients/link-ws-activity-holds-operator.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed.

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as draft November 13, 2026 02:43
@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 13, 2026
Runs the T5d3a-R1-01 clear with process.platform reported as win32. It fails against the POSIX-only hook (12 pass, 1 fail) and passes with it (13 pass).
@github-actions github-actions Bot removed the intake: hygiene-blocked Deterministic PR hygiene checks failed label Nov 13, 2026
@github-actions
github-actions Bot marked this pull request as ready for review November 13, 2026 03:02
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer judgment (dev integration, MAINTAINERS.md maintainer-integration exception): merging without a second maintainer approval, as part of the DEV-RED repair for dev batch run 43343080374 (windows 11/14).

  • Exact head: 54c8ab992f04952f3879a9062f7a47cb9f81f50a. Every required PR check on this head passed (gates, test changed, hygiene, enforce-target, ci).
  • Fresh independent review on this exact head: VERDICT: PASS, no findings. Its fresh runs: activity-holds tests 40 pass / 0 fail, ratchet and layout guards 38 / 0, typecheck, structure:check and privacy:scan exit 0.
  • The win32 regression case fails against dev's src/link/ws-activity-holds.ts (12 pass, 1 fail) and passes with this change (13 / 0). Production filesystem operations are unchanged when no hook is supplied.
  • No outstanding change requests.
  • Not yet verified on a native Windows runner; the maintainer's next dev batch covers it.

@lidge-jun
lidge-jun merged commit f3d08ea into dev Nov 13, 2026
37 checks passed
@lidge-jun
lidge-jun deleted the fix/dev-red-activity-holds-sync-seam branch November 13, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant