From 40609949f456f39ac3ed86c962da03d91ecaad18 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Mon, 7 Sep 2026 04:21:47 +0200 Subject: [PATCH] docs(design): allow unknown-start state coexistence under D111 --- decisions.md | 34 ++++++++ plan/README.md | 2 + .../temporal_undated_state_coexistence.md | 86 +++++++++++++++++++ plan/designs/postgres_schema_design.md | 4 +- plan/designs/temporal_clocks_design.md | 60 +++++++++++-- .../temporal_write_and_lifecycle_design.md | 5 +- .../temporal_write_and_lifecycle_schema.sql | 2 +- plan/proposals/temporal_overlap_permission.md | 20 +++++ 8 files changed, 204 insertions(+), 9 deletions(-) create mode 100644 plan/analysis/temporal_undated_state_coexistence.md create mode 100644 plan/proposals/temporal_overlap_permission.md diff --git a/decisions.md b/decisions.md index 1a675cb57..f8ba3f18d 100644 --- a/decisions.md +++ b/decisions.md @@ -5312,3 +5312,37 @@ incorporated by `plan/designs/postgres_schema_design.md`. Analysis: Amends D107/D108, D88/D90, D55, D67 and D74; preserves the D60/D61 library boundary. Build order is `plan/plans/temporal_clocks.md`. This decision resolves the design gates; it does not certify T.1 implementation, conversion or release. + +## D111. Unknown-start states may coexist without fabricated identity or contradiction + +**Status:** accepted when merged. **Date:** 2026-09-07. + +**Context.** D107 prohibits mixed dated/undated evidence attachment and requires +coexistence without a supported succession or contradiction. Its exclusion +nevertheless treats an ordinary unknown-start state as an infinite interval, +making some required same-value coexistence impossible in PostgreSQL. + +**Decision.** Apply relation interval exclusion only to states with a known +verdict start, preserving the existing belief, contradiction and erased-boundary +conditions. Both fully unknown and unknown-start/known-end states can coexist; +known-start open-ended states retain protection. All writers validate start +acquisition against eligible neighbors under D110 locks. Refused acquisition +preserves existing endpoints and records the reason. Current membership remains +D107 §7.1; consumers disclose unknown starts and unresolved identity overlap, +and fact-identity counts do not imply distinct dated episodes. + +**Alternatives and consequences.** Forced evidence or contradiction invents +semantics. Exempting only both-NULL endpoints misses a legal ending-occurrence +cap; exempting unknown ends unnecessarily weakens dated open-ended protection. +An explicit overlap-permission field adds redundant lifecycle state for this +class. SQL stops enforcing uniqueness among unknown-start identities; ordered +identity adjudication and receipts remain mandatory. No new public grant, +source of validity, schema field or scheduler is introduced. Conversion, +readiness, replay, erasure and consumers must share the amended contract. + +**Authority.** [D107 §4.2.1](plan/designs/temporal_clocks_design.md), +[D110 companion schema](plan/designs/temporal_write_and_lifecycle_schema.sql). +[Analysis and independent challenge](plan/analysis/temporal_undated_state_coexistence.md). +Amends D107/D110's unknown-start exclusion policy; preserves their mixed identity, +world-time, belief-time and erasure contracts. This resolves the identified +mixed-state contract conflict; implementation and release remain separate gates. diff --git a/plan/README.md b/plan/README.md index fce037e13..8aa5ca035 100644 --- a/plan/README.md +++ b/plan/README.md @@ -7,6 +7,8 @@ architecture lives in `designs/`; research in `analysis/` is non-binding. For the temporal program, start with [D107 temporal clocks](designs/temporal_clocks_design.md), then [D110 writes, corrections and lifecycle](designs/temporal_write_and_lifecycle_design.md). +D111's unknown-start coexistence amendment lives in D107 §4.2.1, with +[supporting analysis](analysis/temporal_undated_state_coexistence.md). The [complete schema amendment](designs/temporal_write_and_lifecycle_schema.sql) is incorporated by the [PostgreSQL design](designs/postgres_schema_design.md). [Temporal sequencing](plans/temporal_clocks.md) tracks implementation dependencies; diff --git a/plan/analysis/temporal_undated_state_coexistence.md b/plan/analysis/temporal_undated_state_coexistence.md new file mode 100644 index 000000000..d5f0c41dd --- /dev/null +++ b/plan/analysis/temporal_undated_state_coexistence.md @@ -0,0 +1,86 @@ +# Unknown-start states and relation exclusion + +Status: non-binding analysis, 2026-09-07. This records an implementation-discovered +conflict in D107/D110. The binding resolution is D111 in +`../designs/temporal_clocks_design.md` §4.2.1. + +## Problem and evidence + +Consider two claims normalized to the same relation triple and state kind: +“Alex is CEO” without dates and “Alex was CEO during 2019.” D107 §4.2 prohibits +evidence attachment between dated and undated windows. Its §4.4 requires +coexistence when no supported succession boundary or contradiction exists. +Nevertheless §4.2's relation exclusion treats an ordinary unknown state window +as an unbounded range, overlapping every dated window of that triple. There is +no legal stored outcome for an ordinary, non-conflicting mixed pair in both +ingestion orders. Inventing succession from identical values would not fix the +semantic problem. + +Exact inspected contracts: `../designs/temporal_clocks_design.md` §4.1 +(unknown seed endpoints), §4.2 (mixed evidence prohibited; unknown bounds under +exclusion), §4.4 (world-time caps and coexistence), §7.1 (current membership); +`../designs/temporal_write_and_lifecycle_design.md` §4 (corrections draw endpoint +candidates only from already-linked identity evidence) and §6.1 (erasure is +distinct from ordinary missing timing). The implementation at `267a9d8e` plus +the ordered-application working changes exposed the conflict; an implementation +failure is evidence of the gap, not authority to weaken the constraint. + +PostgreSQL's [range documentation](https://www.postgresql.org/docs/15/rangetypes.html#RANGETYPES-INFINITE) +confirms that missing endpoints produce unbounded ranges. Its +[constraint documentation](https://www.postgresql.org/docs/15/sql-createtable.html) +confirms that the default exclusion check is immediate. Retrieved 2026-09-07. +Deferring the check changes its timing, not whether coexistence is valid. + +## Alternatives and independent challenge + +| Alternative | Assessment | +| --- | --- | +| Force evidence attachment | Loses the D107 distinction between a dated spell and an undated assertion whose identity is unresolved. | +| Create a contradiction group, erase a boundary, or invalidate belief | Introduces unsupported semantics merely to escape a constraint. | +| Keep the input retrying | Does not resolve the invariant and stalls an ordinary input indefinitely. | +| Exempt only states with both endpoints NULL | Incomplete: an ending occurrence can lawfully cap an unknown-start state to `(NULL, T)`. A later dated assertion before T produces the same mixed-pair conflict. | +| Exempt all states with either endpoint unknown | Unnecessarily removes protection from known-start open-ended states. | +| Exempt states whose start is unknown | Resolves both unknown-start shapes; retains known-start finite and open-ended protection; uses existing endpoint data. | +| Introduce explicit per-fact uncertain-overlap permission | Can distinguish more cases, but adds authority, writers, replay, erasure and consumer contracts for a class already identifiable by missing start. | +| Permit evidence after model-proven mixed identity | Potentially useful separate semantics, but inconclusive judgments still need lawful coexistence. | + +An independent read-only analysis initially preferred the both-NULL exception. +A second pass challenged it with the legal ending-occurrence cap. Both analyses +then converged on known-start-only exclusion. `CanonicalBounds.is_known` in +`src/rememberstack/core/temporal.py` is start-based; changing that helper would +not itself settle the state identity contract or unknown-start semantics. + +## Recommended full consequences + +The exclusion requires a known verdict start, in addition to its existing state, +non-invalidated, no-contradiction and no-erased-boundary conditions. Unknown-start +rows retain their kind, immutable seed, actual endpoints and bases. The +admission/identity/block/revision protocol and durable application receipt +prevent duplicate application; SQL does not pretend to settle uncertain identity. + +Acquiring a known start is a transition into exclusion eligibility. Under the +complete D110 locks the writer must check the entire proposed interval against +all eligible same-triple neighbors. Refuse an overlapping correction and retain +the previous endpoints with a recorded reason. A cap that preserves an unknown +start does not enter the exclusion. Erasure keeps its separate provenance and +uncertain-membership rules. + +Current membership remains D107 §7.1: a missing start adds no lower-bound test; +a known end still expires the row. Reads disclose the actual missing start and +unresolved identity overlap. Aggregates count fact identities, including both +coexisting identities when eligible; that count is not proof of distinct dated +spells or unique real-world episodes. Profiles cannot turn this uncertainty into +a fabricated timeline. No new schema field, scheduler or public permission is +needed. These contracts apply to conversion, replay and all writers, not only +new ingestion. + +The compatible exact-state shortcut is a related implementation hazard: a +single deterministic evidence target must survive inference about additional +candidates. D107 already requires that outcome. Multiple compatible exact +targets require their own explicit identity selection contract; this analysis +does not authorize arbitrary selection among historical slices. + +Required database evidence includes both ingestion orders, unknown-start finite +ends, multiple historical slices, known-start exclusion rejection, valid and +refused start acquisition, deterministic receipt replay, and erasure behavior. +The amendment is not an implementation or release certificate. diff --git a/plan/designs/postgres_schema_design.md b/plan/designs/postgres_schema_design.md index dc008f279..496de83dd 100644 --- a/plan/designs/postgres_schema_design.md +++ b/plan/designs/postgres_schema_design.md @@ -2757,7 +2757,9 @@ establish. The appendix separates committed enum expansion, structural stores, fenced in-place conversion and final constraint validation. Drop the old all-kind relation exclusion before applying converted uncapped occurrence rows, then -install the final state exclusion after conversion. The basis vocabulary adds +install the final state exclusion after conversion. D111 restricts that exclusion +to known-start states; ordinary unknown-start coexistence and guarded start +acquisition follow `temporal_clocks_design.md` §4.2.1. The basis vocabulary adds `erased`; cleared unsupported endpoints carry NULL/erased, affect current-query certainty and sit outside certified-state range exclusion. All ordinary writes and conversion/replay obey the documented serving-generation gate. diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 2ce467a07..a0895d3c7 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -215,12 +215,60 @@ no-op" short-circuit applies only to compatible state-shaped assertions; missing make an occurrence a state. D110 §3 defines the complete staging/receipt path. **Relations schema.** The existing GiST `EXCLUDE` on `(subject, predicate, -object) && tstzrange(valid_from, valid_until)` becomes partial on -`temporal_kind = 'state'`, retaining the existing non-invalidated and -no-contradiction predicates. D110 further excludes intervals with an `erased` -endpoint basis and requires explicit uncertain-membership disclosure. Ordinary -unknown-bounds states remain unbounded ranges under it. Occurrences have no -interval exclusion. +object) && tstzrange(valid_from, valid_until)` protects states with a known +verdict start, retaining the non-invalidated and no-contradiction predicates. +D110 further excludes intervals with an `erased` endpoint basis and requires +explicit uncertain-membership disclosure. D111 §4.2.1 below defines ordinary +unknown-start coexistence. Occurrences have no interval exclusion. + +### 4.2.1 Unknown-start state coexistence (D111) + +A missing start is insufficient evidence that a state occupied every earlier +instant. For example, “Alex is CEO” without dates and “Alex was CEO during +2019” cannot establish one identity under the mixed-pair rule above, but need +not contradict each other. Treating the first row as an infinite interval for +uniqueness would prohibit the required `new`/coexist outcome. The exclusion +therefore applies only when `valid_from IS NOT NULL`, alongside the existing +state, non-invalidated, no-contradiction and no-erased-endpoint predicates. + +Both `(NULL, NULL)` and `(NULL, finite_end)` states may coexist with dated +same-triple states. The latter arises when an ending occurrence lawfully caps +an unknown-start state. A known-start open-ended state remains protected. +Preserve temporal kind, immutable seed, endpoint bases and existing dates; +do not invent a contradiction, an erased endpoint, or an identity attachment +to make a row fit the constraint. Mixed `new` is an ordinary durable completed +identity outcome, not an endlessly retried input. D110's ordered admission, +block locks and application receipts still prevent duplicate application. + +Every writer that acquires a known start, including autonomous correction and +compensation, checks the complete resulting interval against all eligible +same-triple state neighbors under D110's locks and revisions. An overlapping +proposal is refused with a recorded reason and unchanged previous endpoints; +the database constraint remains the final defense. Capping an unknown-start +state without acquiring a start preserves its exemption. Conversion and replay +use the same predicate, and readiness verifies its exact definition. Erasure +retains D110 §6's separate basis, deletion and replay requirements. + +Membership stays as defined in §7.1: ordinary missing start supplies no lower +bound, and a known end still expires the fact. Reads expose that missing start +and any unresolved identity overlap; they do not turn ordinary unknown timing +into an erased-boundary result. Aggregates count eligible fact identities, +which can include both coexisting rows. Such counts must not be described as +proof of distinct dated spells or real-world episodes. Profiles and K pages +preserve this uncertainty instead of constructing an unsupported chronology. + +This changes no public grants or mutation authority and adds no new state +field. It removes SQL uniqueness among unknown-start identities, making +identity adjudication and receipts responsible for that class. Forced evidence +would collapse unresolved identities; a both-NULL exception misses the legal +known-end case; exempting unknown ends would also lose protection of dated +open-ended states. Explicit overlap permission would add redundant lifecycle +state for this class. See the +[analysis and independent challenge](../analysis/temporal_undated_state_coexistence.md). + +Acceptance requires both ingestion orders, unknown-start finite-end states, +multiple dated historical slices, retained known-start exclusion, accepted and +refused start acquisition, receipt replay, and source-removal/erasure coverage. ### 4.3 Revising a verdict: autonomous recorded correction (D110/D108) diff --git a/plan/designs/temporal_write_and_lifecycle_design.md b/plan/designs/temporal_write_and_lifecycle_design.md index 9c18d1e68..e07a7993a 100644 --- a/plan/designs/temporal_write_and_lifecycle_design.md +++ b/plan/designs/temporal_write_and_lifecycle_design.md @@ -251,7 +251,10 @@ forced into a state. The single unknown-bounds-state shortcut applies only to a state-shaped claim. `unknown` is the uncertain shape; `undated` is never a fourth temporal enum. Relations' exclusion remains partial on state kind, non-invalidated belief and no contradiction group, preserving the existing -contradiction exception. Overlapping occurrences remain legal. +contradiction exception. D111 (`temporal_clocks_design.md` §4.2.1) additionally +requires a known verdict start for exclusion eligibility; ordinary unknown-start +coexistence and start acquisition follow that contract. Overlapping occurrences +remain legal. ## 4. Autonomous corrections and compensation (#366) diff --git a/plan/designs/temporal_write_and_lifecycle_schema.sql b/plan/designs/temporal_write_and_lifecycle_schema.sql index 0ed61369e..44af7abb0 100644 --- a/plan/designs/temporal_write_and_lifecycle_schema.sql +++ b/plan/designs/temporal_write_and_lifecycle_schema.sql @@ -846,7 +846,7 @@ ALTER TABLE public.relations predicate WITH =, object_entity_id WITH =, tstzrange(valid_from, valid_until, '[)') WITH && - ) WHERE (temporal_kind = 'state' + ) WHERE (temporal_kind = 'state' AND valid_from IS NOT NULL AND valid_from_basis <> 'erased' AND valid_until_basis <> 'erased' AND invalidated_at IS NULL AND contradiction_group IS NULL); diff --git a/plan/proposals/temporal_overlap_permission.md b/plan/proposals/temporal_overlap_permission.md new file mode 100644 index 000000000..c53d0b5d7 --- /dev/null +++ b/plan/proposals/temporal_overlap_permission.md @@ -0,0 +1,20 @@ +# Explicit permission for unresolved state overlap + +Status: unchosen alternative to D111, 2026-09-07. + +An explicit per-fact identity-uncertainty field could permit overlap independently +of endpoint knowledge. It would require a recorded authority for setting and +clearing permission, a partial exclusion predicate, all-writer participation, +replay/forget coverage, and disclosure in retrieval, counts and generated text. + +D111 chooses missing verdict start as the existing discriminator for ordinary +undated coexistence. Adding permission for exactly that class duplicates state +and creates more transitions that can disagree. See +`../analysis/temporal_undated_state_coexistence.md` for the comparison. + +Adoption trigger: an accepted requirement calls for materializing distinct +known-start overlapping state identities while their identity remains unresolved, +and neither evidence attachment nor retaining unresolved testimony meets that +requirement. That decision must specify whether counts refer to fact identities +or distinct world episodes and include the complete lifecycle cost; a database +exclusion error alone is not evidence of contradiction or permission.