Skip to content

test(server): report a catalog's moved ctime instead of making one with chmod - #4140

Merged
devswha merged 1 commit into
mainfrom
fix/catalog-version-test
Nov 18, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/catalog-version-test

Conversation

@devswha

@devswha devswha commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What

The test #4122 added in server/pi-models.test.ts ("versions a catalog by its permissions too") failed on
every run on the HostHatch CI host: it did chmod 000 then chmod 644 back to back and expected
catalogVersion to change. On Linux 6.12 there the change time is coarse, and both chmods land in the
same tick, so ctime (and mtime and size) stay equal.

The test now reports a moved ctime through a statSync spy, the way claude-images.test.ts
(holdTimes) already does, instead of making one with chmod. It uses no sleeps and does not depend on
the clock's granularity, and it still fails if ctime is left out of the catalog version (checked by
removing it).

Test-only change.

Not a product bug

A live transcript turn is refreshed by size, not by timestamps: incrementalLiveTurn parses from the
offset it already read to the stream's length (the file size), checks the 64 bytes before that offset and
a SHA-256 of the bytes it already parsed, and starts over when the stream id (device, inode, pi branch)
changes. ctime appears only in the catalog version (mtime:ctime:size) as one signal next to mtime and
size.

Measured on HostHatch (kernel 6.12.0-124.52.2.el10_1), 500 tries each:

result
two chmods in a row leave ctime unchanged 499 / 500
an append leaves mtime and ctime both unchanged 495 / 500
an append leaves the size unchanged 0 / 500

So on that host a timestamp-only change check would miss most appends, and the size the live-turn refresh
reads to never does.

Validation

  • HostHatch (the host that failed): server/pi-models.test.ts 50 / 50 runs, 17 pass 0 fail each;
    server/native-incremental.test.ts + server/conversation-metadata.test.ts 5 / 5 runs, 55 pass 0 fail.
  • Locally: the new test passes, and fails with ctime removed from catalogVersion.
  • bun run check fast at 85d953e on old-desktop: all steps ok; unit: 18721 pass, 0 fail, 61 skip in 992 files.
    A HostHatch check fast run is queued; its result goes in a comment.

…th chmod

Two chmods in a row land in the same ctime tick on a coarse kernel clock (Linux 6.12 on HostHatch), so the test that #4122 added failed there every time. It now reports the moved ctime through a statSync spy, as claude-images.test.ts does, and still fails if ctime is left out of the catalog version.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Updated catalog version coverage to verify that changes to a catalog’s modification time produce a new version, while repeated reads with an unchanged time remain stable.

The catalog-version test replaces permission changes with a mocked statSync result. It checks that versions remain stable when ctimeMs is unchanged and change when ctimeMs changes.

Changes: Catalog version test

Layer / File(s) Summary
Mock ctime-based version checks
server/pi-models.test.ts
The test mocks statSync and checks version stability for unchanged ctimeMs and a version change when ctimeMs changes.

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

Change: Other

Merge Risk: Minimal · up to 85d95

This is a test-only change that makes a ctime-based catalog version test independent of filesystem clock granularity. It does not alter runtime behavior, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the test now reports a moved ctime instead of making one with chmod. It matches the raw summary and the PR objectives. It is 77 characters, within a short single-sente…
Description check Passed The description covers the problem (the chmod-based test failing on coarse ctime), the resulting test-only change, and a measured explanation that the product does not have a bug. Validation lists the…
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 main change: the test now reports a moved ctime instead of making one with chmod. It matches the raw summary and the PR objectives. It is 77 characters, within a short single-sentence title.

Full details: Description check

Explanation

The description covers the problem (the chmod-based test failing on coarse ctime), the resulting test-only change, and a measured explanation that the product does not have a bug. Validation lists the commands run, the hosts used, and results. A HostHatch check fast run is still queued, and the description says its result will go in a comment. The template asks for contract-test coverage only for HTTP/WS changes, which this test-only change does not touch. The description does not link an issue, but the template asks for that only for features.

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 6d7f6f0 and 85d953e.

Files selected for processing: 1

  • server/pi-models.test.ts

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

@devswha

devswha commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

bun run check fast at 85d953e on HostHatch: server/pi-models.test.ts passed (the file that failed there on every run before this change); unit tests 18733 pass, 1 fail. The one failure is scripts/install-binary.test.ts "leaves the lock to a waiter that claims it while the holder removes it, and both succeed" (an install.sh lock race, checked the signature with openssl exit 1), which this test-only change does not touch.

@devswha
devswha merged commit c71da91 into main Nov 18, 2026
23 checks passed
@devswha

devswha commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head 85d953eda. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit reviewed this head.

@devswha
devswha deleted the fix/catalog-version-test branch November 18, 2026 13:04
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