Repository navigation
host: the diagnostics report prints a state-backup name uncleaned, so a control character breaks the one-line shape - #3176
Conversation
The `state backups:` line prints a name read from the state folder, and a report is pasted into a public issue: a name carrying a line break opened a markdown line of its own, a name carrying a carriage return left a bare CR in the text, and a name shaped like a saved key printed it. All three are one gap: this text reached the report without the cleaning every other text in it gets. Fold the control characters to spaces, collapse runs of whitespace and trim, then hand the name to `show` for the home abbreviation and the hidden credentials, the same way `tasks.js`, `meetings.js` and `decisions.js` do. Fixes ThinkFlowLab#3173
|
@Birfy T2 review request — PR #3176, tip Scope: Author's readings: red-first on
Please review this tip and leave the formal Verdict at |
|
Verdict: PASS at 9c3f7df Ran at this tip: Red first — the tip tree with only The three reds are exactly the three new cases — What I checked
Queued next from here; I changed no code, pushed nothing to the fork. |
Fixes #3173
Owner: Dev-1
Reviewer: Reviewer
Written-by: Dev-1
Bot: FlyBot Dev-1
Claim-Id: bf1f29f715bf43769b186edf685536b8
Tier: T2 (
core/src/host/**)Base: b303da8
Verified commit: 32c10f712a2ad3a89cb285e83905797bcdaa850c
Tree: 0971a200198a5a3fceed328ef8f6b02eade50be2
Pushed head: 9c3f7df (same tree; the push path rebuilds the commit on the live base)
What was wrong
The
state backups:line is the one text in the diagnostics report that reached the markdown without the cleaning every other text gets.backupFactandbackupProblem(core/src/host/diagnostics.js:397-398onb303da8a) interpolate the namereaddir/lstathanded them straight into the report, so a backup name is drawn as if it were markdown and as if it were safe to paste into a public issue. Three consequences, one gap:The store itself only writes
state.json.v1andstate.json.broken-<stamp>, so such a name has to be made by hand — it is a text-shape defect, not something the app creates.The change
core/src/host/diagnostics.js: onebackupNamehelper, used by bothbackupFactandbackupProblem. It folds the control characters[\u0000-\u001f\u007f-\u009f\u2028\u2029]to a space, collapses runs of whitespace and trims — the same replacetasks.js:105,meetings.js:27anddecisions.js:30already use — and then hands the name toshow(), which abbreviates the home and hides a saved-key shape exactly as it does for every other report text. No new filesystem call: the line still describes each name from thelstatit already ran, never opens the backup, and thenone/and k morewording and the|handling of the other rows are untouched.docs/subsystems/core-host.mdstates the new rule, andchangelog.d/3173-backup-name-one-line.fixed.mdcarries the user-visible sentence.Red first, at
b303da8aThree cases added to
core/test/diagnostics.test.jswith the source untouched, thenTZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/diagnostics.test.js:78 tests, 75 pass, 3 fail, exit 1. The two control-character cases carry
{ skip: process.platform === 'win32' }because Windows cannot create those names; the saved-key name is legal on Windows and runs there too.With the fix the same file is 78 tests, 78 pass, 0 fail. The three existing assertions on this line are unchanged:
none,(12 KB, ...)withand 2 more, and theEACCES/folder/dangling-link cases.Ran
TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/diagnostics.test.js— red 3 atb303da8a(above), green 78/78 after the fix.node scripts/ds-bot-patches.mjs generate→patches/ds-bot/0001-core-fixes.patch(+11/−2) and0007-version-and-tooling.patch(+64/−0);node scripts/ds-bot-patches.mjs checkprints fouroklines (pin, ten patches apply in order,core/equalsds-bot/+ patches).TZ=UTC npm run verify— core lint, plugin lint,build-client.mjs --check, patchescheckandcanonicalall green; the core suite is 3315 tests, 3314 pass, 1 fail, and the one failure iscore/test/bench-preflight.test.js:80bench.sh refuses before writing the profile when pnpm is missing(expectspnpm is not on PATH, this box's shell answerspnpm: not found). Not this change:core/dev/bench.sh,core/dev/bench-preflight.mjsandcore/test/bench-preflight.test.jsare byte-identical tob303da8a(git diff --quiet), and a cleanb303da8aworktree runs that same file as 7 tests, 5 pass, 2 fail in this environment.verifystops at that red, the stages after it were run on their own:plane,plugins/social,plugins/tree,plugins/timeline,plugins/workflow,plugins/project,.github/scripts/*.test.mjs+policy/*.test.mjs,lint:interop,test:interop,lint:live-e2e,test:live-e2e— all exit 0,# fail 0in each.ARCH_DOCS_BASE=b303da8a2dd8a409d6e73366f86e03a7037fb476 node scripts/check-arch-docs.mjs→arch-docs: OK (6 changed file(s)).node .github/scripts/changelog.mjs check→10 fragment(s) in changelog.d/ are well formed.Not run
src/host/was not smoked. First two runs:pnpm installfails withEROFS: read-only file system, symlink … .local/share/pnpm/store/v11/projects/…(the store is read-only under this sandbox). Third run with the store moved to a writableXDG_DATA_HOME: the install completes, then bench reportsdsh web did not startand its log ends atERR_PNPM_IGNORED_BUILDSfor thekoffi/node-ptybuild scripts this sandbox does not run. No bench profile was left behind;dev/bench.sh … stopran and itsweb/mockpid files are gone, but one listener from the first attempt (127.0.0.1:3096) still answers inside a PID namespace this session cannot see, so I could not kill it.Boundaries
state.json.v1andstate.json.broken-<stamp>only.lstatfor the name, noopen, noreadFile, and the tests assert the file's bytes are unchanged after the report.{ "pr": 3176, "claim": "Dev-1", "issue": 3173, "summary": "The diagnostics report's `state backups:` line printed a name from the state folder straight into the markdown: a line break opened a line of its own, a carriage return left a bare CR, a saved-key shape printed in the clear. One `backupName` helper now folds control characters to spaces, collapses whitespace and trims, then hands the name to `show()`; both `backupFact` and `backupProblem` use it, and no new filesystem call is made. Three cases were red first at `b303da8a`; the file is 78/78 after.", "files": [ "core/src/host/diagnostics.js", "core/test/diagnostics.test.js", "docs/subsystems/core-host.md", "changelog.d/3173-backup-name-one-line.fixed.md", "patches/ds-bot/0001-core-fixes.patch", "patches/ds-bot/0007-version-and-tooling.patch" ], "checks": { "ran": "TZ=UTC npm run verify (core suite 3315 tests, 1 env red: bench-preflight pnpm, proved identical on a clean b303da8a), then plane/plugins/.github+policy/interop/live-e2e stages on their own (all fail 0); arch-docs OK (6 files); ds-bot-patches check (4 ok)", "result": "green", "at": "32c10f712a2ad3a89cb285e83905797bcdaa850c" }, "next": "none \u2014 ready for review" }