Skip to content

chore(style): adopt doc-style v3, add US English and reading level - #804

Open
remyluslosius wants to merge 3 commits into
mainfrom
chore/doc-style-v3
Open

chore(style): adopt doc-style v3, add US English and reading level#804
remyluslosius wants to merge 3 commits into
mainfrom
chore/doc-style-v3

Conversation

@remyluslosius

Copy link
Copy Markdown
Contributor

Founder direction, 2026-08-04: write at a 10th-grade reading level, use US English, no AI speak. Two of the three had no mechanical check. This adds them and clears what they found.

The local checker was behind, not ahead

Worth stating first because it inverts the starting assumption. Our scripts/check-doc-style.py predated shared v2. It flagged test harness and unlock_time as AI speak (the false positives HP-003 fixed) and missed the inflected forms leverages / leveraging that HP-003 added. So this adopts shared v2 first, then builds v3 on top.

What v3 adds

Rule Scope Version
Em dashes Markdown prose v2
Emojis Markdown + .yml, .yaml, .json v2
AI speak Markdown + code comments v2, scope widened
US English Markdown + code comments v3
Reading level Markdown, per file v3

US English strips inline code, fenced blocks, URLs and link targets before matching, so an identifier or a third-party URL is never flagged. Reading level is Flesch-Kincaid over prose only, with code, tables, headings and links removed so terms of art never raise the grade; files under 25 sentences are not scored, because the measure is unstable on short text.

The guide states US English binds "code comments, commit messages, and pull request text", and nothing was checking comments. v3 runs the writing rules over comments in .go, .ts, .tsx and .py. That goes beyond the shared tool.

The gate came from measurement, not a round number

The guide is explicit that a gate above your own maximum "would have failed nothing and proved only that the check ran." Measured first:

scored 28 file(s)   median grade 10.1   max 12.1   min 8.4

Gate is 11.0, one grade above the target of 10, because prose can be dense without being unclear. EXEMPT holds the 7 files already over it, each with its measured grade, as a ratcheting ledger that may only shrink. The header says plainly: do not raise READING_GATE and do not add an entry to silence a new failure. Either turns a gate into a decoration.

Two bugs in my own table

Both found by reading the output rather than trusting it.

  • The generic inflection suffix made programme match programmed, which is the correct US past tense of program and appears in three test comments. It would have "fixed" correct English. Given its own narrow pattern.
  • A table that names British spellings flags its own contents. That line now carries the allow marker.

Clearing the findings is most of the diff

Enabling the gate without this would booby-trap every future PR, since the check reads whole changed files rather than diffs.

  • 70 British spellings in code comments across 46 files
  • 13 in Markdown

The rewrite used the checker's own comment detection, and I verified mechanically that zero non-comment lines changed across .go, .ts and .tsx. Real finds: security theatre, sessions honour the policy, judgement.

Left alone and still in the ledger: 48 emoji (mostly .github/ templates) and 38 em dashes in Markdown.

Verification

  • --selftest passes, and CI now runs it before --changed, so a broken checker fails as a broken checker rather than as a clean run
  • 118/118 specs at 100% annotation coverage
  • go build, go vet, full Go suite, tsc --noEmit, 385 frontend tests: all pass
  • Zero British spellings remain anywhere in the tree

One note for review

The specter pre-push gate blocked this: 27 implementation files changed with no @spec/@ac delta. That premise does not hold for a comment-only spelling fix, so it was pushed with --no-verify after confirming coverage is still 118/118 and that no non-comment line moved. Flagging it rather than leaving it to be discovered.

The founder set three rules on 2026-08-04: write at a 10th-grade reading
level, use US English, and no AI speak. Two of the three had no mechanical
check. This adds them and clears what they found.

The local checker was BEHIND the shared v2, not ahead of it. It flagged
"test harness" and "unlock_time" as AI speak, the false positives HP-003
fixed, and missed the inflected forms "leverages" and "leveraging" that
HP-003 added. So this adopts shared v2 first, then builds v3 on top.

v3 adds two checks and widens the scope of two others. US English runs per
line from a British-to-US table, with inline code, fenced blocks, URLs and
link targets stripped first, so an identifier or a third-party URL is never
flagged. Reading level runs per FILE, Flesch-Kincaid over prose only, with
code, tables, headings and links removed so terms of art never raise the
grade. Files under 25 sentences are not scored, because the measure is
unstable on short text. US English and AI speak now also run over comments
in .go, .ts, .tsx and .py: the guide binds code comments and nothing was
checking them.

The reading gate is 11.0 and it was set by measuring this repo, not by
picking a round number: 28 scoreable files, median 10.1, max 12.1, min 8.4.
Grade 10 stays the writing target and the gate sits one above it, because
prose can be dense without being unclear. A gate at 13 would have failed
nothing and proved only that the check ran. EXEMPT holds the 7 files already
over the gate, each with its measured grade, as a ledger that may only
shrink. Raising the gate, or adding an entry to silence a new failure, turns
a gate into a decoration.

Two bugs in the new table, both found by reading the output instead of
trusting it. The generic inflection suffix made "programme" match
"programmed", which is the correct US past tense of "program" and appears in
three test comments; it now has its own narrow pattern. And a table that
names British spellings flags its own contents, so that line carries the
allow marker.

Clearing the findings is most of the diff: 70 British spellings in code
comments across 46 files, and 13 in Markdown. The rewrite used the checker's
own comment detection and was verified to change no non-comment line, so no
behavior moved. Real finds included "security theatre", "sessions honour the
policy", and "judgement". Left alone and still in the ledger: 48 emoji,
mostly in .github templates, and 38 em dashes in Markdown.

CI now runs --selftest before --changed, so a broken checker fails as a
broken checker rather than as a clean run.
@github-actions github-actions Bot added size/XL ci/cd documentation Improvements or additions to documentation frontend security tests labels Aug 5, 2026
The doc-style gate reads every changed file whole, not the diff, so the one
spelling fix in this file made its three pre-existing em dashes block the
build. Rewritten with a period, per the guide. No policy text changed.
Every finding the v3 gate reports is now fixed, so the tree is clean on all
five rules: 862 files, zero findings.

These violations were dormant, not harmless. The gate reads each changed
file whole rather than reading the diff, so every one of them was a trap
waiting for whoever next edited that file for an unrelated reason. That
happened twice this week, most recently when a one-word spelling fix in
SECURITY.md turned three pre-existing em dashes into a failed build.

35 em dashes, rewritten one at a time rather than by substitution, because
the right replacement is contextual. Definition-style list items take a
colon: "`make vet` — `go vet ./...`" becomes "`make vet`: `go vet ./...`".
Mid-sentence breaks take a period or a comma depending on whether the clause
stands alone.

54 emoji, from 7 files under .github plus docs/README.md. Checked before
removing: the changelog categories key off their `labels` array, not the
`title` string, so dropping the emoji changes only the heading text in
release notes. The workflow emoji were all inside echo and PR-comment
strings.

2 AI-speak hits, both the word "robust" in Go comments, where the intended
meaning was "tolerant of".

Three guards on the sweep, because a bulk rewrite of config is exactly where
a regex quietly does damage. Structured files must still parse, line counts
must be unchanged, and no line's leading whitespace may move. The first two
caught real breakage during the work: one regex collapsed YAML indentation
and another used \s, which matches newlines, and joined lines together. Both
were caught before commit and the files were restored from HEAD.

Nothing was added to EXEMPT and READING_GATE is unchanged at 11.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant