Skip to content

Add an optional en-GB-oxendict spelling gate (default on)#55

Open
leynos wants to merge 1 commit into
mainfrom
add-en-gb-oxendict-gate
Open

Add an optional en-GB-oxendict spelling gate (default on)#55
leynos wants to merge 1 commit into
mainfrom
add-en-gb-oxendict-gate

Conversation

@leynos

@leynos leynos commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Adds an en-GB-oxendict (Oxford "-ize") spelling gate to generated repositories as a new boolean copier option, en_gb_oxendict, default enabled.

Provenance

  • Mechanism: the two-layer design stilyagi introduced in leynos/stilyagi@ee77d08 — a generated typos.toml (the en-gb locale corrects American spellings; a generated extend-words table restores Oxford -ize forms) with scripts/generate_typos_config.py as the single source of truth, typos pinned by a Makefile TYPOS_VERSION variable (1.48.0, current latest) and run through uv tool run typos@$(TYPOS_VERSION).
  • Includes the stilyagi issue Bump leynos/shared-actions/.github/workflows/dependabot-automerge.yml from 1990e9a6aaa73f0929e04dbc7da12326005606bf to d28e04c9ea359650a85d697d1ab3d0be0b5674e7 #57 fix, following leynos/netsuke's generator and parse tests (branch enforce-oxendict-spelling, PR netsuke#407) as the base. The generated repository has no Python test runner, so the netsuke parse tests' intent is carried by a --check mode on the generator itself: it tomllib-parses the rendered document (failing fast on duplicate extend-words keys), asserts the exact entry count (len(EXTRA_ACCEPTED_WORDS) + 2*len(STEMS)*len(SUFFIX_PAIRS) = 1766), and unified-diffs the committed typos.toml against the generator output, exiting non-zero on any mismatch.

Toggle semantics

When en_gb_oxendict is true (the default), generated repositories gain:

  • scripts/generate_typos_config.py and the committed typos.toml (generated by actually running the templated generator; --check confirms no drift);
  • a make spellcheck target that runs the generator's --check and then typos over Markdown files; make markdownlint depends on it;
  • a Spelling (typos) CI step calling make spellcheck, placed after the existing Setup uv step so uv tool run is available on the runner;
  • spelling-gate documentation in the generated developer guide, users' guide, AGENTS.md, and docs/repository-layout.md.

When false, renders carry no trace of the gate: no files, no Makefile wiring, no CI step, no documentation. Conditional whole files use conditional path names (including a conditional scripts/ directory); in-file fragments use {% if %} blocks. ci.yml needed a conditional step, so it becomes ci.yml.jinja wrapped in {% raw %} blocks, following the release workflow's established escaping convention (the only rendered difference with the gate disabled is the raw-block leading/trailing blank line that release.yml also has).

Validation

  • Rendered lib/app × on/off combinations; toggle-off outputs contain no typos/spellcheck traces and actionlint passes on all rendered workflows.
  • On a default render: python3 scripts/generate_typos_config.py --check passes, typos@1.48.0 runs clean over the rendered Markdown, mbake validate Makefile passes for both toggle states.
  • Running the gate over rendered output flagged five genuine issues in template documentation prose, now fixed: "GitHub Flavored" → "GitHub-flavoured" (matching existing house usage), "signaling" → "signalling", "afterward" → "afterwards", "parameterisation" → "parameterization"; the external citation title "Azure Architecture Center | Microsoft Learn" keeps its published spelling via an extend-ignore-re pattern.
  • Parent contract suite: 50 passed, 1 skipped, including three new contract tests covering both toggle states; the only failures are the three pre-existing test_lint_targets whitaker-fallback cases tracked in test_lint_targets whitaker-fallback cases fail on a clean main checkout #53. Rendered Makefile/CI snapshots updated and reviewed.

Generated repositories now enforce en-GB Oxford ("-ize") spelling in
Markdown prose with typos, using the two-layer mechanism stilyagi
introduced in ee77d08a19bc9c1107f30fc2b5bb63ced979fbc4: a generated
typos.toml restores Oxford -ize forms over the en-gb locale, and
scripts/generate_typos_config.py is the single source of truth for its
stems, accepted words, and ignore patterns.

The gate is a new boolean copier option, en_gb_oxendict, defaulting to
true. When enabled the template renders the generator script and the
committed typos.toml, pins the typos version through a Makefile
TYPOS_VERSION variable, and adds a spellcheck target that markdownlint
depends on. Because the generated repository has no Python test
runner, the generator carries the netsuke parse tests' intent in a
--check mode: it tomllib-parses the rendered document (failing fast on
duplicate extend-words keys), asserts the exact entry count, and diffs
the committed file against the generator output. CI runs the gate as a
dedicated step after uv is installed, which required converting ci.yml
to a raw-wrapped Jinja template following the release workflow's
escaping convention. Disabled renders carry no trace of the gate.

Running the gate over rendered output surfaced five genuine spelling
issues in the template documentation (Flavored, signaling, afterward,
parameterisation, and an American citation title), which are corrected
or, for the external citation title, ignored by pattern.

Parent contract tests cover both toggle states, and the rendered
Makefile and CI snapshots are updated accordingly.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 17 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 86ac76c3-2adc-4ed9-931b-c6bd434d314e

📥 Commits

Reviewing files that changed from the base of the PR and between 7d7eb00 and 21fa0e0.

📒 Files selected for processing (16)
  • copier.yaml
  • docs/users-guide.md
  • template/.github/workflows/ci.yml.jinja
  • template/AGENTS.md.jinja
  • template/Makefile.jinja
  • template/docs/complexity-antipatterns-and-refactoring-strategies.md
  • template/docs/developers-guide.md.jinja
  • template/docs/documentation-style-guide.md
  • template/docs/repository-layout.md.jinja
  • template/docs/rust-testing-with-rstest-fixtures.md
  • template/docs/users-guide.md.jinja
  • template/{% if en_gb_oxendict %}scripts{% endif %}/generate_typos_config.py
  • template/{% if en_gb_oxendict %}typos.toml{% endif %}
  • tests/helpers/rendering.py
  • tests/test_template/__snapshots__/test_snapshots.ambr
  • tests/test_template/test_spelling_gate.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-en-gb-oxendict-gate

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21fa0e0aef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,1803 @@
# typos configuration enforcing en-GB-oxendict (Oxford spelling).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add the template suffix to the conditional typos file

With _templates_suffix: .jinja, conditional file names need to remain template files for Copier to evaluate the Jinja in the path. This new root file does not end in .jinja, unlike the existing conditional files, so renders get the literal {% if en_gb_oxendict %}typos.toml{% endif %} instead of the typos.toml that make spellcheck expects; default projects then fail the new spelling step as soon as the generator checks for the committed config.

Useful? React with 👍 / 👎.

Comment thread template/Makefile.jinja
$(MDLINT) '**/*.md'

spellcheck: ## Check typos.toml drift and enforce en-GB-oxendict spelling
python3 scripts/generate_typos_config.py --check

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run the generator with a versioned Python

On machines where python3 is older than 3.11 (for example Ubuntu 22.04), this target fails before typos runs because the generator imports tomllib and even declares requires-python = ">=3.12", but the Makefile bypasses the uv shebang by invoking python3 directly. Since the generated docs only require python3, route this through uv/the executable script or explicitly set up a supported Python version for the target.

Useful? React with 👍 / 👎.

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