Preserve the end anchor when an earlier holds observation arrives - #896
Merged
WaylandYang merged 3 commits intoSep 24, 2026
Merged
Conversation
…nto its row Signed-off-by: dada-yan <BinjunYann@gmail.com>
This was referenced Sep 24, 2026
Signed-off-by: dada-yan <BinjunYann@gmail.com>
WaylandYang
approved these changes
Sep 24, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
The fix matches ADR 0022's definition of attested_to ("the date of the document that said the fact was over") and closes exactly the hole 0022's rationale warned about; every attest_earlier call site carries the right flag and the SQL keeps the anchor CHECKs intact. One non-blocking note: insert_open_statement still passes true, and set_open_validity can put an attested_to on an open row, so the carve-out is reachable; since open anchors start equal it is harmless today, but false is the principled value under 0022. Either flip it or say in the comment why it is safe. The real-database regression covers both branches. LGTM.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An earlier observation that a fact held could move an existing unknown-end anchor backwards and collapse its historical interval. Preserve that end when merging a holds observation; continue moving it earlier when the incoming observation actually says the fact ended.
The PostgreSQL regression now checks both branches on the same fact: a holds observation moves the start from 08:00 to 07:50 while retaining the 08:10 end; an earlier ended observation then moves the end to 08:00 and retains the 07:50 start and row identity.
Open-statement insertion intentionally retains its existing two-anchor behavior: the statement's temporal meaning has not yet been resolved at that point. This PR changes the typed-fact merge decision, not that separate interpretation boundary.
Validation:
86fadd8, based ondev@9f50e3c, passed Rust format, strict workspace/all-target Clippy and the real-database workspace suite (1,079 passed, 0 failed, 5 existing ignored). The required new test name was verified in the log. PostgreSQL 16/pgvector,UTOPIA_TEST_REQUIRE_DB=1; the unavailable PDF fallback utility limits that unrelated coverage.No schema or API changes; independent of #884. Refs #875.