Gate P9 — Principals, permissions and security¶
Status: Gate P9 passed (2026-11-10). G0–G5, G7 and G8 pass; G6 was skipped by owner decision (2026-11-10). Design: ADR 0017 r0.5, accepted; SPEC v1.9.0.
G0 — ADR review history¶
Independent, non-implementing reviewers, then the owner:
| Round | Findings | Result |
|---|---|---|
| r0.1 review | 8 blockers, 9 majors, 9 minors | not acceptable |
| r0.2 closure | blockers and majors closed or partly closed; 7 new majors and 12 minors (N1–N19) | acceptable after fixes |
| r0.3 check | N1–N19 closed; text points fixed in place | acceptable, pending owner decisions |
| owner review of r0.3 | merge permissions not defined per class (base needs Curate, Policy the store owner); macOS isolation by mode only, while extended ACLs grant access and are inherited; personal-lane permissions undefined | fixed: per-class merge table, owner and ACL checks with a two-user test, a synthesised personal:<name> entry used by every rule |
| focused check | N23 non-owner merges unusable; N24 ancestor ownership and server authenticity; N25 SQLite's own files and the service log | fixed; N23 raised decision F14 |
| owner review of r0.3 fixes | P1: key-log unlinks not durable (no sync_dir after deleting old generations); P1: migration completion undefined (format 5 visible before the packs are encrypted) |
fixed in r0.4 |
| owner review of r0.4 | P1: a rerun after the marker and before the log swap skips the log upgrade; F14 too wide (a non-owner could carry a Policy change into main) |
fixed in r0.5 |
| owner, r0.5 | none | accepted, G0 passed |
Every finding and its disposition are in ADR 0017 §14.
Decisions (owner, 2026-11-06)¶
F1–F13 take the recommended option (a):
- F1 one principal per OS user, mapped from the peer uid by a committed access document.
- F2 the default lane is unchanged; each lane names its curators.
- F3 crypto-shred through one key per content hash in an append-only key log;
ctx migratere-encrypts existing packs. - F4 the signed log head is deferred to its own ADR.
- F5 G6 runs with two OS users on macOS (and Linux if the remote host allows).
- F6 personal lanes do not egress by default; validators marked
local = trueare exempt. - F7 a merge needs authorisation (
MergeUnauthorized{count}). - F8 non-owner principals use MCP only in P9.
- F9
ctx uiuses a per-launch token in multi-user mode. - F10 proof of possession: non-owner commits carry the bytes of every content hash they introduce.
- F11 branches record their creator.
- F12 the store owner sees everything.
- F13 a principal holding the exact bytes may learn they were shredded.
F14, in the owner's narrowed form:
- A merge into the merger's own branch transports every mergeable change; reads still go through the ACL.
- A merge into
mainor a branch the store owner created needs the store owner for an actual Policy change. - ValidationRecords keep their exact
(rule, curvec)and their original validator source. - CodeAnchor objects arrive not base and
unobserved. - Every other change is checked as its direct op: Curate, rule premises, artifact targets.
Gate items¶
From ADR 0017 §11 and SPEC §5 P9:
- G1: fmt, clippy
-D warnings, the workspace tests,cargo denywith the crypto crates. - G2: T17, T17b, T58, T59, T60, S13-rows-e2e (UNAVAILABLE), T98–T108.
- G3: PROP15 and PROP16 at 10,000 seeds; PROP14 per principal; PROP13 and T14 with the global ops.
- G4:
- the security review against ADR 0017 §2 and SPEC §10;
- IPC fuzz ≥ 24 h from a non-owner uid;
- kill points around shred, purge and migration;
- a full disk during a key-log rewrite.
- G5: the budgets of ADR 0017 §11 (initial, ADR-calibrated).
- G6: two-user runs on macOS.
- G7: the earlier phases' G2/G3/G4 and the P8 suite (T106).
- G8: README (multi-user setup, threat model, shred limits, backups), CHANGELOG, SPEC, and an independent implementation review.
Implementation milestones¶
See ADR 0017 §13.
- Done. Principals and transport (ADR 0017 §3; T58, T98, T99).
- Reserved ids (
PrincipalId::is_reserved,is_store_owner): 0–15 and0x5641_xxxx. Document ids start at 16. - The uid mapping (
principals::PrincipalMap): the store owner's uid gets the socket's channel principal, as before. A mapped uid gets its principal, on the agent socket only. Any other uid is closed before a byte is read.- The mapping is checked again on every request; a revoked or remapped uid gets
AccessRevokedand the connection closes. - In milestone 1 the mapping is set by
Daemon::set_principals; milestone 2 feeds it from the committed access document.
- The mapping is checked again on every request; a revoked or remapped uid gets
- Socket layout:
run/shared/agent.sock(directory 0711);run/private/{observer,admin}.sock(0700);- the public
run/shared/endpointrecord (0644: protocol, socket name, owner uid). - The agent socket is 0600 in single-user mode and 0666 once another principal is mapped.
- Entering multi-user mode (
set_principals) first requires the file-system rules (contextdb-proto::fsguard):- every entry owned by the daemon's uid, private modes, and no ACL (deny-only included);
- the ancestors owned by root or the owner and not writable without the sticky bit;
- every mapped uid able to search down to the shared socket;
- the sockets inside
<data>(the long-path fallback is refused). - Violations are returned by name, and the agent socket stays closed.
- File modes:
- the store layer and the outbox create directories 0700 and files 0600 explicitly;
ctxd,ctx,ctx-hookandctx-mcpsetumask(077);- the launchd plist has
Umask = 63and the systemd unitUMask=0077; ctx doctor <dir> --fix-modesrepairs modes and strips ACLs (macOS throughexacl, Linux through the POSIX ACL xattrs, so no libacl is needed), and never changes an owner.
-
Clients:
Client::connect_shared(andctx-mcpfor a data directory the caller does not own,--dataorCTXDB_DATA) reads the endpoint. Before sending anything it checks that:- the endpoint's owner uid equals the owner of
<data>; - the ancestors pass the ownership rule;
- the socket's peer uid is the owner.
Otherwise
ServerNotOwner. - The non-owner allowlist (service::non_owner_allowed): the requestsctx-mcpsends. Everything else isChannelRestricted(Status, hooks, observer and admin requests). - Sessions and handoffs: - sessions are bound only by their principal:SessionOfAnotherPrincipalfor session ids and claimed call ids; - harness keys are per principal, also after a restart; -ctx_handoff_begin{to}names the accepting principal; unnamed handoffs stay within the sender's principal; - listing and accept show only handoffs addressed to the caller; - the accept reportsdropped_unauthorizedand validates only what it copied. - Protocol 7. - the endpoint's owner uid equals the owner of
Tests:
- p9_transport: T58; T98 (layout and modes, SQLite's -wal included; mapped, unmapped, revoked and remapped uids through the debug-build peer-uid hook; modes, inherited ACLs, an unsafe ancestor, the long-path fallback; forged and malformed endpoints); T99 (bindings, harness keys across a restart, addressed handoffs across a restart).
- p9_allowlist (contextdb-mcp): every ctx-mcp tool, driven as a non-owner, sends only allowlisted requests.
- fsguard unit tests, and the session-log test for tag 23.
Deviations from ADR 0017 and open items:
- The session log gains one event tag inside format 4. An addressed HandoffBegin (sender or recipient not the store owner) is tag 23. An unaddressed one keeps tag 20's bytes. ADR 0017 §10 said the session log is unchanged. No format bump is needed, because a P8 binary cannot open a P9 store anyway (op_log format 5).
- Ancestor ACLs are not evaluated. The ancestor check reads modes and groups (id -G), not ancestors' ACL denies (§3.2 calls it best effort). G6's real two-user run is the authority.
- Multi-user mode is not reachable outside tests yet. Milestone 2 maps principals from SetAccess. Until milestones 3 and 4 add read redaction and write authorisation, a mapped principal would see and write everything, so milestone 2 must not let a deployment enter multi-user mode before then.
- TxnStatus for non-owners: "own rows only" (§5.5) lands with the read redaction in milestone 3.
- may_read (handoff filtering) is the milestone 3 stub and allows every read.
2. Done. The access document (ADR 0017 §3.1, §4).
- Op::SetAccess{doc}, op tag 20, op_log format 5:
- admin only (ChannelRestricted), the sole op of its batch (SoleOpRequired), committed on main, global to every branch;
- never in a dry run, and not on another branch (both InvalidAccess);
- kernel state, rebuilt by replay and carried by format-5 snapshots.
- Validation (contextdb-core::access::validate): every rule of §4.2 that needs no daemon state gives InvalidAccess{reason}. The daemon adds the owner-uid rule before the kernel (the owner entry must carry the daemon's uid), whether the document comes through SetAccess or a raw admin batch. ctx_commit and ctx_what_if refuse it (InvalidRequest).
- Principal ids (AccessState::apply): new names get ids from 16 upwards, in sorted order within a document. Ids are never reused, a name keeps its first id, and the owner's entry maps to 0.
- Authorized(p, l, b) (AccessState::authorized): the five steps of §4.4 over entry(lane) (§4.3). It returns the decision and the deciding step. A grant dir covers a dirs entry that is equal to it or below it.
- The independent reference (contextdb-oracle::AccessModel): validation, ids, and Authorized as a decision table. BranchOracle applies SetAccess with the kernel's error order.
- The daemon:
- Request::SetAccess, AccessShow and AccessCheck (admin socket);
- the mapping (principals::map_of) applied at start and after every SetAccess, through the file-system gate (principals::MultiUser), and only when Options::multi_user is set;
- with multi-user mode enabled, a SetAccess that maps another uid is refused before it commits while the rules fail, a start is refused (StartError::MultiUser), and any failure falls back to single-user mode.
- The CLI: ctx access apply|show|check. access.toml is parsed with unknown keys refused, defaults filled in (code_lanes readable by members and written by the owner, default_lane owner only, [personal] egress = false), and the owner entry found by the caller's uid.
- Migration: ctx migrate accepts format 4: the header-only rewrite keeps batches, hashes and frame checksums. EventLog v3 carries tag 20.
Tests:
- contextdb-testkit p9_access:
- wire and EventLog v3;
- kernel and branch oracle on admin, sole, main and dry-run refusals;
- 17 validation cases through both;
- id assignment (leaving, rejoining, owner rename, refused switches);
- Authorized step by step against ADR §4.4;
- PROP15 for M2: random documents (valid and invalid) and random logicals. Kernel and oracle agree on acceptance, ids and every decision with its step; 2,000 seeds by default (CONTEXTDB_P9_ACCESS_SEEDS), and 20,000 seeds were run.
- contextdb-store p9_access_log: replay and snapshot, and format 4 → 5 byte-identical. migration now targets log::FORMAT_VERSION.
- contextdb-daemon p9_access:
- owner-uid and channel checks;
- AccessShow, and AccessCheck per branch and its errors;
- without multi-user mode nobody is mapped;
- with it the mapping follows SetAccess, revocation and restart;
- the file-system gate on SetAccess and at start.
- ctx unit tests: the ADR §4.1 example parses; unknown keys and a missing owner are refused.
Deviations from ADR 0017 and open items:
- ctx migrate 4 → 5 is the header-only rewrite for now.
- The completion procedure of §10 (the MIGRATING-5 marker, re-encrypted packs, rebuilt projections, disk verification) lands with crypto-shred in milestone 6.
- A store migrated by a milestone-2 build is at format 5 with plaintext packs and no marker. Milestone 6's open check must refuse it (MigrationIncomplete), and its rerun must handle "format 5, no marker" by running steps 3–7.
- The three deployments stay on their P8 build and are not migrated unless the owner asks.
- AccessDoc carries owner, the name of the owner's entry. ctx access apply fills it from the caller's uid, and the daemon checks it against its own. The kernel is pure, yet id assignment must know which entry maps to 0.
- A name cannot switch between the owner and another principal (InvalidAccess). Otherwise a former owner name could later bring a different uid in as principal 0. This follows from §3.1 ("a name always maps to its first id"); §4.2 does not list it.
- Grants as well as denies may name @group. §4.4 says denies apply "directly or through a group"; grants are read the same way. A subject must name at least one principal, and every principal it names must be a member.
- Code-lane writers may be *owner or the owner's name; any other principal after expansion is refused. An empty lane name is refused too.
- The wire form of AccessDoc is binary and canonical (sorted maps and sets, like PolicyDoc's wire form), not inline JSON. It is canonical by construction.
- Visibility (step 3) never decides while personal entries are synthesised: a principal is never a member of another's personal lane, so membership refuses first. The step is kept, as §4.4 says. PROP15 checks that it is unreached.
- Multi-user mode needs Options::multi_user. ctxd never sets it in this milestone. Read redaction (milestone 3) and write authorisation (milestone 4) must land first.
- ctx access check answers only for principals the current document lists. AccessShow and AccessCheck are admin-socket only.
3. Done. Reads (ADR 0017 §5).
- The redaction point (contextdb-daemon::redact): Service::handle sends every response to a principal other than the store owner through Viewer::redact.
- The viewer judges Authorized(p, l, b) once per logical, through BranchView::authorizes (the kernel's access document, the branch's dirs). A rule is whole only if its conclusion, premises and references are all visible.
- The branch is the one the request reads: the bound session's, the one OnBranch named, or the one ctx_changes resolved. Ids are resolved on the newest snapshot, so a commit's own allocations are found.
- The pass is total: a response type a non-owner cannot receive becomes ChannelRestricted. The store owner's responses are returned as they are, with no redaction.
- Filtered where computed, because they leave a trace:
- ctx_read, ctx_why, ctx_why_not and ctx_impact of a hidden logical answer Unavailable{target}, with the target as sent and no ledger entry;
- recall's admit checks authorisation first, so a hidden match takes no slot and is never withheld;
- certificate issuance refuses an unauthorised entry (NotCertified{Unavailable}), and validate_certificate returns Denied when an entry is no longer authorised (T101);
- handoff may_read is the real check;
- TxnStatus answers only for rows of the caller's principal: the store's TxnStatus::Committed now carries the row's principal.
- Shapes (protocol 7):
- Response::Unavailable{target};
- Envelope.redaction: Option<Redaction>, holding redacted, redacted_references, per-node NodeRedaction{rev, rule, premises, rules} and vector_size per certificate id;
- Witness::Redacted and StaleReason::SupersededPinnedPremiseRedacted, which appear only in responses and are never computed.
- ctx ui: a launch token while the access document maps other principals. It is printed in the URL fragment, kept in sessionStorage, sent as Authorization: Bearer and checked in constant time; a foreign Origin is refused and no cookie is used. recall.sqlite abstracts are used only before any access document exists.
- ctx-mcp: {key, status: "UNAVAILABLE"} and a redacted object in tool results.
Tests:
- contextdb-daemon p9_reads:
- T17: UNAVAILABLE by key and key@rev in both modes; no ledger entry; the owner unfiltered.
- T17 recall: min(limit, |authorised|) for two principals and every limit; scopes of unreadable lanes are empty.
- T17b: WHY with a redacted witness, one hidden premise and one rule whose premises are all hidden; WHY_NOT and IMPACT counts; UNAVAILABLE targets.
- T100: Diff, ctx_changes, TxnStatus per principal and withheld error details on a live service; a pure sweep over every list-bearing response type, including certificates and verdicts, merge reports, feeds, items, errors and the store owner.
- T101: a revocation makes a cert-id check and the ledger's check Denied, and later reads UNAVAILABLE.
- Handoff dropped_unauthorized.
- PROP15, read half: random generate_p7 histories spread over shared, personal, code and unlisted lanes, with four creators, SetMetadata dirs and a second document in the middle. Random valid documents with groups, grants, denies and *writers. For every principal (mapped, owner-reserved, unknown):
- the viewer equals AccessModel;
- WHY, WHY_NOT, IMPACT, the whole-history diff, every commit result and the verdicts name no hidden id, and their counts equal the reference;
- digests do not depend on the reader;
- ids avoid the reserved ranges.
Default 300 seeds (`CONTEXTDB_P9_READ_SEEDS`); 10,000 were run, covering 148,186 hidden and 180,775 visible (principal, logical) pairs, with WHY redacted 11,886 times and diffs 35,319 times.
p9_transportnow commits an access document that sharesrepo(milestone 1's tests assumed every read allowed).ctxunit tests for the launch token (401 without it, with a wrong one or as a cookie; 403 for a foreignOrigin; the static page open);contextdb-mcpUNAVAILABLE rendering and counts.
Deviations from ADR 0017 and open items:
- Counts travel in the envelope, not inside each response type. Commit results, merge reports and certificates are durable values, and their encodings stay unchanged; one redaction record per response carries what §5.4–§5.6 count.
- WHY lists a rule when at least one of its premises is visible, without the rule's other premises. Explanations name rules, not their premises. Per-rule premise counts are given for the witness rule, whose premise proofs are the only ones shown, and for WHY_NOT failures.
- WHY, WHY_NOT, IMPACT and Diff are not made bound requests (§5.4, §5.5). Redaction keys off the connection's principal and the branch the request reads (OnBranch or a bound session), which gives the same guarantee without changing the requests ctx-mcp sends.
- Error details are withheld wholesale for non-owners: the code stays, and the detail becomes fixed text except for a short list of codes whose detail names nothing. The finer mapping of §5.7 (echoing the caller's own refs, CycleDetected nodes with a count, MergeNotCertified{redacted}, Unauthorized) lands with write authorisation in milestone 4, which is where those errors arise.
- Validation::Ambiguous on a hidden logical names REDACTED_LOGICAL (u32::MAX, never a real id).
- Kept as counts: MergeReport.newly_visible and convergent. Validation::Unknown{lag} keeps its code-lane scope names.
- Nothing to redact: Item has no anchors or Conflict pointer field (§5.2), and the briefing and Stop report are store-owner requests (§3.3).
- validate_certificate checks Denied after BranchMismatch. A certificate from another branch is judged there; its entries' dirs are branch-dependent.
- ctx ui replays the op_log, which only the store owner can read (0700/0600), so in practice it is the store owner's viewer and shows everything (§5.10). The token keeps other local users, who can reach 127.0.0.1, out of it. Serving a non-owner through agent.sock is not built: a non-owner cannot run the viewer at all.
- Vectors only for egress lanes (§5.3) comes with egress in milestone 5.
- Multi-user mode is still not reachable outside tests: ctxd never sets Options::multi_user before write authorisation (milestone 4).
4. Done. Writes (ADR 0017 §6).
- Kernel checks (txn.rs, Authorise): they run inside the transaction for every kernel batch (commit, what_if, ImpactBatch), against the kernel's access document and batch.principal.
- Order. A logical ref that resolves is checked first, so a hidden logical answers Unauthorized(Read) whether or not the revisions the op names exist. The other refs resolve next; then comes Read on everything the op names, then the role (Write or Curate in entry(lane)), then the channel.
- Rules. Create: a writer, and a curator for a base. Revision, head, metadata: read and write. Bases: read and curate. Rules (AddRule, Rebind, SetRuleEnabled): read the conclusion, every premise and every reference, and write the conclusion's lane. Artifacts: read and write the target. RecordValidation: refused (Curate). ExpectHeads: read.
- Errors. Unauthorized{op_index, reference, need}, where reference is the ref as written. InvalidLane for personal:<unlisted> covers the store owner too, while an access document exists.
- Who is checked. Non-owner batches skip the kernel's fast path, so they always reach the checks. The store owner (any reserved id) passes every check. A single-branch Db outside the kernel checks nothing (auth: None), and neither does the store's replay of main.
- Branches (rule 6):
- BranchInfo.creator comes from the creating batch's principal, the store owner's class for reserved ids. It is in snapshots as a trailing section; older format-5 snapshots lack it and are rejected (replay).
- Commits, merges and archives on another principal's branch are BranchOfAnotherPrincipal. Owner branches take every writer's commits, and only the store owner archives them. A fork writes nothing to its parent and is open to anyone.
- Auto-binding (resolve_branch_for) binds a git branch's namesake only if the session's principal or the store owner created it.
- Merges (rule 7, kernel_merge::refusals): after classification and before the plan, a non-owner merge into main or an owner branch counts every applied change failing its class:
- a policy that actually changes;
- new logicals (writer) and new revisions (read and write, plus curate when they arrive as base);
- heads and metadata (read and write; dirs must narrow);
- existing base bits (curate);
- new rules and changed enabled flags (read everything named, write the conclusion's lane);
- new and changed artifacts (read and write);
- the Conflicts the merge opens (read each side).
ValidationRecords and CodeAnchor objects are transported unchecked. Any failure refuses with `MergeUnauthorized{count}`. A merge into the merger's own branch is not checked.
- The oracle reference (
contextdb-oracle) is written independently:InputModel::apply_authorisedlists each op's reads and roles and takes the first unmet one;BranchOracleapplies the branch rules as a table, and the merge rule as a diff of the merged target against the target.
- Daemon:
- Proof of possession (
Service::possession) for every content-hash field of a non-owner's batch inctx_commit,ctx_what_ifandImpactBatch, which now carryblobs(protocol 7). A hash without matching bytes, and not on a revision of a readable logical, gets the sameMissingBlobas an unknown hash. ctx_record/ctx_supersede: a dep naming a hidden logical isUnauthorized(Read)before any other answer (no head hint, no "does not exist");carry_rulesover a hidden premise is refused with the referencecarry_rules.- Error details of
Unauthorized,InvalidLane,MissingBlob,MergeUnauthorized,BranchOfAnotherPrincipal,HeadConflictandReadSetConflictreach non-owners.
- Proof of possession (
Tests:
- contextdb-daemon p9_writes:
- T102: creates per lane role, personal: lanes and InvalidLane; changes, bases, rules and artifacts; hidden refs with existing and missing revisions; dry runs equal to commits over eight cases.
- T107: a known and an unknown hash answer alike through commit, what_if and ImpactBatch, and in revision and artifact-payload fields; bytes and readable hashes prove possession; the owner is exempt.
- T60 deps and carry_rules.
- T108: branch ownership, archive and auto-binding; bob's merge of his branch; MergeUnauthorized for an owner branch with a secret record and a base change; catching up into his own branch; the owner's merge; a transported verdict keeps its rule, curvec and validator.
- contextdb-testkit p9_access:
- PROP15 write half (direct ops): generate_p7 histories over shared, personal (listed and unlisted), code and unlisted lanes; random principals, SetMetadata, and a second document; the kernel against InputModel::apply_authorised, every error equal. Default 1,000 seeds (CONTEXTDB_P9_WRITE_SEEDS).
- PROP15 write half (merges): a branch by a random principal, random writes on both sides, merges either way, kernel against BranchOracle. Authorisation errors are compared exactly. Default 1,000 seeds (CONTEXTDB_P9_MERGE_SEEDS).
- Both were run at 10,000 seeds.
- p9_reads (CycleDetected withheld, HeadConflict shown) and p9_transport were updated.
Deviations from ADR 0017 and open items:
- Replay re-runs the checks. The kernel always authorises, and replay goes through the same deterministic predicate against the same staged access document, so a batch valid at its epoch stays valid. §6.1 says replay never re-checks; the outcome is the same. A batch a pre-milestone-4 build accepted from a non-owner (tests only: no deployment had multi-user mode) could be refused on replay.
- Unauthorized.reference is text (key, logical N, rev N, rule N, artifact N, new rev K) in TxError, which has no wire form. The daemon passes it through as the error detail. For deps the op index is the dep's position.
- RecordValidation by a non-owner is Unauthorized(Curate) in the kernel. The daemon already refuses it on the agent channel (ChannelRestricted).
- The read check covers every revision an op names (for example both revisions of SetHead), not only its logical. A hidden revision is then never confirmed by LogicalMismatch.
- InvalidLane needs an access document. Without one, personal lanes have no special meaning (T106).
- A squatted branch name is skipped silently: the session binds main. The report to the session (§6.2 rule 6, "skipped and reported") is not built.
- Proof of possession scans the branch's revisions for a hash sent without bytes (linear). G5 measures it.
- Two pre-existing oracle differences surfaced, unrelated to authorisation. BranchOracle refuses an Existing id naming a revision staged earlier in the same batch, and on branches it reports DuplicateRule.existing and merge cycle paths differently. The direct-op property therefore compares against InputModel on main, and the merge property compares non-authorisation errors by variant. These belong to the P6 oracle and are left as they are.
- Multi-user mode is still not offered by ctxd. Egress (milestone 5) and crypto-shred (milestone 6) come first, then G6's real two-user run.
5. Done. Egress (ADR 0017 §7).
- The rule (contextdb-core::access): egress(lane) is the lane entry's flag, so personal lanes follow [personal] egress (default off, F6). Without an access document every lane egresses, as before P9. mirrored(lane) adds, when the document maps a principal besides the owner, that every principal reads the lane: members *members, no grants, no denies. Neither enters Authorized.
- Validators (validators.toml): local = true on a command validator; a claude validator with local is refused at load.
- A rule job reads the conclusion's lane and each changed premise's lane, and a pair reads its two sides' lanes. When one of them has egress off, the work goes to the first matching validator marked local.
- If only non-local validators match, the work is skipped with no attempt counted. A job stays Queued; every claim looks at it again, so it runs as soon as egress turns on or a local validator is loaded. A pair is postponed; a SetAccess (seen by discovery) or a reload makes every postponed pair due (Candidates::judge_wake).
- The worker checks again on the snapshot it builds the task from; if egress turned off meanwhile, the job or pair is given back (Ran::SkippedEgress).
- ctx validators status: skipped_egress (queued jobs blocked now) and pair_skipped_egress (postponements).
- The embedder: fill embeds a content only for a live head in an egress lane, and drops, before each batch, a content no egress lane carries under the current document. The vector ranker and embedding candidates skip heads in non-egress lanes (BranchView::egress), so a vector computed through another logical with the same content is not used for them.
- The mirror:
- render skips lanes that are not mirrored, under the access document of the kernel it renders. A replayed render at a tip's epoch therefore uses that epoch's document, and tips still validate.
- A commit whose parent had files of a withheld lane carries Ctx-Egress-Removed: <lanes> and a report line saying the bodies remain in older commits.
- In multi-user mode export refuses a repository whose common .git directory has group or other read bits (MirrorReadable), unless MirrorAction::Export{readable_ok} (ctx mirror export --readable-ok).
Tests (contextdb-daemon p9_egress, T105):
- a recording validator: a job with a premise in a non-egress lane is skipped by the remote validator with no attempt, then runs on a local one added behind it; with egress turned on it runs remotely; without an access document both jobs run;
- the judge: a pair in a non-egress lane is postponed for a remote judge (no call), woken by the SetAccess that turns egress on, and taken by a local judge while egress stays off;
- a recording embedder: no text from a non-egress lane is sent (a shared lane with egress off, and a personal lane); the shared-content vector is not ranked for the non-egress head; no embedding pair touches one; egress on embeds the lane, the personal lane stays off;
- a real repository: all lanes without a document; after the document, only the shared egress lane, with Ctx-Egress-Removed; MirrorReadable for a 0755 .git, accepted at 0700 or with readable_ok; the uncached tip validates by replay.
- Mutation check: removing the validator choice, the ranker filter or the mirror filter makes every test fail; with only the choice removed, the second check before the call still stops the job.
- validators.toml's local has a parser test.
Deviations from ADR 0017 and open items:
- "Multi-user mode" for the mirror is read from the committed document (another principal mapped), not from the daemon's Options::multi_user, so the render stays a function of the log. Single-user documents still withhold non-egress lanes (G-EGRESS).
- Skipped{egress} is not a job state. Jobs stay Queued and are counted at status time; pairs are postponed rows. The ADR's re-queue happens by construction for jobs and through judge_wake for pairs.
- judge_wake also cuts short the back-off of failed pairs, on a SetAccess or a reload.
- A body already sent stays sent. The checks run on the latest snapshot before each call; a SetAccess that commits during a call does not recall it (§2.3).
- The .git check reads modes only, not ACLs. Who can read the repository remains the owner's responsibility.
- ctx mirror export --rebuild (dropping the bodies from older commits) belongs to milestone 6 (§8.5).
6. Crypto-shred and migration (ADR 0017 §8, §10), in parts.
- 6a, done: encrypted packs and the key log (§8.1, §8.2).
- Records: CXBE | len | content_hash | nonce 24 | XChaCha20-Poly1305(key, nonce, plaintext, aad = content_hash). New segments start with CXPH\x01; a scan resyncs at the next magic of either record type, as before. A record is valid when it authenticates under its hash's key, and a read decrypts and then checks BLAKE3.
- The key log (contextdb-store::keys): keys/keylog-NNNNNNNN segments with a checked header (kind Append or Generation, purged_through) and CXKY records. Keys load from the newest generation and every later segment; the last record for a hash wins. Each process appends only to a segment it created.
- Durability: stage_blobs appends the new keys with an ordered sync before the pack records, and put_blobs fully syncs both. A key left by a crash before its record is reused.
- Open: key segments are synced and loaded before the pack scan.
Tests (`contextdb-store` `p9_packs`):
- no file in the store holds the plaintext;
- an acknowledged payload reads back after a power cut, over 64 seeds and every tail fate; a payload staged but never committed is absent or whole;
- without its key a payload is absent and a commit naming it is `MissingBlob`; a record relabelled with another hash fails authentication.
Two tests that corrupt a pack at a fixed offset now use 72 (segment header plus record header). The full workspace suite passed on the remote Linux host.
-
6b, done:
ShredContent(§8.3).- The op: tag 21, admin only, global, batches of
ShredContentalone (SoleOpRequired), committed onmainand never dry-run (bothChannelRestricted, with the reason inop). The kernel's shredded set lives in the kernel and in format-5 snapshots, as a trailing section. - The checks:
ContentShredded{content}comes beforeMissingBlobforCreateLogical/AddRevisioncontent,RecordValidation.meta,OpenArtifact.payload_hashandResolveArtifact.note.stage_blobsrefuses shredded bytes. - Reads:
Unavailable::Shreddedcomes from the store's pack index, refreshed after each durable group and at open.Response::Readcarriesunavailable(missing,corrupt,shredded), andctx-mcppasses it on. - The daemon:
Request::Shred{key, rev, with_reviews, confirm}lists the targets and commits withconfirm. A shredded hash never proves possession without its bytes.ContentShreddeddetails reach non-owners.
Tests: -
contextdb-storep9_shred: - T59 (store half): refusals, unchanged digests and statuses,Shreddedbefore and after a restart and from a snapshot, re-sent bytes and later ops refused; - PROP16: random multi-branch histories (branch_gen) with random shreds, against the same history without them. Results are compared modulo the epoch; every branch's inputs (epochs renumbered), statuses and fork epochs are compared; payloads areShreddedfor exactly the shredded contents; replay from the log, and half the seeds from a snapshot, agrees. Default 300 seeds (CONTEXTDB_P9_SHRED_SEEDS). -contextdb-daemonp9_writest59_t107_shredded_payloads: the plan across branches,with_reviews, refusals, the read'sunavailable, an unchanged status, and T107's shredded rows for a non-owner and the owner.Deviations: - PROP16 compares more than digests. Digests include epochs, so after renumbering it compares every input, status and fork epoch. The one exception is the payload hash of a merge's Conflict artifact, which names the merge epoch (ADR 0013 §6.2). "
doctoragrees" waits for 6c. - The oracle checks only the structure of shred batches (sole, admin,main, not dry-run). The shredded set andContentShreddedare checked against the store by PROP16. - Resolution notes for--with-reviewsare found by scanning the op_log, since artifacts do not keep their notes. - 6c, done: the purge (§8.2, §8.4). - The shred record in the kernel now maps each hash to its shred epoch, carried in snapshots, so every part's progress is an epoch (purged_through). - The key log (Store::rewrite_keys) is rewritten after the group's full sync, inside the commit, on the writer thread: 1.keylog-<n>.tmpwith aGenerationheader (purged_through= the last shred) and every other key, synced; 2. renamed, thensync_dir; 3. every older segment and.tmpunlinked, thensync_dir.Only then does
key_log_purged_throughmove. At open, the rewrite runs again if the newest generation is behind, a shredded key is loaded, or a.tmpor an older segment is left. A failed rewrite leaves the mark behind, and the next open or shred retries it. - The projections (contextdb-store::purge):secure_delete, a one-rowctx_purgetable andwal_checkpoint(TRUNCATE). - Recall re-indexes the touched logicals and runs FTS5optimize. - Vectors delete every model's vector of the content and evict the cache. Avectors.sqliteleft by a disabled embedder is opened and purged too. - Jobs whose rule's conclusion, asserted premises or current vector carry the content becomeJobState::Skipped(new state 5), withoutcome_metaandlast_errorcleared and the token bumped. - Pairs with such a side become judge state Skipped, with label, meta and error cleared. -Service::purgeruns after a shred commits (it decidespurged) and atctxdstart.ctx statusshowspurge_pending, the shred epochs above the lowest mark. - Races: - the indexer and the embedder check the store's live shred set while holding their projection's lock, right before writing; - workers check it after the call and before committing (Ran::SkippedShredded).Tests: -
contextdb-storep9_shredT103: the rewrite stopped after each of its five steps, and power cut under three tail fates over six seeds. The durable disk is read before reopening: once the rewrite reported completion, no file inkeys/holds the key. After recovery the key is gone, the payload isShreddedand other payloads read back. A mutation that drops the finalsync_diris caught: an old generation comes back. -contextdb-daemonp9_shred: - afterpurged, a scan of every file in the data directory (exceptsessions/, outside G-SHRED), including-walfiles, finds no shredded text. Mutations dropping the recall re-index or the WAL truncation are caught, inrecall.sqliteandrecall.sqlite-walrespectively; - a shred committed with no purge is pending inctx statusand purged at the next start; - the purge marks a queued jobSkipped; - a validator call in flight at the shred commits nothing and leaves the jobSkipped. -p9_writesT59 now expectspurged: true: the purge now completes inside the shred request. - The full workspace suite passed on the remote Linux host. The first run caught that stale T59 expectation; after the fix,p9_writesand PROP16 were rerun there. PROP16 passed at 10,000 seeds (46,253 shredded, 28,046 dropped, 9,023 multi-branch).Deviations: - A small window between the check and a validator's commit. The token fence checks the shred set just before the commit, not atomically with it. - The scan checks the data directory's files, not raw free blocks of the file system, which no user-space test can read. - "
doctoragrees" (PROP16, §8.2's key check) needs the doctor changes of 6e. - 6d, done: the mirror (§8.4 item 5). -MirrorStale{PayloadGone}(codeMirrorStale) for a ref whose history holds a blob whose body, or whole text, hashes to a shredded content.--forcedoes not override it, since its backup would keep the payload. The check runs before tip validation, so a replayed render, which now shows the placeholder, never makes such a tip lookMirrorModified. - The clean cache. A history found clean is cached per (repository, branch) with the last shred epoch it was checked against. A commit written on a clean parent is clean, since its tree is rendered after every shred in the snapshot. A new shred, a different tip or a lostmirror.sqlitecauses a rescan. - A deleted ref is not recreated on a cached commit that holds a shredded payload; the export starts a fresh history. ---rebuild(MirrorAction::Export.rebuild) writes one parentless commit of the current render, moves the ref by compare-and-swap whatever it held, and deletes everyrefs/contextdb-backup/ref. It reports thegit reflog expire --expire=now --all && git gc --prune=nowcommand and does not run it.Tests:
p8_mirrorT103: - after a shred, export isMirrorStale/PayloadGone, with and without--force; - a deleted ref comes back as a fresh one-commit history; - the backup ref still holds the text until--rebuild; - after it, the ref has one commit, no backup ref is left, no blob reachable fromrefs/contextdb*holds the text, and the shredded record renders as the placeholder; - exports continue, also aftermirror.sqliteis deleted.Two mutations are caught: never reporting
PayloadGone, and hashing only the whole file (front matter included), not the body. The full workspace suite passed on the remote Linux host.Deviations: -
--rebuilddiscards hand edits on the ref without a backup. A backup would keep the payload, andctx mirror proposalscan be run first. - Only the exported branch's ref is checked. Other branches' refs reportPayloadGoneat their own export, and--rebuilddeletes the backup refs of every branch. - 6e, done:ctx migrateto format 5 (§8.5, §10). -contextdb-store::migrate5runs steps 0 to 7 under the store lock.migrate::migratedecides step 2 from the log, never from the marker. A store with no commit yet (an emptylog/) counts as current. - Step 3 re-encrypts each plaintext pack segment and loose blob file into a new segment. Keys come first, each in anAppendsegment, synced. The copy is read back and every record decrypted before the old file is unlinked and the directory synced. Shredded contents (from the log'sShredContentops) are dropped. - Step 4 checkpoints each body-bearing projection withTRUNCATE, writes itVACUUM INTOa fresh file, and stamps that file (ctx_format.rebuilt_at_format = 5,secure_deleteon). It then unlinks the old-waland-shmand renames the fresh file into place. - Step 5 is the caller'sModes:ctxappliesfsguard::fix_modesand checks withfsguard::walk. - Step 6 checks the disk: - the log is current with no swap; - no plaintext segment or loose blob is left; - every content the log names, except shredded ones, is in an encrypted record with its key; - there is no key-log.tmp; - every projection is stamped, with no.migratingfile; - the modes pass. - Openers.Store::openrefuses a marked store with the first step whose cheap check fails, or 6 when none does. Without the marker it refuses a plaintext segment or loose blob (3) or an unstamped projection (4).doctor --truncate-beforerefuses a marked store.ctxdandctxprint "runctx migrateagain".StoreError::MigrationIncompletenow carriesstep; the old swap case is step 2. - New projection files are stamped as their first write (purge::is_freshbefore the connection opens). - A segment counts as plaintext only if it holds a valid plaintext record, so a torn or garbage segment left by a crash is not mistaken for one.Tests: -
contextdb-storep9_migrate(T104): - a format-4 store with two plaintext segments and a loose blob migrates. Payloads read back, frame checksums are unchanged, no file holds a body or aCXBPrecord, and a second run changes nothing; - a kill and a power cut after each of steps 1 to 6 and between sources: the opener anddoctorrefuse with the expected step. Before step 2 the log is format 4 with the packs byte-identical; after it the log is format 5. The rerun equals the uninterrupted result; - the marker durable with a format-4 log is refused at step 2, and a fault skipping step 2 cannot report success; - a format-5 store holding a plaintext segment, and one with only the marker; - the lane pre-check changes nothing; - shredded plaintext is not carried over; - real projections with text in free pages and the-wal: a kill between projections is refused at step 4, and after the rerun no file holds the text while the kept rows answer the same. -p6_crashG4 2 → 3 migration: a failure after the swap leaves a format-5 log in a store that still refuses to open, so the rerun skips step 2. - The full workspace suite and the release store and daemon suites passed on the remote Linux host. -recovery: T35's legacy loose blob now needsctx migrate. The two G4 tests that wrote plaintext pack records now write a key segment and an encrypted segment. -contextdb-daemonp9_shred:ctxdrefuses a marked store (step 6) and an unstamped projection (step 4), then starts afterctx migratewith its records. -ctxcli:doctorrefuses with the message,migratecompletes, and a second run says "already at format 5".Mutations caught: stamping projections in place instead of rebuilding them (the scan finds the text), and an open check that ignores the marker.
Deviations: - A content the log names that no pack holds (lost before the migration) is counted (
missing, printed as a warning) rather than failing step 6. Nothing can make it decrypt, and failing would block the migration forever. - The P8-binary checks are simulated. The test asserts the conditions a P8 binary relies on: format 4 with untouched packs before step 2, format 5 after it. - Step 0's space check counts the plaintext packs, loose blobs and unstamped projections. A simulated disk reports no free-space figure, so the check is skipped there. 7. Verification (in progress). - G7 passed on the remote Linux host.g7-p8.shcovers the earlier phases' G2/G3/G4 at gate counts: -gate-regression.shfor P0–P5b; -g3-p6.sh; - the P7 properties, kill points and stress; - the P8 G4 robustness tests.g3-p8.shcovers the P8 properties. Both ran on the tree with milestone 6 complete (T106: the P8 suite on P9 code). - G5 passed (ADR §11 budgets) after one fix. - Deviation: P8's G5 was measured on the M1 Pro. At the owner's request, this gate measures both sides on the remote Linux host (x86_64, shared): P8 at 47013dc, whose crates are identical to the P8 gate commit 5355556, and HEAD. The budgets are relative, so the comparison holds on one machine. -p9_bench(new) builds the access document the ADR names: 5 principals, 10 lanes, 50 denies.fullreads every row;narrowreads lanel9only, 1 % of the rows. - Fix: a narrow reader's recall. Before the fix,narrowhad recall p99 277 ms at 10⁴ and 2433 ms at 10⁵ records. The bm25 ranker skips hidden hits by paging with OFFSET, so it walked nearly every match. Recall now limits the FTS query to the lanes the principal may read. This applies when more than half the logicals lie outside them and it owns none there.admitstill decides each hit.AccessState::read_lanesis a superset ofAuthorized, and a unit test checks this over docs with grants, denies, groups, personal and code lanes. A daemon test, which fails without the owned-logical guard, checks the answer's set. The G8 review (MA1) found that the first form changed the order: its lane phrases were part of the bm25 expression. The ranked query now keeps the query's own MATCH and restricts by rowid, so bm25 scores are those of the unfiltered query. Re-measured after that fix (2026-11-10),narrowregressed to p99 ≈ 370 ms at 10⁵ records: SQLite handedrowid IN (…)to FTS5 asrowid =, one FTS5 query per rowid, and bm25 recomputed its idf over the whole doclist each time. The check is now+rowid IN (…)and comes before any column read; the rows and scores are unchanged. A store test fails on the old form, and a randomized store test compares filtered with unfiltered answers. Declared: like ascope, the filter's rank windows (RANK_WINDOWrows by rowid, P8) count only the rows of the principal's lanes, so beyond one window the interleaving can differ from the unfiltered order. P8 already makes ranking depend on unauthorised rows (ADR §5.9). A first version applied the filter to every restricted principal and costfull+32 % at 10⁵ records, so the filter is now sized by a census of interned lane ids. - Results:Budget P8 HEAD recall p99, P8 workload ( p8_bench), 10⁴ / 10⁵7.31 / 26.12 ms 7.35 / 26.12 ms +0.5 % / 0.0 % recall p99 with the document vs without, 10⁵ (two runs) — owner −1.6 / −0.1 %; full −0.0 / +1.9 %; narrow −18.6 / −18.8 % within +10 % recall p99 with the document vs without, 10⁴ (eight measurements) — full: median −4.8 % (−17.8 to +29.9 %); narrow −64 to −79 % see below recall p99 with the document vs without, after the +rowidfix (three runs)— 10⁵: owner +0.6 / +3.9 / −1.0 %; full +0.4 / +5.1 / −11.2 %; narrow −3.9 / +0.7 / −16.2 %. 10⁴: narrow −76 / −68 / −70 % within +10 % commit p99 ( store_bench, fullfsync on / off / file projections)1.545 / 1.583 / 2.687 ms 1.626 / 1.611 / 2.508 ms +5.3 / +1.8 / −6.7 % read p99 of a 4 KiB payload, decryption included — 0.047–0.055 ms within +0.5 ms shred of one content at 10⁵ (commit, key-log rewrite, every projection purged) — 0.55–0.63 s under 5 s reported: open with 10⁵ keys (key-log load) — 0.25–0.26 s reported: ctx migrateof 1 GiB of packs— 13.6–14.7 s - At 10⁴, p99 is noisy on this shared host. The store owner's path is the same code with and without the document, yet its p99 difference ranged from −25.5 % to +27 % between runs. A second 10⁴ section in the same process showed equal p50s throughout, so the gate takes the median.
fullexceeded +10 % in three of eight measurements, the owner control in one. - SQLite 3.54.1 (RUSTSEC-2026-0459,
rusqlite0.41.0), measured six times at HEAD. The P8 path got faster: recall p99 at 10⁵ is about 28 ms, from 52 ms. The store owner andfullstay within ±3 % at 10⁵.narrowis +10.2 to +12.7 % at 10⁵ (p99 about 31 ms, p50 about 30 % below the P8 path), and 24–48 % below it at 10⁴. - Deviation (owner, 2026-11-10):
narrowat 10⁵ is accepted at up to +12.7 %, over the +10 % budget. The extra time, about 3 ms, is the walk over the query's doclist that keeps bm25 equal to the unfiltered ranking (MA1). Ranking by the filtered MATCH would be faster but changes the order. The overrun appeared only after the faster SQLite; its absolute p99 is lower than the P8 path before the upgrade. - G8, independent implementation review (an agent against ADR 0017, read-only, at 492da30). It found 0 Blockers, 2 Majors and 6 Minors, plus test gaps, and every item is fixed. Each fix has a test that fails without it.
- MA1: the recall lane filter changed bm25 order (see G5).
- MA2:
ctx_conflictscut tolimitbefore redaction, so hidden conflicts took slots andtruncatedcounted them. The list is now filtered for the principal before the cut. - MI1: a lane name holding characters Rust and FTS5 split differently (private use) lost its rows from text recall. Lanes are now quoted whole, and a lane with no ASCII letter or digit gets the exact check alone.
- MI2: F12's hygiene default was missing: the store owner's agent-channel recall with no scope now leaves out other principals' personal lanes.
- MI3: the key-log purge check compared with the newest segment instead of the newest generation. Once a blob followed a shred, every open rewrote the whole key log.
- MI4: recall's
dirfilter read the paths of anchors hidden from the principal. With a restrictedcode_lanes, that let a principal probe the path. It now counts only anchors the principal may read. - MI5:
TxnStatuswas redacted withmain's view, which dropped a non-owner's own entries for a commit on its branch. It now uses the branch the batch committed on. - MI6: a non-owner's merge into
mainor an owner branch kept a new CodeAnchor's base bit. It now arrives not base (F14), in the kernel and the oracle alike. - Tests:
- T108 now has one case per row of §6.2.7: policy change and equal policy, a head in a read-only lane, an artifact on a hidden target, rules with hidden and with readable premises, a base bit, anchors, and a catch-up into the merger's own branch.
- PROP15's merge generator now issues
SetPolicy, CodeAnchors, artifacts,SetRuleEnabledandSetHead. - Verification: the full suite ran on the remote Linux host with 4 cores while the 24 h fuzz held 44, and PROP15 merges and PROP16 ran at 10,000 seeds each. Two timing tests failed once each under that load, one per run:
contextdb-protoannounceandcontextdb-hookse2edrift recovery. Neither touches this change. The hooks test then passed 5 of 5 alone, andannouncepassed in the second run. - Found, outside P9 (declared): the extended generator hit a pre-P9 edge. An
Existingref to a rule created by an earlier op of the same batch is resolved by the kernel onmain, while the branch oracle refuses it withUnknownRef. SPEC §6.1 defines onlyNew(k)for in-batch objects. The generator now names only rules that exist before the batch, and the semantics are left to a later ADR. - New randomized checks: per-principal recall returns
min(limit, |authorised matches|), the lane filter's answer matches filtering afterwards, and PROP16 now runsdoctor's oracle check after replay. - G8: the README has a multi-user section covering setup, the access document,
--multi-user, what other principals get, egress, shred and its limits, migration, backups ofkeys/, and the threat model. CHANGELOG entries are written per milestone. - G4, full disk during the key-log rewrite:
p9_shredmakes every write, append, sync, rename and unlink of the rewrite fail in turn. The shred commits without claiming the purge, and the next open, after a restart or a power cut, finishes it. - G4, fuzzing: two new targets.
ipc_principaldecodes requests from arbitrary bytes and sends them as a non-owner principal on the agent channel. They must never panic, and must never name a record in a lane that principal cannot read.store_recordscovers theCXBP/CXBEpack andCXKH/CXKYkey-log parsers; every record they accept must verify.
Both are in
scripts/fuzz.sh, andcheck.shtype-checks the fuzz crate. - Deviation: the target runs in-process with the principal's identity, not over a socket from a second uid. T98 covers the accept path, which maps the uid before any byte is read. -access_docfuzzes theaccess.tomlparser, which moved from thectxbinary into thecontextdb-clilibrary. It asserts no panic; a parsed document validates or is refused; and for a valid one,read_lanescovers every logicalAuthorizedallows. - The 24 h run.ipc_request,store_recordsandaccess_docrun for 24 h, 11 workers each.ipc_principal's first run stopped after about 1.5 h on a harness false positive.SimDisk::restartshares its state, so every run wrote into the base the next run started from. A branch bob had named after a needle in one input was then listed by a 1-byteBranchesrequest in a later run. Each run now starts from a deep copy (crash), andipc_principalrestarted for a full 24 h. - Result (2026-11-10, remote Linux host, 11 workers per target): no crash, OOM or timeout in any target.Target Time Executions Coverage Crash / OOM / timeout ipc_request24.0 h 5.28 × 10¹⁰ 6103 0 / 0 / 0 store_records24.0 h 7.13 × 10⁹ 640 0 / 0 / 0 access_doc24.0 h 5.54 × 10⁹ 3445 0 / 0 / 0 ipc_principal(the fixed harness)24.0 h 1.17 × 10⁹ 22489 0 / 0 / 0 The first job's exit status was 1. It came from the stopped
ipc_principalrun (libFuzzer exit 77 on the false positive above). The three other targets in that job ended withexiting: 0. - G4, security review by an independent agent, against ADR §2 and SPEC §10. It found no Blockers, 5 Majors and 11 Minors. Each Major was reproduced before it was fixed: - M1, fixed. A merge's read set and itscertifylist resolved hidden logicals without aReadcheck. Actx_what_ifmerge answeredReadSetConflictwith a hidden head, andcertifyshowed a hidden record's certification. The kernel now refuses both withUnauthorized(Read)before resolving the revision, and the oracle mirrors it. - M2, not reproduced. The read set appended forexpect_cert_validholds the session's reads only, never a hidden premise. A regression test covers it, andImpactBatchnow refuses client-written certificate read sets like every other path. - M3, fixed. APinnedorKeyRevtarget on a hidden logical answeredInvalidArgumentfor a wrong revision. It now answersUnavailable{target}whatever the revision. - M4, fixed.conflict_open{from: candidate}filled in a hidden side, and the kernel's refusal named that revision. A candidate with a hidden side now answers as missing, and sides the client sends are checked first. - M5, fixed. A TRUNCATE checkpoint blocked by a reader past the busy timeout reports success withbusy = 1, andpurged_throughwas recorded before it.purge::compactnow checksbusyand retries, and every purge recordspurged_throughonly after the WAL is truncated. - Minors: - Fixed: - m1:ctx_resolveneedsReadon every target, partners included. It is checked first, so a hidden artifact's type and state are not told apart. - m2:carry_ruleson a hidden logical gives the same answer as without it. - m3: a merge's allocations keep only visible objects. - m6: mirror front matter counts premises in unmirrored lanes (premises_withheld) instead of naming them. - m8:ctx shredlists swap, snapshots and APFS clones, freed blocks and SSD remanence. - m4 (defensive, not reproduced): a foreign handoff acceptor's verdict is computed over the vector entries it may read, as acceptor. The test moves a hidden head afterhandoff_begin, but its verdict did not change even without the fix. - m10:ImpactBatchandMerge{into}are redacted with the view of the branch they ran on. - m11a:Service::purgeretries a key-log rewrite that failed inside its commit (actor messageKeyPurge), andctx statusreads the store's own mark.Each fix has a test that fails without it.- To fix: none.
- Declared:
- m5:
NodeState.support,Check.updates_pendingand certificatewatermarkscount or name across lanes. These are the count channel of ADR §2.3 (numbers, never names), except watermark scope names for restrictedcode_lanes, which are declared here as forUnknown{lag}. - m7: the
ctx uitoken is decided at launch and needed only in multi-user mode. ASetAccessthat maps others while the UI runs needs a restart ofctx ui. The README's multi-user section says so. - m9: there is no empty ACL on create. A directory with an inheritable ACL is refused by the walk at multi-user entry and by
ctx migrate, andctx doctor --fix-modesstrips ACLs. - m11b: a
SetAccesswhose mapping fails to apply is logged to stderr only. It cannot happen whilectxdnever enables multi-user mode, and must be surfaced before it does.
- m5:
- Multi-user switch (owner decision, 2026-11-08):
ctxd --multi-usersetsOptions::multi_user, andctx service install --multi-userwrites the flag into the unit. It is off by default, and the three deployments are unchanged. - Tests:
ctxd_multi_userruns the real binary. Without the switch, a committed document naming bob maps nobody; with it, the same document enters multi-user mode. Thectxunit test checks the flag in the launchd and systemd units. - G6 still needs a second local macOS user, which the owner creates once with
sudo.
- The op: tag 21, admin only, global, batches of
Gate closure (2026-11-10)¶
At HEAD with SQLite 3.54.1 (rusqlite 0.41.0), on the remote Linux host:
- G1 passed.
scripts/check.sh: fmt, clippy-D warnings, the workspace tests (156 groups, 0 failures), the loom model, the script tests, dependency boundaries, the dd crate and the fuzz crate's type check.cargo denyruns on the local machine (the remote host has nocargo-deny). It first failed on RUSTSEC-2026-0459 (SQLite before 3.54.0), fixed by the bundled SQLite 3.54.1. - G2 passed. T17, T17b, T58–T60, the UNAVAILABLE S13 rows and T98–T108 are in that suite.
- G3 passed. At 10,000 seeds each, in release: PROP15 (
CONTEXTDB_P9_ACCESS_SEEDS,_WRITE_SEEDS,_MERGE_SEEDS), PROP16 (CONTEXTDB_P9_SHRED_SEEDS) and recall per principal (CONTEXTDB_P9_READ_SEEDS). - G4, G5, G7, G8 passed as recorded above; G5 with the owner's
narrowdeviation. - G6 skipped (owner, 2026-11-10). No run with two real macOS users. Not verified on a real system:
- the accept path from a second uid, which T98 covers in tests;
- the file-system checks against another user's permissions;
- ancestor ACL denies, which G6 was to be the authority for (§3.2, best effort).
ctxd --multi-user stays off by default, and the local deployments are not switched.