Repository navigation
feat(retrieval): validity transitions, TRANSITIONS and the retrieval indexes (format 9) - #115
Merged
Merged
Conversation
… postings Each reverse-index posting now carries the membership's validity interval, and the postings tree's summaries carry time bounds and role bits, so a scan of a member's postings can skip subtrees by time or role. A validity-only membership update rewrites the posting. An unbounded interval end is not stored, so a default membership costs one byte more than before. The storage format is now 9; directories written by format 8 are refused. No issue tracks this work.
Reader.incidentAt walks a member's postings, skips postings-tree subtrees whose summary rules out the instant, and filters on the interval each posting now carries. Temporal.activeEdges and INCIDENT TO ... VALID AT use it, so they no longer read every incident edge's member tree. Edges of another tenant are still dropped before they are returned. No issue tracks this work.
Slot 53 keeps, for every tenant, edge type and side, the instants at which non-default membership intervals start or end, with a count of matching incidences per edge. ValidityIndex lists the edges with an endpoint in a window and counts them from summaries. Memberships with the default interval are never indexed. The property index's directory schema is now a factory, shared with the new slot. No issue tracks this work.
A merge replayed deltas in id order, so a membership could name an atom the branch created but the merge had not adopted yet. Memberships are now applied after every created atom and before deletions, so derivations that read a member's record see it. No issue tracks this work.
Slots 47 to 49 keep each hyperedge's signature (its edge type and the multiset of its members' types), the hyperedges of each signature per tenant, and the tenant and signature behind each signature key, so a colliding key is detected and filtered. Slot 56 lists the child hyperedges of each parent with the child's roles, weight, validity and position; its summaries carry weight, time and role bounds. Both are kept by derivations on membership changes. The docs describe storage format 9 and the new slots. Randomized tests now use a fixed seed. No issue tracks this work.
A typed edge match whose top-level conjuncts are 'x VALID AT a' and 'NOT x VALID AT b', with literal a != b, gets a ValidityTransition candidate: the edges with a validTo (disappeared) or validFrom (appeared) in the window, read from slot 53 through tenant-scoped Reader methods and estimated from its summaries. Both conjuncts still verify every candidate, so results match the type scan; EXPLAIN names the new path. No issue tracks this work.
…tions TRANSITIONS EDGE e[:T] FROM ... TO ... (APPEARED | DISAPPEARED) [MEMBERS] lists what was present at one generation and absent at the other on the session's branch. Retained generations are diffed; older windows are folded over the change feed, which keeps the first and last change per key and skips other branches' events through the branch lineage. The fold waits until every commit up to the reader's generation is published, since the feed is appended just after publication. A window before the feed's first event is an error, and a window over budget fails as a whole. Results are tenant-scoped by each edge's and member's stamped tenant, so readers can run it. TransactionManager.awaitPublished is now public. No issue tracks this work.
A generation becomes current before its commit event is appended to the change feed, so awaitPublished could return while the reader's newest commit was still missing from the feed. It now always waits for the commit's publication to finish. A FEED_APPEND fault point lets tests hold a commit between the two steps. No issue tracks this work.
A branch that added a member which the target branch had since deleted could never be merged: the new indexes need the member's record. Such memberships are now reported as member-deleted conflicts and skipped under every policy, including when an ordered edge's sequence is copied. When a commit is replayed after a concurrent delete of a member, the indexes raise a retryable conflict instead of an invalid-schema error. No issue tracks this work.
TRANSITIONS returned edges and members of types the reader may not read; records now go through the same tenant and type check as every other read. A time instant only resolves through retained history when the next generation is retained too, so a gap left by a pinned generation no longer widens the window; otherwise it is resolved through the feed. Two times with no commit between them return no rows instead of an error. No issue tracks this work.
TRANSITIONS built a branch's lineage from active branches only, so the history of a branch whose parent had since been merged or dropped lost the parent's events and returned too little. Lineage now reads every branch record, closed ones included. No issue tracks this work.
Reader.typeOf and Reader.edgeAtom answer from the catalog record with the reader's tenant and type checks, without building an Atom. The retrieval operators that build on this branch use them. No issue tracks this work.
This was referenced Nov 23, 2026
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.
This adds the storage the remaining retrieval work needs and two ways to ask what changed over time: in validity time (when a membership holds) and in generation time (what was committed).
Storage format 9. All new indexes land in this one format change, so later retrieval PRs add no storage. Directories written by format 8 are refused with the usual "export and reload it" message.
Slots 47 to 49 and 56 are only written here. Structural matching and hierarchical retrieval read them in the next PRs.
Validity time
INCIDENT TO x VALID AT tandTemporal.activeEdgesnow read onlyx's postings and skip subtrees whose summary rules outt. Finding the one edge valid at an instant among 5,000 visits 4 pages instead of 25.MATCH EDGE c:T WHERE c VALID AT a AND NOT c VALID AT b(literala != b) gets aValidityTransitionplan from slot 53. Both conjuncts still verify every candidate, so results match the type scan.Generation time. A new statement; the syntax is open for renaming before merge:
Fixes found along the way
member-deletedconflicts and are skipped.awaitPublishedcould return before the feed held the reader's newest commit. A newFEED_APPENDfault point makes that testable.Testing
TRANSITIONSqueries per tenant matched a Python model, before and after a SIGKILL and recovery. A deliberately wrong model is caught (156/300 and 365/480).TRANSITIONS, the feed race, merges with deleted members) and three smaller ones I graded up (time instants inside a history gap, two times with no commit between them, the replay error type). Each has a test that failed before its fix.Not done here
Reader.validityEndpoints; its only caller already checks.ServerTest#hostileConnectionsAreClosedEarlyfailed once in three runs on unchanged server code while the machine's load average was over 100. That looks like a timing race in the test itself.