Skip to content

refactor: ban code comments; move their decisions to ADRs - #67

Merged
rcnsh merged 19 commits into
mainfrom
chore/comment-purge
Nov 21, 2026
Merged

rcnsh merged 19 commits into
mainfrom
chore/comment-purge

Conversation

@rcnsh

@rcnsh rcnsh commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Deletes 1,930 code comments, moves the decisions they recorded into docs/adr/, and bans new comments with a ratchet.

What changed

  • Comments deleted. 1,489 comment blocks were sorted into 893 decisions, 565 tautologies, 18 stale comments and 13 excuses, then all deleted. A check that strips comments and whitespace from each changed file, before and after, finds no other difference outside these intentional edits:
    • the two generator templates (scripts/generate-{world,brand-marks}.ts), so they stop writing comments back;
    • two biome-ignore reasons that used to say "see above".
  • Decisions are ADRs. docs/adr/ holds 222 ADRs with an index in its README. Every one of the 893 decision records maps to exactly one ADR.
  • Hacks the comments excused are issues. There are 12, refactor(files): size the usage skeleton's legend from the data, not a hardcoded 8 #55–refactor(blog): share post body styles between the post page and the editor preview #66, labelled excuse.
  • Comment ratchet. npm run lint now runs scripts/comments.ts check first. comments-baseline.json holds a fingerprint of each comment still allowed: any other comment fails, including an edited one. A deleted comment also fails until npm run lint:comments:update drops its fingerprint, and that command never adds one.
    • What it reads: TS/TSX/JS through the TypeScript AST, GLSL inside shader strings, .astro through @astrojs/compiler's AST (pinned at 2.13.1), plus CSS, YAML, SQL, JSONC and # files.
    • Tool directives are skipped.
    • When the scanner can't place parsed text in the source, the lint fails rather than letting comments through.
  • 119 comments remain allowed:
    • migrations/0002 (left alone deliberately: an empty applied migration isn't proven safe on a fresh database);
    • the GLSL comments in src/lib/lattice/shader.ts and src/lib/lattice-wipe.ts;
    • public/_redirects, .gitignore, .dev.vars.example.
  • /delete-comment skill in .claude/skills/. .gitignore now tracks .claude/skills/ only.
  • CLAUDE.md. The comment convention is updated, along with a stale recent:v3 example (the key is recent:v4).

Checks

Proof: npm run lint, npm test (475 pass, including the scanner's own tests), npx astro check (0 errors) and a full npm run build (csp-union and verify-headers) all pass locally on the rebased head. /code-review ran repeatedly on the scanner until only a nit was left.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
website fd52a40 Nov 21 2026, 11:22 AM

rcnsh added 16 commits November 21, 2026 18:40
Self-closing scripts, regex literals and comments in template expressions,
frontmatter fences inside strings or after a BOM, and a corrupt baseline no
longer let comments through or wipe the baseline.
Hand-rolled brace, quote and fence tracking kept missing comments next to
template literals, regexes, JSX text and URLs. The compiler's parse gives
the frontmatter, HTML comments, expressions, attributes and script/style
bodies directly.
The comment scanner now reads every attribute kind the Astro compiler
reports, stops lint when it cannot place parsed text in the source, and
catches an unclosed HTML comment. @astrojs/compiler is pinned, since Astro
7's own binding has no parse API.
A raw-source search flagged '<!--' inside strings and threw on an unclosed
comment followed by markup.
Empty, abruptly closed, --!> and bogus (<!x>, <?x>) comments no longer
throw or lose their closer, and text inside textarea or title is not read
as a comment.
…nd tags

Comment placement scans forward to the first '<' an opener matches, so a
doctype or a '<!' in an attribute no longer stops it. An unclosed comment
runs to the end of the file through any expressions after it, and title
inside svg or math is not raw text.
…ment

Quoted attribute text such as title="<!--" could otherwise be taken for
the comment that follows the element.
…exing tags

Hand-scanning start tags misread unquoted values with quotes or braces and
comments inside expressions, then ran the cursor to the end of the file.
@rcnsh
rcnsh merged commit d340d91 into main Nov 21, 2026
3 checks passed
@rcnsh
rcnsh deleted the chore/comment-purge branch November 21, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant