test(store): same-second project tombstone regression test can pass without asserting its timestamp boundary
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 70/100
Research direction
Start with TestDeleteProjectTombstoneKeepsSameSecondPostDeleteMutationPending in internal/store/project_delete_tombstone_test.go, and note how it reads occurred_at and deleted_at. Reproduce by inserting the 1.1s sleep between the hard delete and the post-delete enqueue, and check the timestamp precision the store writes. Done means the test derives the boundary from the mutation's own occurred_at, asserts occurred_at > deleted_at within one second, and fails on second-precision stamping while passing on the current head.
Written by the indexing model from the issue text.
Description
Existing Issue Search
- I searched existing issues and will add evidence to a canonical tracker when applicable.
📝 Observed Consequence
The regression test introduced for the sub-second project-tombstone fence —
TestDeleteProjectTombstoneKeepsSameSecondPostDeleteMutationPending in
internal/store/project_delete_tombstone_test.go (PR #1895) — asserts mutation dispositions
only. Nothing in it asserts the timestamp boundary it is named after, and the same-second
collision it depends on is left to the wall clock. When the post-delete enqueue lands in a
later second than the tombstone's deleted_at, every assertion still holds for a reason
unrelated to the behaviour under test: the test reports a pass while occurred_at carries
only second precision. A regression back to the second-precision column default can go
green.
🔄 Steps to Reproduce
- Check out the head of PR #1895 (
a517487). - Restore second-precision stamping:
git checkout dd7fb2bc -- internal/store/store.go - Keep the merged test body unchanged and insert a wall-clock gap between the hard delete
and the post-delete enqueue (a slow or loaded machine does this on its own):
time.Sleep(1100 * time.Millisecond) - Run:
go test ./internal/store/ -run '<the merged test>' -count=1 -v
✅ Expected Behavior
The test must fail whenever occurred_at carries only second precision, because a
post-delete mutation then compares occurred_at <= deleted_at against the tombstone and the
<= fence supersedes content that was journalled after the delete. Coverage of that fence
must not depend on how fast the machine is: the collision has to be constructed, not hoped
for.
❌ Actual Behavior
It passes. With the enqueue landing in a later second than deleted_at, no assertion
observes the boundary, so the merged test shape reports success on the broken stamping. The
raw timestamps recorded below show the regression plainly: occurred_at has no fractional
part at all.
Operating System
Windows
Release Version (Report Context)
main 82846a1; PR #1895 head a517487
Agent / Client
Other
📋 Relevant Logs
# state: dd7fb2bc store.go (occurred_at from the datetime('now') column default)
# merged test shape + a 1.1s gap before the post-delete enqueue
$ go test ./internal/store/ -run 'TestProbeSameSecondFalseGreen' -count=1 -v
=== RUN TestProbeSameSecondFalseGreen
zz_falsegreen_probe_test.go:94: PROBE RESULT: the merged test shape reports PASS
zz_falsegreen_probe_test.go:100: PROBE TIMESTAMPS: occurred_at="2026-10-15 16:48:45"
deleted_at="2026-10-15 16:48:43.977332100" shares_second=false strictly_after=true
--- PASS: TestProbeSameSecondFalseGreen (1.59s)
PASS
ok github.com/Gentleman-Programming/engram/v3/internal/store 3.979s
# a deterministic construction (asserts occurred_at > deleted_at within the same
# second) fails on that very same broken stamping, which is what the merged test
# shape should have done
$ go test ./internal/store/ -run
'TestDeleteProjectTombstoneKeepsSameSecondPostDeleteMutationPending' -count=1 -v
=== RUN TestDeleteProjectTombstoneKeepsSameSecondPostDeleteMutationPending
project_delete_tombstone_test.go:413: post-delete mutation "s-tomb-post-1" was
superseded in the ordinary pass ({Seq:3 Project:hotel Entity:session EntityKey:s-tomb-post-1
Op:upsert ReasonCode:local_entity_deleted ...}); it must stay pending
--- FAIL: TestDeleteProjectTombstoneKeepsSameSecondPostDeleteMutationPending (0.46s)
FAIL
FAIL github.com/Gentleman-Programming/engram/v3/internal/store 2.913s
FAIL
💡 Additional Context
- Reported by the author of #1851, the hard-delete tombstone gap this fence guards.
- Filed separately from #1851 because #1851 covers the missing project tombstone itself
(fix in review at #1895); this is specifically the regression test's coverage of the fence. - Fix shape: derive the tombstone boundary from the mutation's own
occurred_at, then
assertoccurred_at > deleted_atwhile sharing that second, and assert dispositions in both
the ordinary and the folded pass. No clock seam is added and production behaviour is
unchanged, so the diff stays test-only. gofmtis not enforced by CI here (.golangci.ymlenables only errcheck, staticcheck
and unused), so this is about coverage, not formatting.- Related: #1851, PR #1895.
- Filed separately from #1851 because #1851 covers the missing project tombstone itself
- Dominant language
- Go
- Stars
- 7.1k
- Forks
- 729
- Avg merge
- 9h 12m
- Merged PRs (30d)
- 331
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Gentleman-Programming/engram
-
status:needs-review type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Gentleman-Programming/engram#2138 ·
Maintainers usually reply within 1 day
-
status:needs-review
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Gentleman-Programming/engram#2065 ·
Maintainers usually reply within 1 day
-
bug(opencode): early local identity failures hide actionable recovery diagnosticsPossibly taken @dnlrsls claimed this today. Openstatus:approved type:bug
Gentleman-Programming/engram#2170 · 1 assignee ·
Maintainers usually reply within 1 day
-
bug(tests): investigate session-owned startup failure assertion under Linux race CIPossibly taken @dnlrsls claimed this today. Openstatus:needs-review type:bug
Gentleman-Programming/engram#2169 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
status:needs-review type:bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Gentleman-Programming/engram#2166 ·
Maintainers usually reply within 1 day
All issues in Gentleman-Programming/engram
Similar issues
-
Handler accepts zero/negative NNCP_MAX_RETRIES and NNCP backoff values, stalling policies or hot-loopingPossibly taken @NopeCharon claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nmstate/kubernetes-nmstate#1604 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug raised-by:desk
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
medici-finance/assay#4723 ·
Maintainers usually reply within 1 day
-
[doc-healer] DDUw improvement: retry integrity-filtered issue reads with direct single-item lookupsOpenautomation documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
flannel-io/flannel#2608 ·
Maintainers usually reply within 2 days