Skip to content

Pin the clock for the incremental content-analysis body-read test - #110

Merged
Carl723000 merged 1 commit into
ClaudeCodeUsage:mainfrom
Alfiefe10:fix/incremental-index-test-clock
Sep 22, 2026
Merged

Carl723000 merged 1 commit into
ClaudeCodeUsage:mainfrom
Alfiefe10:fix/incremental-index-test-clock

Conversation

@Alfiefe10

Copy link
Copy Markdown
Contributor

Summary

content analysis is materialized from per-file contributions without a second body scan began failing on its own around 2026-09-20, on every branch. Its fixture stamps the corpus 2026-08-21 and the test asks for windowDays: 30 against the real clock, so once the data aged past 30 days the warm update read a second body and the bodyReads === 1 assertion broke. The assertion is about incremental body reads, not about window expiry, so this pins Date.now to 2026-09-10T12:00:00.000Z — the same constant and the same try/finally shape the neighbouring content-analysis tests already use.

No production code changes. The diff is six real lines; the rest is the reindentation of the test body inside the try block (git show -w shows only the six).

Linked issues

None. It is what currently turns Node Tests red on #108, which touches none of this.

Type of change

  • Documentation / CI / chore → docs / ci / chore (patch)

How was this tested?

The test itself. node --test --test-name-pattern "materialized from per-file contributions" out/test/claudeIncrementalIndex.test.js → fails on main (2 !== 1), passes with this commit.

That the clock was really the cause. Recompiling the test on main with the fixture timestamps shifted from 2026-08-21 to 2026-09-20, with no other change, makes it pass. Nothing about the index behaviour changed; the fixture simply fell out of the window.

Full suite, Windows 10. npm run test:node on main: 1024 pass / 9 fail. With this commit: 1026 pass / 7 fail. Seven of those are the pre-existing Windows symlink failures (EPERM ... symlink, ENOTEMPTY) that need Developer Mode and pass in CI on Linux. The ninth, worker cancellation persists a resumable atomic checkpoint, failed in the baseline and passed after; it is timing-flaky here and is not touched by this change.

Scope check. Walking the 14 tests in the file that assert diagnostics.bodyReads, this is the only one that combines windowDays with an unpinned clock, so there is no second time bomb of this kind in the file.

Checklist

  • npm run compile is clean
  • User-facing strings go through I18n with all eight UI locales filled — n/a, test-only
  • Behaviour/documentation changes update all seven README editions together — n/a, no behaviour change
  • CHANGELOG.md updated (user-visible changes) — n/a, nothing user-visible
  • README.md updated if behaviour/settings changed — n/a
  • New settings default to existing behaviour (opt-in) — n/a, no settings
  • No new runtime dependencies

The fixture timestamps are fixed at 2026-08-21 while the test asks for a
30-day window against the real clock, so on 2026-09-20 the corpus aged out
of that window and the warm update read a second body. The assertion was
about incremental body reads, not about the window, and it expired by date
on every branch. Pinning Date.now the way the neighbouring content tests
already do keeps it meaningful.
Copilot AI lite review requested due to automatic review settings September 21, 2026 15:40
@github-actions github-actions Bot added the fix Patch — bug fix label Sep 21, 2026
@github-actions

Copy link
Copy Markdown

🤖 Automated first-pass review

The configured analysis model did not return a usable analysis for this pull request. The item has still been received and remains available for maintainer review.

To help with review, please ensure the change summary, tests, and any user-facing documentation or localization updates are included.


🤖 Posted automatically by CCU Bot — not a maintainer decision.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused test-only change matches existing clock-pinning patterns and addresses the reported fixture expiry.

Review effort: Lite
Findings: None

What changed in this PR

Pins the incremental content-analysis test clock so its 30-day fixture window remains deterministic.

Changes:

  • Freezes Date.now during the test and restores it with finally.
  • Keeps production code unchanged.
File Description
src/​test/​claudeIncrementalIndex.test.ts Stabilizes the time-sensitive incremental index test.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Carl723000
Carl723000 merged commit 19d0bb0 into ClaudeCodeUsage:main Sep 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Patch — bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants