Skip to content

test(server): wait for a rewrite's change time to move on coarse file clocks - #3240

Merged
devswha merged 1 commit into
mainfrom
test/coarse-ctime-rewrites
Nov 7, 2026
Merged

devswha merged 1 commit into
mainfrom
test/coarse-ctime-rewrites

Conversation

@devswha

@devswha devswha commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Summary

Three unit tests rewrite a file to the same size and modification time and expect the reader to notice from the change time alone. On a kernel whose file timestamps come from a coarse clock (WSL2's kernel is built with CONFIG_HZ=250, so ctime moves in 4 ms steps), a rewrite within the same tick keeps the old ctime as well, so nothing tells the two versions apart and the tests fail:

  • server/omp-btw.test.ts: ompBtwTopics > reads a topic again when its file is replaced, even at the same size and time
  • server/claude-images.test.ts: a lookup that sees the file rewritten drops the boundary it kept, even when it serves nothing
  • server/claude-images.test.ts: rejects an image when the path's last check sees a same-size rewrite that put the modification time back

A probe of 200 back-to-back rewrites kept the same ctime 138 times on the WSL2 kernel (6.6.87.2-microsoft-standard-WSL2) and 0 times on a CONFIG_HZ=1000 Linux host. Self-hosted runners that run in WSL2 share that kernel with their containers, so Fast checks went red there for this reason only (e.g. job 128222905726).

Each test now repeats its rewrite until the file's change time has moved, as it has for any real later rewrite; the condition is awaited, not slept for. Test-only change, no product code touched.

Validation

  • Before: the three tests fail on the WSL2 host (bun test ./server/omp-btw.test.ts ./server/claude-images.test.ts: 3 fail).
  • After: the same files 5 runs in a row on the WSL2 host: 64 pass, 0 fail each time; on the CONFIG_HZ=1000 host: 64 pass, 0 fail.
  • bun run check fast green (on the WSL2 host, at this head's content on origin/main 552f65a).

WSL2's kernel stamps files from a 250 Hz clock, so a same-size rewrite that puts the modification time back can keep the old change time too; the three tests that rely on it now rewrite until it moves.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 57f1372 and abb78ce.

Files selected for processing: 2

  • server/claude-images.test.ts
  • server/omp-btw.test.ts
  • 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

@devswha devswha changed the title test: wait for a rewrite's change time to move on coarse file clocks test(server): wait for a rewrite's change time to move on coarse file clocks Nov 7, 2026
@devswha
devswha merged commit 74f683b into main Nov 7, 2026
28 of 33 checks passed
@devswha

devswha commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Merge note (merge pass) at head abb78ce:

  • Merged on GitHub's required checks, all green on this head (Fast checks, Integration and browser, Native Windows install).
  • omo review receipt: CLEAR at this exact head. Unresolved review threads: 0 (GraphQL). CodeRabbit: neutral; no CodeRabbit review ran on this head.
  • Test-only: three Fast-checks unit tests (claude-images, omp-btw) no longer assume a 1 ms file clock; they failed on WSL2 (250 Hz), which kept home-window's CI runners out.

@devswha
devswha deleted the test/coarse-ctime-rewrites branch November 7, 2026 00:35
devswha added a commit that referenced this pull request Nov 15, 2026
… release starts; a Copilot log cut back to its complete lines reads as truncated (#3808)

## What

Three tests fail on Linux before 6.13 or under CPU load, both of which a
4-vCPU cloud runner has (needed before #3802's VM runners take Fast
checks):

- `server/copilot.test.ts` "keeps a logged binding when only the log's
timestamps change" and `server/session-history.test.ts` "reads a WAL
store immutable once more ... when its writer came and went during the
read": a kernel without fine-grained file timestamps stamps every change
within one tick (about 4 ms) with the same time, so the test's next
change could land in the tick of the one before and look like no change
to the code under test, which compares times and sizes. Each test now
waits until the file clock has moved past the file's last change before
making the change it expects to be seen (the same approach as #3240).
Test-only.
- `scripts/plugin.ts` (`ovis link` handing over to an updated release):
it started the release first and listened for SIGTERM/SIGHUP only after,
so a signal arriving in between ended `link` and left the release
running without it; `scripts/plugin-link.test.ts` "passes a SIGTERM on
to the copy of link the app updated to" hit that window under load. It
now listens first and passes on a signal that came while the release was
starting.

## Verified

On a mesh VM (Linux 6.12.113, 4 vCPU, the CI runner image's toolchain),
this commit:

| Test | Before | After |
|---|---|---|
| copilot.test.ts | failed on every VM run | 10/10 pass |
| session-history.test.ts | failed in about half the VM runs | 10/10
pass |
| plugin-link.test.ts, beside four CPU-bound processes | 1 of 3 failed |
10/10 pass |

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
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