Repository navigation
fix(backup): escape terminal controls in Git backup reports - #181586
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR sanitizes Git backup terminal reports and shared outcome warnings while preserving JSON, returned results, and recorded diagnostics. Example: Run backup git init with a repository path containing café, an ANSI color sequence, and a newline before operator-forged.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main terminal-rendering defect with a focused change; no actionable findings remain, and aggregate CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Provenance
Agent review detailsHow this fits togetherBackup CLI handlers receive paths, Git metadata, restore results, and diagnostics from backup owners, then produce terminal reports or raw JSON and record outcomes through the shared ledger owner. flowchart TD
A[Backup CLI] --> B[Git backup commands]
B --> C[Git snapshot owner]
C --> B
B --> D[Terminal sanitizer]
D --> E[Terminal reports]
B --> F[Raw JSON results]
B --> G[Shared outcome recorder]
G --> D
Technical reviewBest possible solution: Keep the existing backup owners and sanitize only human-readable fields with the canonical terminal sanitizer. Do we have a high-confidence way to reproduce the issue? Current-main interpolation establishes the failure path, and contributor CLI traces demonstrate it with real Git repositories; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch fixes the terminal boundary directly, reuses the existing sanitizer, preserves raw data contracts, and adds no competing owner or unnecessary abstraction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 48c67ebf96bb. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +16, Tests +54, Docs +2, Other -1. Total +71 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 24, 2026, 8:47 PM ET / October 25, 2026, 00:47 UTC (Revision 3). |
|
@clawsweeper re-review The three reported P2 findings are addressed in head
Production code is unchanged from the initial reviewed head. The Evidence section contains the refreshed normal-built CLI proof on this exact head, Git/JSON readback, focused tests and validation results. All three previously failing validation jobs and lint have passed on this head. General PostgreSQL conformance jobs are still running, so the aggregate CI gate is not yet reported as green. Separately, the auto-response workflow fails in the upstream |
|
🦞👀 Re-review progress:
|
Escape Git backup report fields and shared ledger-failure warnings with the canonical terminal sanitizer. Preserve raw JSON, stored diagnostics, and report separators, with focused command and persistence regressions. Co-authored-by: Alix-007 <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
|
Thanks @steipete for reviewing and merging this! I appreciate the careful follow-up on the terminal-output fix. |
…#181586) Sanitize Git backup paths, subjects, metadata, and warnings at terminal output, including the shared best-effort ledger warning. Preserve raw JSON, credential-redacted persisted diagnostics, and backup operations. Co-authored-by: Alix-007 <[email protected]>
What Problem This Solves
Fixes Git backup reports that emit terminal controls from repository paths, commit subjects, restore metadata, or diagnostics.
User Impact
Human-readable reports preserve printable Unicode and deliberate tab/newline separators while escaping control-bearing fields. Git operations, JSON values, returned results, and recorded diagnostics remain unchanged.
Why This Change Was Made
Apply the canonical
sanitizeTerminalTextat each terminal report boundary. The shared backup-outcome helper also sanitizes its ledger-failure warning once, covering the same path for Git and archive backups. The snapshot mock now preserves real exports; the owning generator removes its obsolete baseline exemption.Thanks @Alix-007 for the fix, regression tests, and original real-CLI proof.
Evidence
git diff --checkpass. The focused snapshot diagnostic/persistence test passes (1/1), all archive tests pass (3/3), and the existing corrupt-SQLite outcome-warning test passes (1/1). Independent Codex review through P2 is scoped-clean. After integrating current main, all 22 command/archive tests pass (255.26s runner duration), the snapshot diagnostic/persistence test passes (1/1), and the corrupt-SQLite outcome-warning test passes (1/1). Integrated typed lint, formatting, diff checks, and the generated mock-export baseline check pass.backup git init/log, Git repository/commit readback, and raw JSON: controls changed from 1 to 0 for init, empty history, and populated history. No remote push, restore, or production data was used. That evidence predates the current integration; it is not an exact-head live claim. The nearby ledger-warning path is covered by the command regression rather than a standalone CLI replay.Prior contributor CLI traces (original base and contributor head)
Temporary fixture roots are replaced with
$FIXTURE; host IPs and incidental toolchain paths are redacted. JSON escaping makes terminal-control bytes inspectable without executing them.{ "phase": "red", "head": "7a1d72c44102a24843c602c6559aa72fec3f49a5", "time": "2026-10-23T10:54:52.478Z", "runs": [ { "label": "init", "args": [ "backup", "git", "init", "--repository", "$FIXTURE/café\^[[31m\noperator-forged" ], "code": 0, "stdout": "Git backup repository ready: $FIXTURE/café\^[[31m\noperator-forged\n", "stderr": "" }, { "label": "log", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged" ], "code": 0, "stdout": "No Git backup commits in $FIXTURE/café\^[[31m\noperator-forged.\n", "stderr": "" }, { "label": "json-control", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged", "--json" ], "code": 0, "stdout": "{\n \"repositoryPath\": \"$FIXTURE/café\\^[[31m\\noperator-forged\",\n \"entries\": []\n}\n", "stderr": "" }, { "label": "populated-log", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged" ], "code": 0, "stdout": "7c4f292d49254fd7afb7a34c0fb79106e53083fd\t2026-10-23T10:55:01+00:00\tcafé\^[[31m operator-forged\n", "stderr": "" }, { "label": "populated-json-control", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged", "--json" ], "code": 0, "stdout": "{\n \"repositoryPath\": \"$FIXTURE/café\\^[[31m\\noperator-forged\",\n \"entries\": [\n {\n \"commit\": \"7c4f292d49254fd7afb7a34c0fb79106e53083fd\",\n \"date\": \"2026-10-23T10:55:01+00:00\",\n \"message\": \"café\\^[[31m operator-forged\"\n }\n ]\n}\n", "stderr": "" } ], "observations": [ { "label": "init", "controls": 1, "escapedNewline": false, "unicode": true }, { "label": "log", "controls": 1, "escapedNewline": false, "unicode": true }, { "label": "populated-log", "controls": 1, "jsonRetainsOriginalCommitSubject": true }, { "actualGitRepositoryReadback": true, "rawRepositoryPreservedInJson": true, "remotePushRestoreAndProductionData": "not used" } ] }{ "phase": "green", "head": "776488f32b14856357c4bc2aec2a7aefeb232833", "time": "2026-10-23T15:23:38.771Z", "runs": [ { "label": "init", "args": [ "backup", "git", "init", "--repository", "$FIXTURE/café\^[[31m\noperator-forged" ], "code": 0, "stdout": "Git backup repository ready: $FIXTURE/café\\noperator-forged\n", "stderr": "" }, { "label": "log", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged" ], "code": 0, "stdout": "No Git backup commits in $FIXTURE/café\\noperator-forged.\n", "stderr": "" }, { "label": "json-control", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged", "--json" ], "code": 0, "stdout": "{\n \"repositoryPath\": \"$FIXTURE/café\\^[[31m\\noperator-forged\",\n \"entries\": []\n}\n", "stderr": "" }, { "label": "populated-log", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged" ], "code": 0, "stdout": "4083c36c585ff3470eb21ed8c3d5ba71d7e601d1\t2026-10-23T15:23:45+00:00\tcafé operator-forged\n", "stderr": "" }, { "label": "populated-json-control", "args": [ "backup", "git", "log", "--repository", "$FIXTURE/café\^[[31m\noperator-forged", "--json" ], "code": 0, "stdout": "{\n \"repositoryPath\": \"$FIXTURE/café\\^[[31m\\noperator-forged\",\n \"entries\": [\n {\n \"commit\": \"4083c36c585ff3470eb21ed8c3d5ba71d7e601d1\",\n \"date\": \"2026-10-23T15:23:45+00:00\",\n \"message\": \"café\\^[[31m operator-forged\"\n }\n ]\n}\n", "stderr": "" } ], "observations": [ { "label": "init", "controls": 0, "escapedNewline": true, "unicode": true }, { "label": "log", "controls": 0, "escapedNewline": true, "unicode": true }, { "label": "populated-log", "controls": 0, "jsonRetainsOriginalCommitSubject": true }, { "actualGitRepositoryReadback": true, "rawRepositoryPreservedInJson": true, "remotePushRestoreAndProductionData": "not used" } ] }