Skip to content

Check inline code with the shared spelling policy (#90) - #91

Merged
leynos merged 3 commits into
mainfrom
issue-90-base-dictionary-disables-spell-checking-of-all-inline-code
Aug 6, 2026
Merged

Check inline code with the shared spelling policy (#90)#91
leynos merged 3 commits into
mainfrom
issue-90-base-dictionary-disables-spell-checking-of-all-inline-code

Conversation

@lodyai

@lodyai lodyai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This branch removes the estate-wide exemption that hid every Markdown inline-code span from spelling checks, while retaining the fenced-code-block exemption for high-noise samples. It adds exact local exemptions for this repository's legitimate identifiers and quoted correction examples.

It also adds a [patterns] remove overlay key so consumers can withdraw an exact shared ignore pattern without forking the merge implementation. No-op removals remain valid when the shared base has already improved, while contradictory local additions and removals fail clearly.

Closes #90.

Review walkthrough

Validation

  • make check-fmt: passed
  • make lint: passed
  • make typecheck: passed
  • make test: passed (194 tests; 3 snapshots)
  • make spelling: passed
  • Hypothesis mutation probe: detected removal loss and shrank to one pattern
  • coderabbit review --agent: completed with no findings
  • git diff --check origin/main...HEAD: passed

References

Remove the blanket inline-code ignore pattern while preserving fenced
code blocks. Allow local overlays to withdraw exact shared patterns
without failing when an upstream removal makes the withdrawal a no-op.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Summary

  • Remove the blanket inline-code spelling exemption while retaining fenced-code-block exemption.
  • Add exact local pattern exemptions for valid identifiers and quoted correction examples.
  • Add [patterns] remove overlays for withdrawing shared patterns.
  • Accept absent-pattern removals as no-ops.
  • Reject contradictory additions and removals.
  • Document and test the new behaviour, including inline-code spelling checks and issue #90 regressions.

Walkthrough

The spelling rollout now checks inline code, retains fenced-code exclusions, supports local removal of inherited ignore patterns, and documents these rules. Tests cover configuration rendering, overlay semantics, and inline-code misspellings.

Changes

Spelling policy updates

Layer / File(s) Summary
Enable inline-code checking
data/typos-oxendict-base.toml, typos.toml, typos.local.toml, tests/test_typos_rollout.py, tests/test_typos_spelling_gate.py
Remove the broad inline-code exclusion. Retain fenced-code exclusion. Add explicit spelling exceptions and verify inline-code checking.
Merge removable ignore patterns
scripts/typos_rollout.py, tests/test_typos_rollout_semantics.py
Parse [patterns].remove, merge active and removed patterns, preserve removal records, and reject overlapping ignore and remove entries.
Document pattern override rules
docs/developers-guide.md, docs/users-guide.md
Document local pattern additions, exact removals, overlap validation, and harmless removal of absent patterns.

Sequence Diagram(s)

sequenceDiagram
  participant LocalOverlayFile
  participant Dictionary
  participant merge_ignore_patterns
  participant GeneratedConfig
  LocalOverlayFile->>Dictionary: Parse patterns.ignore and patterns.remove
  Dictionary->>merge_ignore_patterns: Merge inherited and local patterns
  merge_ignore_patterns->>Dictionary: Return active and removed patterns
  Dictionary->>GeneratedConfig: Render the merged spelling configuration
Loading

Possibly related PRs

Suggested labels: Issue

Suggested reviewers: leynos

Poem

Inline code now faces the light,
Fenced blocks keep their quiet night.
Patterns merge, removals flow,
Contradictory rules say no.
Spelling checks both teh and recieve.

🚥 Pre-merge checks | ✅ 15 | ❌ 5

❌ Failed checks (2 warnings, 3 inconclusive)

Check name Status Explanation Resolution
User-Facing Documentation ⚠️ Warning The user's guide documents inline checking and [patterns] overrides, but the changed default behaviour is not signposted in the existing migration guide; fenced-code retention is also not stated. Add a pre-1.0 minor migration note covering inline-code checking, retained fenced-code exclusion, local exact ignores, and [patterns] remove migration rules.
Testing (Property / Proof) ⚠️ Warning _merge_ignore_patterns introduces set/order invariants, but new tests cover only three fixed examples and add no Hypothesis property test or exhaustive proof. Add Hypothesis tests over arbitrary finite pattern sets and orderings. Assert (base ∪ local) − removed, deterministic output, no-op removals, and rejection of every overlap.
Developer Documentation ❓ Inconclusive Investigation is still in progress; no final assessment has been submitted yet. Await repository and documentation cross-checks before deciding.
Testing (Unit And Behavioural) ❓ Inconclusive Temporary status while gathering evidence. Inspect the changed implementation and tests before assessing unit and behavioural coverage.
Architectural Complexity And Maintainability ❓ Inconclusive Investigation is still in progress; no verdict submitted yet. Inspect the full merge path, schema validation, rendering, and test coverage before deciding.
✅ Passed checks (15 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #90 by removing the blanket inline-code exemption, retaining fenced-code handling, and adding exact overlay removals.
Out of Scope Changes check ✅ Passed The configuration, merge logic, tests, and documentation changes directly support issue #90 and introduce no unrelated scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Testing (Overall) ✅ Passed Accept the coverage: tests verify inline versus fenced patterns, exercise real pinned Typos detection, and cover removal, no-op removal, contradiction rejection, parsing, and merge results.
Module-Level Documentation ✅ Passed All 27 Python modules, including every changed module, have module-level docstrings; typos_rollout.py explains its facade role and component relationships.
Testing (Compile-Time / Ui) ✅ Passed Accept: no Rust or TypeScript compile-time surface exists. Focused pytest assertions and exact committed-config equality cover the structured TOML output; a full snapshot would add brittle noise.
Unit Architecture ✅ Passed Keep the change: pattern parsing and merging remain pure, fallible inputs raise explicitly, and persistence stays behind the existing injected atomic writer; focused tests cover the policy boundary.
Domain Architecture ✅ Passed Keep the change: the new overlay state and merge helper are pure policy logic, use no transport or persistence APIs, and remain behind the existing CLI/facade boundary.
Observability ✅ Passed Treat this as PASS: the change affects batch spelling configuration, not a production service; merge failures expose actionable ValueError text, so metrics, tracing and extra logs are not required.
Security And Privacy ✅ Passed Accept the change: the diff adds only spelling policy, documentation, tests, and exact TOML patterns; no secrets, auth changes, privileged operations, or unsafe input sinks appear.
Performance And Resource Use ✅ Passed The change adds only bounded set unions and one sort during one-time policy merging; the repository has 2 shared and 9 local patterns, with no new hot-path I/O or unbounded collection.
Concurrency And State ✅ Passed Pass this check: the PR adds only pure merge logic over a frozen Dictionary of tuples; no async tasks, locks, shared mutable state, or ordering-sensitive execution paths were introduced.
Rust Compiler Lint Integrity ✅ Passed Pass this check: the diff contains no Rust paths or Rust hunks, and no Rust lint suppressions or clone changes require review.
Title check ✅ Passed The title accurately describes the inline-code spelling change and includes the linked issue reference (#90).
Description check ✅ Passed The description clearly explains the spelling-policy change, overlay removal behaviour, tests, documentation, and validation results.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-90-base-dictionary-disables-spell-checking-of-all-inline-code

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

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements local withdrawal of shared ignore patterns in the spelling rollout pipeline, removes the blanket inline-code ignore from the shared policy while keeping fenced-code ignores, and updates tests and docs to validate and explain the new behavior and configuration options.

Flow diagram for ignore pattern merge with removals

flowchart TD
    A[Start _merge_ignore_patterns] --> B[Load base.ignore_patterns and local.ignore_patterns]
    B --> C[Compute removed set from local.removed_patterns]
    C --> D[Compute contradictory = removed ∩ local.ignore_patterns]
    D --> E{contradictory is empty?}
    E -- No --> F[Raise ValueError with conflicting patterns]
    E -- Yes --> G[Union base.ignore_patterns and local.ignore_patterns]
    G --> H[Subtract removed from union]
    H --> I[Sort result and return tuple]
    F --> J[End]
    I --> J[End]
Loading

File-Level Changes

Change Details Files
Support local removal of shared ignore regex patterns when merging spelling dictionaries.
  • Extend the Dictionary data model with a removed_patterns field to track withdrawn shared ignore patterns.
  • Parse a new [patterns] remove list from TOML overlays into removed_patterns.
  • Implement _merge_ignore_patterns to combine base and local ignore patterns, enforce that patterns cannot be both ignored and removed locally, and apply removals.
  • Update merge_dictionaries to use _merge_ignore_patterns and to merge removed_patterns from base and local dictionaries.
scripts/typos_rollout.py
Add semantic tests covering removal and contradiction handling for ignore patterns in overlays.
  • Add tests to verify that a local overlay can withdraw a shared ignore pattern while preserving others.
  • Add tests that confirm removing an already-absent shared pattern is treated as a harmless no-op.
  • Add tests that ensure adding and removing the same pattern in a local overlay raises a ValueError with a useful diagnostic message.
tests/test_typos_rollout_semantics.py
Validate that inline code is now spell-checked while fenced code remains ignored in the shared policy and regression suite.
  • Add a test asserting that the shared dictionary and generated Typos config ignore fenced code blocks but not inline-code spans.
  • Extend the spelling gate test sample to include misspellings inside inline code and assert they are reported as corrections.
tests/test_typos_rollout.py
tests/test_typos_spelling_gate.py
Update configuration and documentation to reflect inline-code checking and the new remove overlay behavior.
  • Adjust typos.toml to replace the blanket inline-code ignore with specific inline-code patterns for known legitimate identifiers and terms.
  • Mirror those specific patterns into typos.local.toml under [patterns] ignore for local policy control.
  • Remove the broad inline-code ignore pattern from the shared oxendict base dictionary, keeping fenced-code ignores.
  • Document in the user guide that inline code is checked by default, when to add exact ignore patterns, and how to use [patterns] remove for stricter local checking.
  • Document in the developer guide how local ignore and remove lists interact, including the merge semantics and the prohibition on overlapping patterns.
typos.toml
typos.local.toml
data/typos-oxendict-base.toml
docs/users-guide.md
docs/developers-guide.md

Assessment against linked issues

Issue Objective Addressed Explanation
#90 Remove the blanket inline-code ignore pattern from the shared base dictionary while retaining the fenced-code-block exemption so that inline code is spell-checked.
#90 Introduce a mechanism (e.g., a [patterns] remove overlay key) that allows downstream repositories to withdraw specific shared ignore patterns without forking the merge logic.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@leynos
leynos marked this pull request as ready for review August 4, 2026 18:57

@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 added the Issue label Aug 4, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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/users-guide.md`:
- Around line 93-96: The pattern configuration documentation in
docs/users-guide.md must state that an identical pattern cannot appear in both
local [patterns] ignore and [patterns] remove lists. Document that configuration
generation rejects this overlap, while preserving the existing descriptions of
additions, removals, and harmless no-op removals.
🪄 Autofix

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: 16416f72-0e28-40cf-a9f0-b1f4ca4788d7

📥 Commits

Reviewing files that changed from the base of the PR and between 1300bd0 and 8f4756a.

📒 Files selected for processing (9)
  • data/typos-oxendict-base.toml
  • docs/developers-guide.md
  • docs/users-guide.md
  • scripts/typos_rollout.py
  • tests/test_typos_rollout.py
  • tests/test_typos_rollout_semantics.py
  • tests/test_typos_spelling_gate.py
  • typos.local.toml
  • typos.toml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • leynos/cuprum (auto-detected)
💤 Files with no reviewable changes (1)
  • data/typos-oxendict-base.toml

Comment thread docs/users-guide.md Outdated
leynos added 2 commits August 4, 2026 21:09
State that configuration generation rejects an identical pattern in local
`ignore` and `remove` lists.
Exercise arbitrary finite pattern memberships and orderings against the
set-difference oracle. Pin deterministic output, harmless absent removals,
and rejection of every generated local add-remove overlap.
@leynos

leynos commented Aug 5, 2026

Copy link
Copy Markdown
Owner

@coderabbitai Have the following failed checks now been resolved?

If further work is required, please provide an AI agent prompt for the remaining work to be done to address these failures.

Do not treat warnings as optional or aspirational. Where a change is out of scope for this PR, propose a GitHub issue unless one exists already. (Treat o11y, code safety, documentation and validation coverage as in scope).

Testing (Property / Proof) ⚠️ Warning _merge_ignore_patterns introduces set/order invariants, but new tests cover only three fixed examples and add no Hypothesis property test or exhaustive proof. Add Hypothesis tests over arbitrary finite pattern sets and orderings. Assert (base ∪ local) − removed, deterministic output, no-op removals, and rejection of every overlap.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- PR state and changed files ---'
gh pr view 91 --repo leynos/agent-helper-scripts --json headRefName,commits,files \
  --jq '{headRefName, commitCount: (.commits | length), files: [.files[].path]}'

printf '%s\n' '--- Relevant file outlines ---'
ast-grep outline scripts/typos_rollout.py --items all --match 'Dictionary|merge|pattern' || true
ast-grep outline tests/test_typos_rollout_semantics.py --items all --match 'merge|pattern|hypothesis|given' || true

printf '%s\n' '--- Merge implementation and test coverage ---'
rg -n -C 8 '_merge_ignore_patterns|removed_patterns|`@given`|hypothesis|strategies|st\.' \
  scripts/typos_rollout.py tests/test_typos_rollout_semantics.py \
  pyproject.toml requirements*.txt setup.cfg tox.ini 2>/dev/null || true

printf '%s\n' '--- Current PR diff for affected files ---'
gh pr diff 91 --repo leynos/agent-helper-scripts -- \
  scripts/typos_rollout.py tests/test_typos_rollout_semantics.py \
  pyproject.toml requirements.txt requirements-dev.txt setup.cfg tox.ini 2>/dev/null || true

Length of output: 30711


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Exact merge implementation ---'
sed -n '195,220p' scripts/typos_rollout.py

printf '%s\n' '--- Property tests ---'
cat -n tests/test_typos_rollout_policy_properties.py

printf '%s\n' '--- PR diff for the property-test file ---'
gh api repos/leynos/agent-helper-scripts/pulls/91/files \
  --paginate \
  --jq '.[] | select(.filename == "tests/test_typos_rollout_policy_properties.py" or .filename == "pyproject.toml") | {filename, status, patch}'

printf '%s\n' '--- Test discovery configuration ---'
sed -n '1,90p' pyproject.toml
fd -a -t f 'conftest\.py|test.*\.py' tests | sort

Length of output: 15414


@leynos: Mark this warning as resolved.

tests/test_typos_rollout_policy_properties.py now provides Hypothesis coverage for _merge_ignore_patterns:

  • It generates arbitrary finite pattern memberships.
  • It asserts (base ∪ local) − removed.
  • It reverses all input orderings and asserts deterministic sorted output.
  • It asserts that arbitrary absent removals are no-ops.
  • It asserts that every generated non-empty local ignore/remove overlap raises ValueError.

pyproject.toml includes hypothesis in the development dependencies.

Do not create a follow-up issue. No further work is required for this finding. No AI agent prompt is required.

I could not execute the tests in this sandbox because the available environment does not permit Python execution.

You are interacting with an AI system.

@leynos
leynos merged commit 91b0fe0 into main Aug 6, 2026
5 checks passed
@leynos
leynos deleted the issue-90-base-dictionary-disables-spell-checking-of-all-inline-code branch August 6, 2026 23:04
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.

Base dictionary disables spell-checking of all inline code

1 participant