Skip to content

ci/spelling: Add spelling PR check - #1853

Merged
marcleblanc2 merged 12 commits into
mainfrom
add-cspell-pr-check
Sep 11, 2026
Merged

ci/spelling: Add spelling PR check#1853
marcleblanc2 merged 12 commits into
mainfrom
add-cspell-pr-check

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Linear FE-499: Fix doc site issues

Summary

  • Install CSpell 10 in CI only (not a project dependency); npx cspell@10 --no-progress --dot '**/*' runs the full-repository check locally
  • Add a custom dictionary file to allowlist needed words
  • On pull requests, report only spelling errors on lines added by the PR, so existing repository findings are ignored
  • Create / update one PR summary comment containing grouped file, line, column, word, and context details, plus an inline review comment per flagged line with a one-click GitHub suggestion for the best candidate
  • Every comment links to cspell-allow-list.txt on the PR branch, to allowlist false positives
  • Resolve the comment after fixes
  • Initially roll out the PR check as non-blocking, while preserving the local command's failing exit code

Verification

  • Simulated an added typo: the diff checker exited 1 and reported exactly that word, line, column, and context
  • Reverted the typo: the diff checker exited 0 despite pre-existing repository findings
  • Prettier checks passed for the script, package/config, and workflow
  • Workflow YAML parsed successfully and every shell run block passed bash -n
  • node --check dev/check-spelling.mjs
  • git diff --check

Exclusions

  • CSpell honors .gitignore, so dependency, cache, and build output remain excluded
  • The full local check additionally skips:
    • Binary image/font formats
    • pnpm-lock.yaml
    • CSpell's own config/dictionary
    • Checked-in generated outputs (docs/technical-changelog.mdx, generated observability alert/dashboard references, and the generated AWS icon module)

Screenshots

From demo PRs #1892 and #1893:

Summary comment

CSpell summary comment

Inline review comment

CSpell inline review comment

Amp threads

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Sep 11, 2026 1:54am UTC

Request Review

@marcleblanc2 marcleblanc2 changed the title ci: add advisory CSpell check ci: Add spelling PR check Sep 8, 2026
@marcleblanc2
marcleblanc2 marked this pull request as draft September 9, 2026 00:24
@marcleblanc2 marcleblanc2 changed the title ci: Add spelling PR check ci/spelling: Add spelling PR check Sep 9, 2026
marcleblanc2 added a commit that referenced this pull request Sep 9, 2026
Moved from #1853 so that PR stays scoped to the CSpell check.
marcleblanc2 added a commit that referenced this pull request Sep 9, 2026
Fake commit hash, tmp filename, pod name, TLS cert blobs, ARN, and
base64 IDs in examples, replaced with placeholders that look realistic
and pass the spell check. Moved from #1853.
@marcleblanc2
marcleblanc2 marked this pull request as ready for review September 9, 2026 10:33
@marcleblanc2
marcleblanc2 enabled auto-merge (squash) September 11, 2026 01:46
marcleblanc2 and others added 4 commits September 10, 2026 19:51
Remove the 126 misspelled words from cspell-project-words.txt: the 112
words already listed in flagWords, plus 14 more found while reviewing the
dictionary (addresseses, Changs, certains, condeintel, ERRROS, gorelaser,
lobal, Redict, settingscasacde, sguqery, Sourcegraphs, Stablechore,
theyre, Wofli). The words that still appear in non-generated docs are
fixed in #1855 and #1873; the rest only occur in generated files that
cspell.json already ignores.

Keep eror, functio, and stabili in the dictionary and stop flagging them:
eror is Sourcegraph's log level token (lvl=eror), and functio and stabili
are truncation artifacts in verbatim command output, not misspellings.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a07e67-73b3-779f-8880-7ba770fe7ade
check-spelling.mjs gains --format json (with cspell suggestions) and loses
the markdown formatter. post-spelling-review.mjs owns all GitHub posting:
the existing summary comment, plus one COMMENT review per run with an
inline comment on each newly flagged line. Comments for findings that are
still present are kept; stale ones are deleted. Capped at 25 inline per run.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0837b-04dc-7559-831d-ba3b35c75489
Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2 and others added 8 commits September 10, 2026 19:51
check-spelling.mjs emits the full source line. Each inline comment carries a
suggestion block per cspell candidate (up to 3), with candidates matching the
flagged word's initial capitalization listed first.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0837b-04dc-7559-831d-ba3b35c75489
Co-authored-by: Amp <amp@ampcode.com>
Keep this PR to the CSpell check and dictionary. The LINTER_ERRROS,
gorelaserConfig, sguqery, lobal, and imedout fixes now live in #1873.
…elog TODO

The docs/ example placeholder swaps now live in #1873 so this PR is
only the CSpell check and dictionary. cspell.json gains a TODO to drop
the technical-changelog ignore once PR 1888 merges.
@marcleblanc2
marcleblanc2 merged commit c89ef41 into main Sep 11, 2026
4 checks passed
@marcleblanc2
marcleblanc2 deleted the add-cspell-pr-check branch September 11, 2026 01:54
marcleblanc2 added a commit that referenced this pull request Sep 11, 2026
Moved from #1853 so that PR stays scoped to the CSpell check.
marcleblanc2 added a commit that referenced this pull request Sep 11, 2026
Fake commit hash, tmp filename, pod name, TLS cert blobs, ARN, and
base64 IDs in examples, replaced with placeholders that look realistic
and pass the spell check. Moved from #1853.
marcleblanc2 added a commit that referenced this pull request Sep 11, 2026
#1873)

Linear [FE-499: Fix doc site
issues](https://linear.app/sourcegraph/issue/FE-499/fix-doc-site-issues)

## Summary

Follow-up to #1855. While reviewing the ~1100-word dictionary in #1853
for misspellings, these five were the only ones still present in
non-generated docs:

- `$LINTER_ERRROS` → `$LINTER_ERRORS` in the batch spec templating
example (the step's `env` defines `LINTER_ERRORS`, so the example was
referencing an unset variable)
- `gorelaserConfig` → `goreleaserConfig`
- ````sguqery` → ````sgquery` code fence language (2 occurrences)
- `lobal` → `Global` in an image alt text
- `imedout` → `timedout` in the `src search -get-curl` GraphQL example
(moved here from #1853)

All other misspellings in the dictionary were either already fixed by
#1855 or appear only in generated files that CSpell ignores
(`docs/technical-changelog.mdx`, observability alerts/dashboards).

Also moved from #1853: seven example placeholders that CSpell flagged as
gibberish (a fake commit hash, tmp filename, pod name, TLS cert blobs,
an ARN, and base64 IDs), replaced with realistic-looking placeholders
that pass the check.

#1853 will drop these words from `cspell-allow-list.txt`.

## Verification

- `git diff --check`
- `rg` for each fixed word returns no hits outside generated files

## Amp threads

- [Clean cspell
dictionary](https://ampcode.com/threads/T-01a07e67-73b3-779f-8880-7ba770fe7ade)

---------

Co-authored-by: Amp <amp@ampcode.com>
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.

2 participants