Skip to content

test(vault): take the orphan blob's age in TestPrune from the test clock - #240

Merged
bketelsen merged 1 commit into
mainfrom
irulan/prune-test-clock
Nov 15, 2026
Merged

bketelsen merged 1 commit into
mainfrom
irulan/prune-test-clock

Conversation

@frostyard-machines

Copy link
Copy Markdown
Contributor

Summary

TestPrune (internal/vault/write_test.go) fails on main since 2026-11-15 09:30 UTC, in Verify and in the race detector (CI run 43716324908): write_test.go:395: blob 5134638c kept = true, want false.

The cause is a time bomb in the test. The test vault's clock starts at testStart (2026-10-16 09:30 UTC) and the test moves it 31 days. The orphan blob that the test makes got the real modification time of its file. Manager.Prune keeps an orphan blob whose file is younger than a day by the configured clock (internal/vault/manager.go, the wait for a device's push, docs/specs/sync-protocol.md, Blobs). Once the real date passed the test clock's "now minus 24 hours", the orphan looked young and was kept.

The test now sets the orphan file's times to the test clock, so the orphan is 2 days old at the prune whatever the real date is. Every assertion stays the same. No production code changes.

Risk tier

Risk tier: 1 — a test change only (internal/vault/write_test.go). No changed file is in .github/risk-paths.json.

Verification

  • Before: go test -count=40 -run 'TestPrune$' ./internal/vault on main (6c33227): 40 of 40 runs fail at write_test.go:395.
  • After: go test -count=20 -run 'TestPrune$' ./internal/vault: ok; go test -race -count=1 ./internal/vault: ok.
  • make check (host, umask 022) at the head: exit 0.
  • Revert test: with the change removed, the unchanged test fails at write_test.go:395 (blob 5134638c kept = true, want false), the failure on main.

TestPrune's clock starts on 2026-10-16 and moves 31 days, but the orphan
blob it makes got the real modification time. The daily prune keeps an
orphan younger than a day (docs/specs/sync-protocol.md, Blobs), so from
2026-11-15 09:30 UTC the orphan looked young and the test failed on
main. The test now sets the orphan file's times to the test clock.
@github-actions github-actions Bot added the level:L3 Skim label Nov 15, 2026
@frostyard-machines

Copy link
Copy Markdown
Contributor Author

Cross-review (reviewer openai/gpt-6.1-sol; coder deepseek/deepseek-flash) at 7d8ba6a, base 6c33227: Ready, Blocking: none, no findings. The reviewer confirmed the root cause (test clock ends 2026-11-16 09:30 UTC, orphan cutoff 2026-11-15 09:30 UTC), the blob path, and that the other asserted blobs (v1, v2, gone freed by the version prune; v3 referenced) do not depend on file times.

@bketelsen
bketelsen merged commit e787095 into main Nov 15, 2026
11 checks passed
@bketelsen
bketelsen deleted the irulan/prune-test-clock branch November 15, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L3 Skim ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants