Repository navigation
test(backend): anchor the belief-band test to the clock it is measured against - #13501
aryanorastar wants to merge 1 commit into
Conversation
…d against The test pinned captured_at to 2026-07-13T12:00Z with a 30-day half-life and asserted the band reads `fading`, but memory_item_to_memorydb computes the band via public_belief_overlay(item, now=datetime.now(timezone.utc)) and takes no `now` a test can pin. Elapsed time therefore grew every day the suite did not run, and crossing two half-lives at 2026-09-11T12:00:00Z flipped the band to `history` and failed the assertion for good. Neither the band logic nor the read path is wrong. The test was measuring them against a clock it could not hold still, so captured_at is now relative to that same clock. 45 days rather than 30: one and a half half-lives puts currency at 0.354, mid-band. 30 days lands exactly on the current/fading boundary, where `current` requires strictly greater than 0.5, so the outcome would turn on sub-second timing between building the fixture and reading the clock. Mutation-checked: raising FADING_BAND_MIN to 0.4 fails the test, restoring it passes, so the assertion still catches a real band regression. Failure-Class: none Co-Authored-By: Claude Opus 5 <[email protected]>
|
Thanks for this — the diagnosis is excellent and the write-up is exactly the kind of analysis we like to see: the time bomb was real (the fixture pinned Unfortunately this landed independently while the PR was open: #13506 (merged as b5d425e, "test(backend): keep memory belief-view half-life fixture clock-relative") anchors the same test in For the record, your 45-day mid-band anchor (currency ~0.354, comfortably between the Closing with full credit for a correct root-cause analysis. Thanks again! Automated maintainer feedback on behalf of the Omi maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hey @aryanorastar 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
What changed
test_memory_item_to_memorydb_attaches_belief_view_only_when_flag_onnow anchorscaptured_atto the real clock instead of a fixed date.Why
The test was a time bomb, and it went off at 2026-09-11 12:00:00 UTC.
It pinned
captured_atto2026-08-12T12:00Z − 30 days = 2026-07-13T12:00Zwithhalf_life_days=30, then asserted the band readsfading. But the band is not computed against that pinned date —memory_item_to_memorydbcallspublic_belief_overlay(item, now=datetime.now(timezone.utc))(canonical_memory_adapter.py:410) and takes nonowa test can supply. So elapsed time grows every day the suite is not run:At exactly two half-lives the currency is 0.25 and the band is still
fading. One second later it ishistory, and the assertion fails — permanently, on every run from then on. Measured on this branch at 14:52 UTC today: 60.120 days elapsed, currency 0.249311, bandhistory.Nothing is wrong with the band logic or the read path. Both are correct; the test was measuring them against a clock it could not hold still.
Why 45 days
45 days is one and a half half-lives — currency 0.354, mid-band. 30 days would sit exactly on the
current/fadingboundary (currency 0.5, andcurrentrequires strictly greater), making the result depend on sub-second timing between constructing the fixture and reading the clock.Verification
FADING_BAND_MINto 0.4 (so 0.354 falls intohistory) fails the test; restoring it passes. The assertion still catches a real band regression.Impact
This one test reddens
Backend Unit Testson every PR that merges current main — it is currently failing on #12409 (shard 3/4) and #11183 (shard 4/4), neither of which touches memory code.Failure-Class: none