Skip to content

Narrow spelling helper values - #46

Merged
leynos merged 2 commits into
mainfrom
typos-validator-narrowing
Jul 10, 2026
Merged

Narrow spelling helper values#46
leynos merged 2 commits into
mainfrom
typos-validator-narrowing

Conversation

@leynos

@leynos leynos commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • bind and narrow persisted HTTP validators before constructing headers
  • cast TOML tables and validated correction mappings to their proven shapes
  • narrow local-source mtimes before freshness comparison
  • construct harvested evidence with its declared object-valued record shape

The hosted beatcue gate exposed these inference differences under ty 0.0.58.
Runtime validation and behaviour remain unchanged.

Validation

  • uv tool run ty@0.0.58 check scripts/typos_rollout.py
  • make ci (127 passed)
  • make spelling
  • mbake validate Makefile
  • actionlint -color
  • git diff --check

No issue or roadmap linkage was found for this rollout feedback.

Make parsed dictionary, freshness metadata, HTTP validators, and harvested records explicit enough for hosted ty 0.0.58 while preserving the helper's validated runtime behaviour.

@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 10, 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

Walkthrough

The typo rollout script adds explicit typing for TOML mappings, cache metadata, conditional headers, and harvested findings. It also rewrites cache checks, header construction, and per-line harvesting into equivalent local-variable and loop-based control flow.

Changes

Typo rollout script

Layer / File(s) Summary
Type mapping contracts
scripts/typos_rollout.py
Add cast and apply explicit mapping types to validated TOML tables and dictionary corrections.
Cache and HTTP locals
scripts/typos_rollout.py
Extract and validate cached modification times, then build conditional headers through typed local values without changing emitted headers.
Harvest loop typing
scripts/typos_rollout.py
Annotate findings and replace generator-based extension with an explicit per-line loop and conditional appends.

Poem

Cast the tables, let types align,
Cache times checked in a clearer line.
Headers gather, precise and bright,
Findings loop through each line right.
Cleaner paths now gently flow.

🚥 Pre-merge checks | ✅ 20
✅ Passed checks (20 passed)
Check name Status Explanation
Title check ✅ Passed Aligns with the value-narrowing refactor in scripts/typos_rollout.py.
Description check ✅ Passed Tracks the same narrowing and casting changes described in the PR summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) ✅ Passed The diff is typing/refactor only, and existing tests already exercise ETag refresh, local mtime freshness, and harvest filtering.
User-Facing Documentation ✅ Passed The diff only narrows types and rewrites equivalent internals in scripts/typos_rollout.py; no user-facing behaviour changed, so no users-guide update was required.
Developer Documentation ✅ Passed Only scripts/typos_rollout.py changed; no new API, architecture, tooling, or build boundary surfaced, and no roadmap/execplan item is outstanding.
Module-Level Documentation ✅ Passed The module carries a clear top-level docstring that states its purpose, utility, and relations to shared dictionaries, caches, config rendering, and harvested text.
Testing (Unit And Behavioural) ✅ Passed PASS: tests cover local, HTTP, and repository boundaries (refresh_base, harvest_repository), plus edge/error paths and a real typos integration check.
Testing (Property / Proof) ✅ Passed Do not recommend property/proof tests: the patch only narrows types and rewrites loops, without introducing new runtime invariants or proof obligations.
Testing (Compile-Time / Ui) ✅ Passed Python typing-only refactor; no compile-time/UI surface here, and existing tests already cover the touched runtime paths.
Unit Architecture ✅ Passed Refactor only narrows types and rewrites equivalent local logic; no new queries, writes, or hidden dependencies were introduced.
Domain Architecture ✅ Passed Keep the change in the script boundary; it only narrows types and rewrites loop control in scripts/typos_rollout.py, with no domain model leakage.
Observability ✅ Passed Pass this check: the patch only narrows types and rewrites control flow, with no added logging, metrics, tracing, or alerts.
Security And Privacy ✅ Passed PASS: Preserve behaviour; changes only narrow types and rewrite the harvest loop equivalently, with no new secrets, auth, permission, or data-exposure paths.
Performance And Resource Use ✅ Passed The delta is type narrowing plus an equivalent per-line loop; it keeps the same O(files+lines) work, no extra I/O, and no unbounded collection growth.
Concurrency And State ✅ Passed PASS: the change only narrows typed locals and rewrites a harvest loop; it adds no shared mutable state, locks, async tasks, or ordering-sensitive concurrency.
Architectural Complexity And Maintainability ✅ Passed PASS: The patch only adds type casts, local bindings, and an explicit loop in one helper module; it introduces no new layers, abstractions, dependencies, or hidden lifecycle.
Rust Compiler Lint Integrity ✅ Passed Keep this check green: the patch only rewrites scripts/typos_rollout.py, with no Rust code, lint suppressions, or clone-heavy ownership changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch typos-validator-narrowing

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

@leynos
leynos marked this pull request as ready for review July 10, 2026 10:56
@leynos

leynos commented Jul 10, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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 `@scripts/typos_rollout.py`:
- Line 133: Update both cast calls in the relevant functions to use stringified
type annotations—cast("Mapping[str, object]", value) and cast("Mapping[str,
str]", corrections_table)—instead of passing Mapping subscripts directly.
🪄 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: 23e4116e-eb2a-4826-a393-e2460caa49d8

📥 Commits

Reviewing files that changed from the base of the PR and between 962d0f9 and 3ce45c8.

📒 Files selected for processing (1)
  • scripts/typos_rollout.py

Comment thread scripts/typos_rollout.py Outdated
Match the helper's typing policy by keeping validated Mapping cast arguments out of runtime evaluation, as requested in review.
@leynos
leynos merged commit 992dc5c into main Jul 10, 2026
4 checks passed
@leynos
leynos deleted the typos-validator-narrowing branch July 10, 2026 11:02
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