Enforce Oxford spelling with typos - #415
Conversation
Generate the repository policy from the shared estate dictionary and a narrow local overlay. Refresh the untracked base only when the authority is newer, validate the helper and generated config, and run the pinned spelling gate in CI. Correct the maintained documentation spellings now enforced by the gate.
There was a problem hiding this comment.
Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe PR replaces the hand-maintained spelling generator with a cached shared dictionary and local overlay, adds deterministic rendering and refresh handling, introduces focused rollout tests, and wires ChangesGenerated spelling policy
Sequence Diagram(s)sequenceDiagram
participant Contributor
participant Makefile
participant Generator as generate_typos_config.py
participant Source as HTTPS dictionary source
participant Typos
Contributor->>Makefile: Run make spelling
Makefile->>Generator: Generate typos.toml
Generator->>Source: Refresh shared dictionary
Source-->>Generator: Return dictionary or cache status
Generator-->>Makefile: Write generated policy
Makefile->>Typos: Scan tracked Markdown files
Typos-->>Contributor: Report spelling result
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5 | ❌ 15❌ Failed checks (15 inconclusive)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Group refresh policy and transport state into immutable values so the shared spelling helper remains within the estate's code-health limits. Split refresh tests into focused modules to keep every source file below the repository's 400-line limit while preserving the full contract suite.
There was a problem hiding this comment.
Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7c5310081
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/developers-guide.md`:
- Around line 120-126: Update both three-item lists in the shared estate
dictionary and typos.local.toml descriptions to include an Oxford comma before
“and,” preserving the existing wording and meaning.
- Line 117: Update the wording in the repository-root typos.toml description
from “deterministic generated output” to “deterministically generated output,”
preserving the surrounding sentence.
In `@Makefile`:
- Line 58: Remove the redundant test-typos-config alias from the Makefile,
unless the repository search finds external references requiring compatibility;
otherwise retain only spelling-helper-test as the shared spelling-policy test
target.
- Around line 85-91: Update the spelling target and its CI workflow so the
shared-dictionary cache and metadata used by generate_typos_config.py are
restored before the target runs and persisted after it completes, using the
repository’s established cache mechanism. Ensure cache misses still allow the
refresh to run and cache hits avoid an unnecessary network request while
preserving the existing typos validation steps.
In `@scripts/generate_typos_config.py`:
- Around line 58-83: Expand the docstring for the public function main to use
the project’s NumPy-style structure: document output, repository, source, and
offline parameters with their types and meanings; document the
rollout.RefreshResult return value; and document that
rollout.NetworkUnavailableError is re-raised when no tracked fallback is
available. Keep the existing refresh and fallback behavior unchanged.
- Around line 27-42: Expand the docstrings for the public functions
dictionary_from_cache and render_config to follow the project’s full NumPy-style
format. Document the repository parameter, including its Path type and default,
and add Returns sections describing the rollout.Dictionary and str results
respectively; preserve the existing behavior and summaries.
In `@scripts/tests/test_typos_rollout.py`:
- Around line 36-43: Update every bare assert in the affected tests, including
the assertions around generate_word_mappings and those at the referenced later
locations, to include a concise failure message describing the expected mapping
or value. Preserve the existing assertions and test behavior while applying the
repository’s assert-with-message convention consistently.
- Around line 68-87: The test
test_dictionary_validation_rejects_invalid_documents should use
pytest.mark.parametrize to provide each invalid document as a separate test case
instead of iterating inside one test. Move the document variants into
parametrized inputs while preserving the existing load_dictionary call and
expected TypeError/ValueError assertion.
In `@scripts/typos_rollout.py`:
- Around line 106-108: Expand the NumPy-style docstrings for public functions
load_dictionary, merge_dictionaries, generate_word_mappings,
render_typos_config, write_config, and refresh_base in scripts/typos_rollout.py,
documenting Parameters, Returns, and applicable TypeError/ValueError cases. Also
update atomic_write in scripts/typos_rollout_cache.py with a Parameters section
and Notes describing its atomic write-and-replace guarantee.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 094f63b6-e430-4b20-a0c4-f598694f3e4c
📒 Files selected for processing (19)
.github/workflows/ci.yml.gitignoreAGENTS.mdMakefiledocs/developers-guide.mddocs/netsuke-design.mddocs/reliable-testing-in-rust-via-dependency-injection.mdscripts/generate_typos_config.pyscripts/tests/conftest.pyscripts/tests/test_generate_typos_config.pyscripts/tests/test_typos_rollout.pyscripts/tests/test_typos_rollout_hardening.pyscripts/tests/test_typos_rollout_refresh.pyscripts/tests/typos_rollout_test_support.pyscripts/typos_rollout.pyscripts/typos_rollout_cache.pyscripts/typos_rollout_http.pytypos.local.tomltypos.toml
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
leynos/rstest-bdd(auto-detected)leynos/ortho-config(auto-detected)leynos/shared-actions(auto-detected)
💤 Files with no reviewable changes (1)
- scripts/tests/test_generate_typos_config.py
Refresh the rollout from the merged shared authority, enforce exact phrase corrections alongside Typos, and replace maintained artefact spellings while preserving public workflow contracts with narrow protections. Apply the outstanding review fixes, split and document the helper tests, cache shared dictionary state in CI, and retain the documented focused-test alias. Rename the legacy package helper to its Oxford spelling and update all internal references.
Extract mapping validation, correction merging and phrase scanning into focused helpers. Preserve deterministic diagnostics and matching behaviour while satisfying the review complexity limits. Add characterization coverage for invalid policy documents, merge ordering and complete phrase-finding order.
Bundle the expected exception class and diagnostic into one parametrized value so each named validation case remains exact while meeting the review argument limit.
Summary
This branch enforces the estate-wide en-GB-oxendict policy through a generated
Typos configuration, a hardened shared-dictionary cache, and a companion exact
phrase checker for punctuation-separated corrections such as
hand-writtentohandwritten.It refreshes the merged shared authority, corrects maintained prose and private
identifiers to
artefactspelling, and preserves fixed public workflow orupstream contracts through narrow token-scoped protections. It also addresses
the outstanding review findings by documenting public helper interfaces,
improving assertion diagnostics, parameterizing invalid inputs, and caching
dictionary state in CI without skipping freshness validation.
No matching roadmap implementation item was found. Open issue #408 concerns a
separate internal identifier rename and is not changed or closed by this
policy rollout.
Review walkthrough
artifactidentity is accepted.Validation
make check-fmt: passed.make lint: passed, including Rustdoc, Clippy, and Whitaker.make typecheck: passed.make test-workflow-contracts: passed; six tests.make test: passed; 1,094 tests across 41 binaries.make release: passed.make spelling-helper-test: passed; 31 tests, 91.94% total coverage, and 94% phrase-checker coverage.make spelling: passed; phrase policy and pinned Typos are clean.make markdownlint: passed; 70 files and zero findings.make nixie: passed; all Mermaid diagrams are valid.make formal-pr: passed with pinned Kani 0.67.0.checkmake Makefile,mbake validate Makefile, andactionlint: passed.Notes
The optional
make kani-fullsuite reaches unchangedorigin/maincode andfails because
rotate_indexis unavailable under the full Kani build, alongsidean unchanged unused
path_cmpwarning. Neither path is modified by this branch;the repository's required pull-request formal gate is
make formal-pr, whichpasses.