refactor(native-chat): remove the records-file and per-chat journal imports (#26038)

* refactor(native-chat): remove the records-file and per-chat journal imports

Every native chat user is on a build that already moved chat records and
history into the app-wide database, so the one-time copies are dead code:
the agent-sessions.json import and its owed-copy flag, the per-chat
journal.db import and the write-queue hold behind it, and the pre-SQLite
log.jsonl notice.

* refactor(native-chat): remove what only the deleted imports used

- JournalHostDatabase.unsyncedTransaction and the synchronous-pragma reset
  that undid it; JOURNAL_SYNCHRONOUS is now module-local. The stranded
  rollback test drives transaction() instead.
- deleteUnpublishedJournalRows and its SQL, plus its test.
- boundJournalStatusText.
- Stale comments naming the removed first-use copy (queued messages,
  send refusal example, JOURNAL_SYNCHRONOUS doc).
- Write-queue and readInOrder comments: a write also lags when issued
  behind one still waiting in line.
- Resolved-append ordering test binds the sink from inside a running read,
  so a resolver that read at handover now fails it.

* test(native-chat): run resolved-append in the SQLite runtime project
This commit is contained in:
Brennan Benson
2026-10-06 23:03:32 -07:00
committed by GitHub
parent 6bc529176b
commit acea59c6d8
81 changed files with 254 additions and 5355 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
// The only place a new fence number is chosen.
//
// Normally that is just "one past the current fence". For a record the one-time import took from
// the records file's backup, or found beside a set-aside copy, it is not: the commit that never
// landed may already have granted a fence the copy cannot show, and `isAgentSessionFenceCurrent`
// compares with STRICT EQUALITY, so minting that exact number would hand a second writer a lease
// the first one still believes it holds.
// Normally that is just "one past the current fence". For a record an earlier build's one-time
// import took from its records file's backup, or found beside a set-aside copy, it is not: the
// commit that never landed may already have granted a fence the copy cannot show, and
// `isAgentSessionFenceCurrent` compares with STRICT EQUALITY, so minting that exact number would
// hand a second writer a lease the first one still believes it holds.
//
// Recovery records the floor instead of rewriting the current fence, because `live` means a handle
// proven at exactly the current fence — moving it would invalidate the very records recovery exists
+5 -4
View File
@@ -119,10 +119,11 @@ export type AgentSessionLease = {
/** True from load until the host adjudicates it; no writer is granted while set. */
unreconciled: boolean
/**
* Lowest fence a future grant may use. Set only when the records file's copy came from its backup,
* or sat beside a set-aside copy of the same chat: either may hide a fence already granted. The
* CURRENT fence is deliberately left alone: `live` means a handle proven at exactly that number,
* so rewriting it would invalidate the record it is trying to save.
* Lowest fence a future grant may use. Set only by an earlier build's import of its records file,
* when the copy came from its backup or sat beside a set-aside copy of the same chat: either may
* hide a fence already granted. The CURRENT fence is deliberately left alone: `live` means a
* handle proven at exactly that number, so rewriting it would invalidate the record it is trying
* to save.
*/
minimumNextFence?: number
/** Null on a released lease when nothing proved its owner gone. */