Skip to content

Preserve the end anchor when an earlier holds observation arrives - #896

Merged
WaylandYang merged 3 commits into
deeplethe:devfrom
Maya-Kid:fix/preserve-ended-fact-anchor
Sep 24, 2026
Merged

WaylandYang merged 3 commits into
deeplethe:devfrom
Maya-Kid:fix/preserve-ended-fact-anchor

Conversation

@Maya-Kid

@Maya-Kid Maya-Kid commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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 on dev@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.

…nto its row

Signed-off-by: dada-yan <BinjunYann@gmail.com>
Signed-off-by: dada-yan <BinjunYann@gmail.com>

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@WaylandYang
WaylandYang merged commit 084aba9 into deeplethe:dev Sep 24, 2026
7 checks passed
@WaylandYang WaylandYang mentioned this pull request Sep 25, 2026
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.

2 participants