Repository navigation
refactor(comments): the mechanical sweep — banners, one-line JSDoc, narration - #803
Merged
Merged
Conversation
A banner is navigation, not narration — it restates no line of code — so the label stays and only its two borders go. 207 banners across 43 files, 445 lines. Machine-made by `comment-sweep.mjs --tier 1` and verified by `comment-fingerprint.mjs`: 43 of 43 files codeHash-identical, no comment displaced, every protected count unchanged. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
58 files, 412 lines — all of it the `/**`, `*/` and ` *` scaffolding around prose that was already a single line. No prose changed. Only a block whose body is exactly ONE line qualifies. Splitting on sentence punctuation instead looked equivalent and was not: a wrapped block whose first line simply ends without a full stop reads as one sentence to a regex, and joining `Admin password for seed scripts authentication` to `Minimum 8 characters` produced a run-on carrying two facts with no punctuation between them — worse than what it replaced. Any `@` tag disqualifies a block, not just `@example`. The TypeScript language service reads `@param`, `@returns` and `@deprecated` for editor hover docs, and nothing lints or tests their loss. Verified: 58 of 58 files codeHash-identical, no comment displaced, every protected count unchanged. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
17 files, 64 lines. Every deletion is a comment whose every content word the following line of code already carries — `// Write to JSON` above a writeFile, `// Run cleanup job` above the call, `// Create admin manager` above the factory. Test files hold most of them. Three guards took three attempts to get right, each added after the rule damaged something real: - **Banners are exempt.** A label repeats the identifiers in the section below it, which is exactly what this rule scores as restatement, so the first run deleted the banners the previous commit had just written. - **Trailing comments are exempt.** They carry what a literal cannot say about itself. `width: 0, // Dimension extraction disabled` and `meditationTitleMap: Map<…> // meditation title → Meditation ID` both died to the unguarded rule. - **Only an isolated comment is eligible.** A `//` run is one comment wearing several line markers. Scoring its last line alone deleted `// listing.` off a four-line rationale and left "a region manager cannot act on the". One inconsistency a reviewer should judge: in `seeds/run.ts`, `// For 'document':` goes and its sibling `// For 'start':` stays, because "start" is not a word in the field it labels. The conservative half of the rule kept it, and leaving one is the safe error. Verified: 17 of 17 files codeHash-identical, no comment displaced, protected counts unchanged. Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-803
September 16, 2026 19:18
Destroyed
|
🚅 Deployed to the SahajCloud-pr-803 environment in sahajcloud
1 service not affected by this PR
|
This was referenced Sep 17, 2026
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Sep 18, 2026
) * fix(docs): resolve the conflict block in the access rule `docs/rules/access.md` carried a raw, unresolved conflict block from #787. Markdown is the one place a marker is silent: the same lines in a `.ts` file are a syntax error both `pnpm lint` and `pnpm typecheck` reject, and in `.json`, `.mts` or `.yml` they break a parser. Here they rendered as ordinary text, and no lint covers `docs/`, so the block survived four merges. #801 and #803 each edited prose inside it without seeing it. The file is a `docs/rules/` rule, so it loads into every agent session that reads `src/plugins/access/` — both halves at once, contradicting each other. Neither half was wholly current, so the resolution is a mix. The client-grant paragraph takes the `origin/main` text: both `wemeditate-web` and `sahaj-atlas` may create `user-submissions`, create only. `config/roles.ts:95,122` grants exactly that and nothing else. The `HEAD` text named `wemeditate-web` alone and cited form submissions, a collection #801 deleted. The warning paragraph takes the `HEAD` text, which differs from its twin only in the final clause. "with no live-preview credential at all" is correct; "with no preview secret" names the shared secret #788 deleted. A legitimate draft read now carries a minted Ed25519 token, and `previewSecret.ts` says so in the file: the header name outlived the value it used to carry. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * test(docs): fail when a conflict marker lands anywhere tracked Nothing in the repo grepped for conflict markers, which is why the block in `docs/rules/access.md` survived four merges. A unit spec closes that, and runs in both places that matter: `pnpm test:unit` is the lean gate's fast lane, and `pnpm test` runs it in CI. It is a unit spec rather than a line in `.claude/skills/pr-prep/check.sh` deliberately. `.claude/` is a Claude Code Protected Path, so an unattended run cannot write there — the write is prompted rather than refused, and the session stalls until its lease expires. The scan shells to `git grep`, for scope and for cost. Tracked files are what can land on `main`, and git scans them in ~40ms where reading 76MB of tracked bytes into JS would cost more than the rest of the lane. Two traps are handled in the spec. The patterns are built by concatenation, so the file cannot match itself. And a second test greps a scratch block through the same pattern and the same command, because a pattern typo, a `git grep` that cannot see the tree, and an exit code read the wrong way all produce the same green as a clean tree does. Proven by reintroducing a marker in a tracked file and watching the lane go red. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * refactor(tests): simplify the conflict-marker guard per /simplify pass The three marker tokens are now named constants the pattern and the fixture both build from, so the second test visibly shares the definition it is there to prove. `grep` closed over the one pattern it was ever called with, its two-valued argv fragment became a `noIndex` flag, and the `maxBuffer` knob went — nothing it guarded was reachable. The temp directory the non-vacuity test writes is now removed in `onTestFinished`. Every lane run had been leaving one behind. Cut the docstring roughly in half. One claim in it was also false: reading the tracked tree into JS measures ~130ms against a 27s lane, not "more than the rest of the unit lane". A checkable number that is wrong by two orders of magnitude costs more than it buys, so the comparison is gone rather than restated. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * fix(tests): close two ways the conflict guard could go quiet Both found by an adversarial review pass and reproduced before fixing. `-I` skipped whatever git calls binary, and that includes a plain text file marked `-diff` in `.gitattributes`. A scratch repo with `*.lock -diff` and a real conflict block in `deps.lock` exited 1 with no output, so the guard went green with the block committed. Without `-I` the same tree reports `Binary file deps.lock matches`, which is a non-empty row and fails the assertion. A guard should name a media file loudly rather than miss a real block quietly, and the tree has no binary match today. The fixture also proved only the pattern, not the scan. `--no-index` bypasses index enumeration, the pathspec and `.gitattributes` — every structural way the tracked scan can come back empty — so a sparse checkout, or the `-diff` case above, left both tests green. It is now a real repository with the file really tracked, which exercises the same path the tree test takes and lets the `noIndex` branch go. `grep.column` is pinned off. A contributor who sets it globally got `sample.md:1:1:…` and failed the exact-array assertion on a clean tree. A spawn that never ran reported "exited null". It now says git may not be on PATH. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> * fix(tests): cut the guard docstring narration The header retold #787 in six lines that the ticket, the PR body and the commit already carry. What a reader cannot re-derive is the concatenation rule and the tracked-files scope, so those stay and the story goes. The #787/#810 breadcrumb stays too — docs/rules/code-comments.md keeps those whatever else is cut. Refs #810 Co-authored-by: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude <[email protected]>
This branch was successfully deployed
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.
The first comment sweep. 921 net lines gone, and not one line of code changed — proved mechanically, not by review.
Depends on claude-workflow#105, which carries the codemod that produced this diff. Merge that first.
How to review 90 files without reading 1,347 deletions
Every file's code is byte-identical after stripping comments and normalising with the repo's own Prettier. Every protected category — tool directives,
⚠markers, cross-repo sync pointers,#NNNbreadcrumbs — survives at the same count.One commit per tier, so each is separately revertable:
d23de0593cdc9c5cfd7ba1e6Read
fd7ba1e6. It is the only commit carrying judgement, it is 64 lines, and every deletion in it is listed in its commit message. The other two are structural and the verifier covers them.What this is not
This is the mechanical half. The measurement that motivated it found 56,562 comment lines across the four repos, and that the bloat is not narration — narration is ~8% of prose. The dominant bucket is real rationale written three to ten times too long, in JSDoc-shaped essays. That is tier 5, it needs a model reading each comment, and none of it is here.
So the honest number: the mechanical tiers reclaim ~920 lines in SahajCloud, not the ~10,000 first estimated. That estimate assumed a large stock of collapsible one-sentence JSDoc; the corpus is essays instead, and only tier 5 reaches them.
Deliberately no format commit
Prettier reports 15 of these files as unclean — and reports the same 15 unclean on untouched
main. The drift predates this branch, so running the formatter would import unrelated code fixes (console.log('=' .repeat(60))→'='.repeat(60), re-wrapped call arguments) into a comments-only PR and void its one guarantee. Left alone, for a separate PR if you want it.Judgement calls
seeds/run.ts:// For 'document':is deleted and its sibling// For 'start':stays, because "start" is not a word in the field it labels. The conservative half of the rule kept it. Leaving one is the safe error, but it reads oddly — say if you would rather both went.Verification
pnpm lint— clean,--max-warnings 0pnpm typecheck— cleanpnpm test:unit— 4 failures, all pre-existing. Untouchedmainfails 5 tests across the same 3 files (client-deployment-environment,event-title-cache,public-env-substitution); this branch fails 4 of that 5, the difference being a flaky cache test. None is comment-related, and none is caused by this branch.🤖 Generated with Claude Code