Materialization reconciles the rows it writes, and a version keeps the date it was pushed with - #911
Conversation
…e date it was pushed with Two gaps from the #875 replay (#899, #900). Typed materialization wrote rows through the graph's gate but never ran the uniqueness-timeline reconciliation the write path runs after every state fact, so a functional attribute kept two open values and a later observation could not close the earlier one without a manual reconcile. materialize and try_materialize now collect the rows they wrote (new, merged and implied) and reconcile them after the commit, the same reconcile_facts the write path uses; Outcome reports corrected and conflicts. A timeline rewrite (close, rehome) now carries from_statement_id, implied, typed_fact_sources and implied_fact_sources onto the corrected row, so the next round sees it as already computed instead of adding a second one. A same-identity update replaces the document's doc_time, so evidence that stayed on the earlier version dated at the later time and the two values looked simultaneous. document_versions gains doc_time (migration 0090, backfilled for the current version), every version row records the document's date at that moment, and the timeline dates a fact by its evidence's own version, falling back to the document's date for older rows. A pushed statements document now carries the observation's external_id and doc_time ahead of the three arrays, so two observations that saw the same thing are two documents under the one-document-per-content index, and the same payload under a new identity is never a rename. The parser reads only e, s and n. The record and the guide say so. Tests: the two reproductions from #899 and #900 run un-ignored as acceptance; the explicit-reconcile test now expects the materialization to have done the work; a route test pushes one payload under two identities and gets two dated documents. Store and server suites green on a fresh database, clippy clean. Closes #899 Closes #900 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Wayland Yang <wayland0916@gmail.com>
|
Ran this end to end against a live server built from 12f4a68 (fresh database with migration 0090 applied at startup, job worker on, no chat model). Setup through the API: a #899, one identity per observation. Push #900, same identity updated. Same payload, new identity. obs-2's payload pushed again as obs-3, and once more at 08:20 as obs-4: both |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Wayland Yang <wayland0916@gmail.com>
Fixes the two gaps @Maya-Kid pinned down in the #875 replay. Their reproductions run un-ignored as the acceptance tests.
#899. Typed materialization wrote rows through the graph's gate but never ran the uniqueness-timeline reconciliation the write path runs after every state fact, so a functional attribute kept two open values.
materializeandtry_materializenow collect the rows they wrote (new, merged, implied) and reconcile them after the commit through the samereconcile_facts;Outcomereportscorrectedandconflicts. A timeline rewrite (close, rehome) carriesfrom_statement_id,impliedand both source tables onto the corrected row, so the next round does not add a second one.#900. A same-identity update replaces the document's
doc_time, so evidence left on the earlier version dated at the later time and the values looked simultaneous.document_versionsgainsdoc_time(migration 0090, backfilled for the current version), every version row records the document's date at that moment, and the timeline dates a fact by its evidence's own version, falling back to the document's date for older rows. A pushed statements document now carries the observation'sexternal_idanddoc_timeahead of the three arrays, so the same payload under a new identity is a second document under the one-document-per-content index, never a rename. The parser reads onlye,s,n.Record 0054 and the ingest guide say both. CLI schema version 76.
Tests:
a_later_bound_statement_closes_the_earlier_place,a_same_identity_update_closes_the_earlier_place, the explicit-reconcile test now expecting materialization to have done the work, andthe_same_payload_under_a_new_identity_is_a_second_observation. Store and server suites green on a fresh database; clippy clean.Closes #899
Closes #900
🤖 Generated with Claude Code