Repository navigation
fix(backup): preserve text after embedded NUL characters - #138327
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The driver-boundary fix is the right shape: escaping TEXT inside SQLite before node:sqlite converts it avoids trying to reconstruct bytes after the lossy boundary. Keeping row ordering on the original source columns is important as well, otherwise escaping could preserve text while still perturbing digest order. I’d keep the ANY/dynamic-typing NUL case as permanent coverage, since SQLite affinity means declared TEXT columns are not the only place this can surface. The shared create/verify serializer makes this a coherent repair.
|
Exact-head preparation is complete at
Commands: pnpm build
pnpm build qaRuntime
node scripts/run-vitest.mjs src/snapshot/git-backup-codec.test.ts src/snapshot/git-backup.test.ts src/commands/backup-git.test.ts
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/snapshot/git-backup-codec.test.ts src/snapshot/git-backup-codec.tsThe first build belongs to the pinned main baseline; the runtime build belongs to the exact candidate. CLI and focused regression runs used the supported Node 22.23.2 runtime in an isolated secretless Linux container. The repair stays in the serializer, removes direct lossy TEXT reads, and adds nine production lines. The backup format, redaction policy, schema, stored keys, and scope are unchanged. Existing damaged artifacts still need replacement from intact source data. Latest ClawSweeper disposition: exact-head review started; no findings or rank-up moves have been published. The independent exact-head review and required CI are green. The contributor review's request to retain the |
|
Thanks @ced-cm for the report! Landed in a036c70ee75d. #138306 is closed. Proof: Real backup CLI create, verify, restore, and fresh-process plugin-state readback passed on Node 22.23.2 for ordinary, NUL-colliding, Unicode, and single-key inputs. Unchanged repeats produced no new commit.
The regression failed before the fix. All 34 focused tests, fresh exact-head independent review, and required CI passed. Reporter credit and Ayaan co-author attribution are retained in the merge commit. |
…9-prep * commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits) perf(ui): coalesce automation event refreshes (#138065) fix: reject incomplete Skill Workshop directory reads (#138082) test(ui): decouple rendering checks from generated wording (#138283) perf: avoid temporary entries in bounded JSON traversal (#138017) fix(irc): render complete messages before splitting (#138328) perf: prepare worker trajectory payloads only for recorded events (#138086) fix(mcp): paginated listings no longer time out after a forward clock step (#137206) fix(codex): page native transcripts and bound UI previews (#136282) feat(gateway): apply more settings without restarting (#138112) fix(docs): preserve mirrored ClawHub maturity links (#138241) fix(test): own UI animation and legacy database setup (#138296) fix(tts): preserve literal directives in Markdown code (#138319) fix: load chat widgets behind authenticated gateways (#138074) chore(ui): cover native approval finalization (#137259) fix(cron): cancel conditions before main-session handoff (#138313) fix(backup): preserve text after embedded NUL characters (#138327) fix(android): align composer control sheets (#137442) fix(ci): wait for replacement PR runs instead of stale failures (#138307) fix(sessions): keep Gateway responsive with long transcripts (#138094) fix(computer): map window inputs to delivered image coordinates (#138271) ... # Conflicts: # scripts/release-check.ts # test/release-check.test.ts
…8327) Preserve complete SQLite TEXT in Git backups on supported Node versions. Escape TEXT before native reads, decode before redaction, and keep ordering on source columns. The existing JSONL format and restore path stay unchanged. Reported by @ced-cm in openclaw#138306. Fixes openclaw#138306. Verified real backup create, verify, restore, fresh-process SDK readback, and unchanged-create behavior on Node 22.23.2. Focused regression coverage includes NUL and Unicode keys, source ordering, and all SQLite storage classes. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #138306. Reported by @ced-cm. Related: #134213.
What Problem This Solves
Git backups on Node 22.23.2 could silently lose text after an embedded NUL character. Distinct keys could collapse, and verification could miss a truncated single key.
Why This Change Was Made
The shared backup serializer escapes database text before the native driver reads it, then decodes it before redaction and serialization. Row order and the existing backup format stay unchanged.
User Impact
New backups preserve complete text, including Unicode and embedded NUL characters. Recreate damaged backups from an intact source database; missing bytes cannot be recovered from old backups. No migration or new setting is required.
Evidence
Real
backup git create,verify, andrestorecommands reproduced truncation before the fix and restored complete keys afterward. Tests covered ordinary, distinct NUL-containing, Unicode, and single-key cases, plus unchanged backups. All 34 focused codec, backup, and command tests passed.AI-assisted.