Repository navigation
refactor(#1473): one definition each for ensureDir, escapeRegex, formatTimestamp, truncateToWidth, parseIssueNumber - #1558
Merged
admarble merged 7 commits intoOct 19, 2026
Conversation
…atTimestamp, truncateToWidth, parseIssueNumber Entire-Checkpoint: 2d6e7bb8ee2e
…dary rule Entire-Checkpoint: bb4d8416bf1f
…-lib-one-definition-each-for-ensuredir-esc
…nline copy QA found) Entire-Checkpoint: d8c7c1593365
…-lib-one-definition-each-for-ensuredir-esc
…usedExports 341 Entire-Checkpoint: c9c2e1a2383e
…xports 341 Entire-Checkpoint: e59f36ea3994
This was referenced Oct 19, 2026
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.
Summary
Branch
feature/1473-refactor-lib-one-definition-each-for-ensuredir-escis pushed with two commits. I opened no PR, because the orchestrator opens it (#1247).Fixed this session: the first commit missed part of AC-4.
src/lib/cli-ui/truncate.tshad notruncateAtWord, and the assess renderer had been switched to the TUI's hard-cuttruncateToWidth, which would have changed its output. I moved the renderer's word-boundary function there unchanged astruncateAtWord, pointed the renderer at it, and added two tests. This is commit258bfce63.AC verification
1definition andparseIssueshows0ensureDirtests inassessment.test.tsandwriter.test.tspassformat.test.tspassestruncate.jsimporters found (2),truncateAtWordexported (1 intruncate.ts), no SKILL.md or snapshot files in the diff, renderer and skill-example tests passcli-flags.test.tspasses;locksstill sets exit 1 andworktreeexit 2noneAC-4's evidence command names
src/ui/tui/truncate.test.ts, but the first commit moved that file tosrc/lib/cli-ui/truncate.test.ts. I ran the moved file instead.Checks
npm run buildandnpm run lintpass.driver-conformance.test.ts(codex: "git add and git commit succeed inside the driver's default sandbox").scripts/settle-against-base.shshows it failing atorigin/mainas well, and it is already tracked as test(drivers): codex conformance commit item fails locally on macOS — git add exits 128 inside the sandbox #1480.Mutation-verified: AC-2 — wrapped both
ensureDircalls inassessment.tsin a swallowingtry { … } catch {}(the pre-#1473 behaviour); src/lib/upstream/tests/assessment.test.ts > ensureDir > a write error rejects with the mkdir diagnostic failed; restored.Mutation-verified: AC-5 — deleted the null branch of
parseIssueNumber; src/lib/cli-flags.test.ts > parseIssueNumber > non-numeric input returns null failed (andzero returns null); restored.Pre-PR Confidence Check
truncateAtWordis also covered only by two new tests plus the existing renderer and skill-example tests.CHANGELOG: N/A (internal refactor). PR status: left to the orchestrator.
Next: open the PR and run the QA phase.
Fixes #1473
Runner verification (2026-10-19)
After a final merge of main (23a60b3), the runner re-ran every AC at 56bacd2:
1 1 1 1 1/02 1 0keptnoneThe baseline now records
emptyCatch.total117 andunusedExports341. CItestpassed.First pass:
The runner re-ran AC-1..AC-6 verbatim in the worktree after merging main (with #1503's stricter lint):
1 1 1 1 1/02and1; the renderer, skill-examples and TUI truncate tests: 51 passed; snapshot/SKILL.md diff0keptnonenpm run lintgreen; build exit 0.The runner also ran both mutations above.
Added by the runner, from QA's findings:
locks check-batchused a third inline copy of the issue-number parse; it now callsparseIssueNumber. Smoke test through the built CLI:abcand0exit 2 with "Invalid issue number", and1471 --jsonexits 0.[Unreleased]CHANGELOG entry.emptyCatch.total118 (down from 119) andunusedExports341 (down from 342).lint:healthreported no rise first.Settled against base:
driver-conformance.test.ts > commit: git add and git commit succeed inside the driver's default sandboxalso fails onmainat ace33fc in this checkout (1 failed, 33 passed; macOS only). That failure is #1480, and CI on Linux passes it.D-3 amended by the owner (2026-10-19): two exports,
truncateToWidth(hard cut) andtruncateAtWord(the renderer's rule, unchanged), so the output pinned by frozen SKILL.md does not move.🤖 Generated with Claude Code