Skip to content

CI-only: fix/go-module-content-stamp (#953 follow-up) at 784e9222 (do not merge) - #69

Closed
peterkc wants to merge 8 commits into
mainfrom
ci/fix/go-module-content-stamp
Closed

peterkc wants to merge 8 commits into
mainfrom
ci/fix/go-module-content-stamp

Conversation

@peterkc

@peterkc peterkc commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Fork-only draft to run CI for fix/go-module-content-stamp at 784e922 (zzet#953 follow-up: compare go.mod and Go caller contents before cache reuse, with a Git-style racy-stat rule). Upstream zzet#980 test layout; no fork-only commit. Do not merge.

The tracked go.mod snapshot and the Go caller source cache treated a file
as unchanged when its size and mtime matched. A same-size edit within one
clock tick, such as renaming a module to a path of equal length and back on
Windows, kept the old module path or the old caller facts.

The go.mod stamp now carries a content hash, and a missing go.mod is a
valid absent state. Other stat or read errors no longer compare equal. The
one-second check throttle is unchanged. Caller recovery always reads the
file and reuses cached facts only for an equal digest, so unchanged files
are still not parsed again. The stamp invalidation calls on the save paths
are removed, since the digest check now covers them.

Tests hold size and mtime equal with os.Chtimes for a module rename and
rename back and for a caller edit on the in-memory and SQLite stores, and
cover failed reads and snapshot reuse with Go and non-Go roots.
Reading and hashing every queued Go caller on each provider save made
unchanged callers cost one read each. The caller cache now keeps size,
mtime and the wall time taken before its read. It trusts equal stats
without a read only when the file's mtime is older than that time minus
a two-second window (Git's racy-file rule; FAT timestamps can cover two
seconds). Recent stats, such as a same-size edit in one clock tick, still
verify the digest. Known saves clear the trust again, so an editor that
restores an old mtime after a save is verified.

Limit, as in Git: an unobserved same-size edit that restores an mtime
older than the window is trusted until the next save of that file.
The snapshot hashed one read of each root's go.mod, and the module path
and replacements came from two later reads. An edit between those reads
could pair the hash of one version with the parse of another, and later
checks would keep the stale identity. Each check now reads every root's
go.mod once and takes the hash, module path and replacements from those
bytes. A missing go.mod is still a valid absent state, and a failed read
still blocks reuse. Untrack now asks whether go.mod was present instead
of whether a stored mtime was set.
Caller recovery stat'ed the file, and shared parse admission stat'ed it
again. Recovery now passes the size it already has to admission, and
skips an oversized caller before admission and before the read. The
check after the read for a file that grew stays as it was.
TestGoModuleSourceCacheVerifiesTouchedContent registered its extraction
spy after the touched-mtime save, so that save's "never re-parsed" claim
was not checked, and its message still described the removed stamp
refresh. The spy now starts before the first save. The test checks one
read and zero parses for the touched save, then no read once the stat is
outside the racy window.
The snapshot now takes module paths from goModuleIdentities, so
readGoModModule had no production caller and repeated its parse. Its
test now checks goModuleIdentities on the same go.mod inputs.
Three tests set a caller's mtime from the wall clock and expected the
recovery that follows to stay inside the two-second racy window. On a
slow or loaded runner, setup could take longer, and the recovery would
trust the stat and skip the read the test depends on. The time a
verifying read is recorded now comes from goModuleSourceNow, which these
tests pin to the caller's fixed mtime (or an hour after it for the
old-stat case), so each case takes one branch of the rule.
Caller recovery reads and hashes a file without the cache lock, then
stores the result with a fresh trusted stamp. Repository lanes can run a
provider-lane recovery while the caller's own repository saves that
file. If the save kept the size and an old mtime, the stored pre-save
digest was then trusted by stat, and later recoveries reused stale calls
until the caller was saved again.

Each known save now bumps a per-indexer epoch under the cache lock.
Recovery reads the epoch with the entry and, when it stores its result,
keeps the facts but drops the stat trust if the epoch moved. The next
recovery then verifies the bytes. A test runs a save during the read and
checks that the next recovery reads again and the one after does not.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • coderabbit

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Team
  • Run ID: c8de3d13-ae4d-457d-98af-5eccf636d375

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@peterkc peterkc closed this Oct 26, 2026
@peterkc
peterkc deleted the ci/fix/go-module-content-stamp branch October 26, 2026 13:41
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