Repository navigation
fix(client): hold answer entries it cannot type; refuse a newer store - #209
Merged
gregpriday merged 2 commits intoNov 19, 2026
Merged
Conversation
… a newer client's store - Delivery holds an entry of an unknown kind, or an answer or decline from an unexpected source, and flags its question for a human instead of typing it; the formatter refuses such an entry rather than typing it as an answer - get_decision never reports such an entry as the person's answer, and the legacy sealing pass leaves it as it is - A store_format marker in meta: SqliteLocalStore refuses a newer schema or format before touching the file, DecisionsBridge.start() refuses before it starts anything, and the CLI reports it as a clear error - Integration spec and operations docs describe the store format contract
- A start made while another admits the store waits for that admission and returns as a second call, so the first call's transport is the one used - A hold is flagged on a fresh read under the delivery lock, so an entry a reopen or answer replaced meanwhile never holds the new round - Tests cover both, and an ASCII-digit BLOB marker
gregpriday
deleted the
bugfix/issue-186-an-older-client-types-a-newer-state
branch
November 19, 2026 14:35
Merged
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.
An older client run on a newer client's state directory could type a stored entry it does not understand as an empty human answer: 0.8.0 types 0.9.0's never-published notice (
kind: 'unpublished',source: 'system') assource: human, with nostatusand noauthorised: no. Released versions cannot change, so this makes the next new entry kind safe in two layers: the store records a data format that an older client refuses at open, and delivery never types an entry it does not understand.Resolves #186
Changes
unsupportedEntry()(answers.ts) flags an unknown kind (answer_unknown_kind), or an answer from anyone but the person or the proxy, or a decline from anyone but the person (answer_unknown_source).DeliveryEngine.thread()holds such a question's answers, and the follow-ups behind them, before any destination is looked up, and reports it once (needs-attention, audited, reported to the relay as other holds are), on a fresh read under the delivery lock so a round replaced meanwhile is never held; a retry reports it again and still types nothing. A question whose earlier write may already be on screen keeps saying so instead. The entry is kept exactly as stored.formatAnswerNoticethrows on an unsupported kind or source instead of formatting it as an answer, and delivery passes the stored source rather than mapping everything butproxytohuman.get_decisionreports no provenance for an answer from an unknown source, and counts only the person's confirmation of a proxy answer and only the person's decline. The legacy sealing pass leaves unsupported entries untouched.store-format.tsaddsSTORE_FORMAT(1), kept inmetaunderstore_format(missing means 0), andStoreFormatError. A release moves it on only when it starts storing something an older client may misread, with or without a schema step.SqliteLocalStorerefuses auser_versionpast its last migration, or a newer or unreadable format (a BLOB included), before it changes the file, and closes its handle. Both are read in one snapshot, and an up-to-date file is only read on open, so it opens beside a running listener's write. Otherwise it re-reads both underBEGIN IMMEDIATE, runs the missing steps and stamps the format in one transaction, so an older client never lowers a newer stamp. WAL is set after admission.DecisionsBridge.start()admits a host-supplied store (admitStoreFormat) before it starts anything. A start made while another admits the store is that start's second call, a stop or revocation during admission wins, andidle()waits for every admission before the host closes the store.cannot use …/decisions.db: the local store holds data format 2, and this client reads formats up to 1 … Upgrade this client to use it.before sealing or migrating anything.SqliteLocalStoredoes;docs/operations.mddescribes the refusal and says to stop running listeners before upgrading.A client already running when a newer one opens the same directory does not check again; the delivery hold covers what it reads after that.
Testing
packages/client/tests/newer-state.test.ts: an unknown kind held and reported (the reproduction failed before the change, typing the entry into the pane), reported once and again after a retry, an uncertain earlier write left uncertain, unknown answer and decline sources, later answers and follow-ups held while another question's answer is typed, sealing leaves the entry alone while sealing the rest,get_decisionprovenance, confirmation and decline, formatter refusal, every current writer's kind and source accepted;start()refusing a newer or unreadable format before sealing or recovery reads anything, stamping only an older or unmarked store, a stop during admission, andidle()waiting for it.packages/client/tests/store.test.ts: stamping new, unmarked and migrated files; opening an up-to-date file while another connection holds a write transaction; refusing a newer schema (handle closed, rows unchanged), a newer format on the current schema and on a migratable older one (not migrated), malformed and BLOB markers (left as they were), and a newer stamp written between the first read and the write lock.packages/cli/tests/cli.test.ts:statusrefuses a newer state directory with the error above, leaving the format and a plaintext legacy row untouched.cliandask-wait, 76 tests) and the impact set, 8 of 73 test files (10%), all pass on the final commit. No flaky or base-level failures. The package type check was not run here (notypecheck:changedscript); stabilization runs it.Open
DecisionLearnerwhoselearn()awaitsbridge.notifyPaneIdle()waits on the delivery lock the inbox holds while it calls the learner. The hold check now takes that lock too, but typing any answer already does (injectChunk), so such a learner already deadlocks on an ordinary answer; nothing here changes that.{ socket: false }to both calls, so it proves the shared admission, not that the first call's transport wins.docs/operations.md).