Repository navigation
refactor(webview): Compact the webview, script and test comments - #765
Conversation
b53945d to
46d7589
Compare
Rebased onto
|
| Check | Result |
|---|---|
node --test tests/*.test.js |
207 pass, 0 fail |
node pass list vs origin/main |
207 named tests, diff exits 0, identical |
cargo test --workspace |
477 + 487 + 23 + 10 + 9 pass, 0 fail |
cargo clippy --workspace --all-targets -- -D warnings |
exit 0, zero diagnostics |
pre-commit run --files <71 touched> |
every hook passes |
The pass-list diff is the one worth naming. The count moved from 203 to 207 because the base moved, so a bare count proves nothing here. Comparing sorted test names against a clean origin/main checkout is what shows no test was disarmed by a comment edit.
— Claude Code agent, on @omesser's behalf.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Architect gate — Standards + Spec @
|
46d7589 to
8f37b3e
Compare
Rebased onto
|
| Check | Result |
|---|---|
Comment-only proof vs origin/main |
71 files, 0 with a code change |
node --test tests/*.test.js |
212 pass, 0 fail |
node pass list vs a clean origin/main checkout |
212 named tests, diff exits 0, identical |
cargo test --workspace |
486 + 487 + 23 + 10 + 9 pass, 0 fail, exit 0 |
cargo clippy --workspace --all-targets -- -D warnings |
exit 0, zero diagnostics |
pre-commit run --files <71 touched> |
exit 0 |
The pass-list count moved 207 to 212 because #769 added tests. That is why the check is a diff of sorted test names against a clean origin/main checkout rather than a count.
— Claude Code agent, on @omesser's behalf.
Architect gate: the blocker is addressed at
|
| Check | Result |
|---|---|
node --test tests/*.test.js |
212 pass, 0 fail |
node pass list vs a clean origin/main checkout |
212 named tests, diff exits 0, identical |
cargo test --workspace |
486 + 487 + 23 + 10 + 9 pass, 0 fail, exit 0 |
cargo clippy --workspace --all-targets -- -D warnings |
exit 0, zero diagnostics |
pre-commit run --files <71 touched> |
exit 0 |
212, not the 207 from the previous head, because #769 added five. That is why the check is a name-by-name diff against a clean origin/main checkout and not a count.
Soft 1 — hazard 1, CSS comments and chat-ui-tokens.test.js
No added comment line in src/chat-ui.css contains a hex value:
git diff origin/main -- src/chat-ui.css | grep '^+' | grep -iE '#[0-9a-f]{3,6}' → no matches
So the single-line comment-stripping regex at tests/chat-ui-tokens.test.js:60 has nothing to false-positive on, and the test passes.
Soft 2 — hazard 2, the import-pet TOML comment asserts
Ran the self-check rather than reading the assert, since the Python path is covered by neither the node nor the cargo suite:
python3 scripts/import-pet.py --self-test → exit 0, "self-test: ok"
That exercises assert "# Mapping:" in manifest and its assert "Mapping:" not in declared["art"] pair. Both still hold. The assert moved from line 1179 to 1160 because comments above it were cut; neither it nor the code that writes those TOML comments was touched.
Soft 3 — the stale settings.js header
Gone, and I grepped the whole branch for any other surviving claim that emit is a stub. There were none.
CI is rerunning on 8f37b3e3. Ready for re-gate.
— Claude Code agent, on @omesser's behalf.
CI is green at
|
| Leg | Result |
|---|---|
build |
pass |
checks (macos-latest) |
pass |
checks (ubuntu-latest) |
pass on attempt 2 |
windows |
pass, and Rust tests reports success, not skipped |
MERGEABLE / CLEAN.
— Claude Code agent, on @omesser's behalf.
The phase-narration rule cut short standalone comments that label what a block does. In a procedural verify or bench script those carry the flow, so they come back verbatim. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Restored the one-line step labels in the verify and bench scripts
The phase-narration rule in #750 was aimed at comments that restate a step the assertion already names. Applied across procedural scripts it also took out short standalone labels that carry the flow, and those are worth keeping. 51 lines come back verbatim, at their original positions.
The line that makes the case, from # Exact popup titles after #593. pick matches AXTitle, not a substring.A reader who does not know that reaches for a substring match and the assertion fails for a reason the failure message will not explain. Same for What stays cut is the compacted multi-line prose. Re-run at
|
| Check | Result |
|---|---|
Comment-only proof vs origin/main |
71 files, 0 with a code change |
node --test tests/*.test.js |
212 pass, 0 fail |
cargo test --workspace |
486 + 487 + 23 + 10 + 9 pass, 0 fail, exit 0 |
cargo clippy --workspace --all-targets -- -D warnings |
exit 0, zero diagnostics |
pre-commit run --files <touched> |
exit 0, shfmt, shellcheck and PSScriptAnalyzer all pass |
Census moves from 13.6% to 13.9%, 1,906 comment lines against 11,843 code lines, 38 blocks still over 3 lines. Saying the real number again rather than the one that flatters the target.
One left deliberately. scripts/generate-readme-gifs.py has 9 labels of the same shape (# BMO: sing animation (signature variant, 4 frames)) that were also cut. It is a generator rather than a verify script, so it sat outside what was asked for here. Say the word and they come back too.
— Claude Code agent, on @omesser's behalf.
Architect re-gate — Standards + Spec @
|
Why
Child 6 of #744, closing #750:
src/,scripts/andtests/. Before this PR the slice sat at 20.0% comment lines, with 218 blocks longer than three lines, and most of the length was retelling: which issue changed what, what the code used to do, and restatements of the line underneath.src/main.jswas 38% comments.What changed
Every comment block in the 78 files under
src/,scripts/andtests/(vendor and fixtures excluded) was read and judged against #744's five-step procedure, by hand, one exact-match string swap per block. No regex pass, no codemod.// Cleanup function,// Hide all empty state divs first,// Turn animation names into readable text, section labels that repeat the selector or the assertion under them, and the "Run withnode --test" preambles where they were part of a rewritten header.# Capture output,# Check for expected messages,# Click Director tab (index 2)); the assertion or log string already says it.Kept longer than three lines on purpose: the four
ponytail:markers (src/main.jstwice,scripts/import-pet.py), the JSDoc oninterpolate()andbound(), the design-defining rules oncreateBubbleMachine(7 lines), the registration-and-grounding pass inimport-pet.py(6), and therow_live()matcher inverify-settings-macos.sh(9), which is the "genuinely weird implementation" case #744 exempts.Deliberately not touched: the comments
import-pet.pywrites into the generatedcharacter.tomland theassert "# Mapping:" in manifestthat pins them (hazard 2 in #750); the CSS comments inchat-ui.cssthat mention a hex colour kept their exact shape, and no rewritten CSS comment names a colour (hazard 1,tests/chat-ui-tokens.test.js:60strips comments with a single-line regex); the#!/bin/shlines inside heredocs intest_verify_overlay_stray_scope.sh; the---section banners in the Python generators.How to verify
The diff touches no code line. A check that strips comment-only lines and blank lines from both
origin/mainand this branch for every changed file and compares what is left, failing on any difference:git diff --numstat origin/main: 765 lines added, 1,785 removed, across 71 files.78ebbe6c)cargo test --workspacenode --test tests/*.test.jscargo clippy --workspace --all-targets -- -D warningspre-commit run --files <71 files>The node pass list and the cargo test list were diffed by name against the baseline, not only the exit codes; both are identical.
Census, from a throwaway counter (a comment line is a line that is wholly a comment; ratio is comments / (comments + code);
src/vendorandtests/fixturesexcluded):13.6%, not the ~10% #744 names as the tree-wide target. What remains is 1,784 lines in blocks of one to three that carry a reason, a constraint or a bound, and I did not cut those to hit a number. #750's own count (58 files, 2,032 lines) used a narrower file set; the counter here also takes in the Swift, PowerShell and CSS files in the same three directories.
Heaviest files:
src/chat.jsscripts/verify-overlay.shsrc/main.jsscripts/import-pet.pysrc/chat-ui.csssrc/main.cssscripts/verify-settings-macos.shscripts/win-smoke-588-openchat.ps1scripts/perch-window.swiftscripts/ax-settings.swiftNotes
Collisions, now resolved. #763 and #760 have landed, and this branch is rebased onto
55b6c951. All 19 conflict hunks were comment text on both sides, with no code on either, and each resolved to this PR's text: #763 cut the multi-issue narration inside blocks this PR rewrites wholesale to the #744 bar. The twelve shared files weresrc/bubble.js,src/chat-ask.js,src/chat-status.js,src/chat.js,src/cue.js,src/main.js,src/markdown.js,src/settings.js,tests/bubble.test.js,tests/cue.test.js,tests/no-undeclared-assignment.test.jsandtests/settings.test.js, plussrc/chat.htmlfrom #762. #760's code insrc/main.jsandsrc/interpolate.jsauto-merged and is kept. #758 is still open and touchestests/pre-commit-scans-everything.test.js.Closes #750
🤖 Generated with Claude Code
— Claude Code agent, on @omesser's behalf.