Skip to content

Add optional Polonius support to generated projects - #78

Merged
leynos merged 5 commits into
mainfrom
polonius-support
Aug 2, 2026
Merged

Add optional Polonius support to generated projects#78
leynos merged 5 commits into
mainfrom
polonius-support

Conversation

@leynos

@leynos leynos commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

This branch adds an optional enable_polonius Copier choice so generated
applications can adopt borrow-centric internal APIs by default, while generated
libraries retain wider compiler compatibility unless maintainers opt in. It
preserves -Zpolonius=next across Cargo, Make, coverage and release builds
because explicit RUSTFLAGS and target-specific linker flags otherwise
supersede Cargo's build-level settings.

The implementation adapts the toolchain policy from the
Netsuke Polonius migration
and its
Cranelift and mold integration
to the template's optional application/library contract.

Review walkthrough

Validation

  • make test: passed; 70 tests passed and the optional Act test was skipped.
  • make check-fmt: passed; 28 files were already formatted.
  • make lint: passed; Ruff reported no issues.
  • make typecheck: passed; mypy reported no issues in 28 source files.
  • make spelling: passed with the regenerated Oxford spelling configuration.
  • Rendered application and library make all: passed with their recommended
    Polonius defaults.
  • Rendered Polonius-enabled application make markdownlint: passed.
  • git diff --check origin/main...HEAD: passed.

Notes

This branch is not linked to a GitHub issue or roadmap task. It does not
implement an ExecPlan; the repository's existing
Rust tooling import ExecPlan
is complete and predates this extension.

Summary by Sourcery

Add an optional Polonius borrow-checker mode to generated Rust projects and ensure tooling preserves its compiler flags consistently across local builds and CI.

New Features:

  • Introduce an enable_polonius Copier option with flavour-based defaults so applications use Polonius by default while libraries remain broadly compatible.
  • Generate a Polonius policy document and integrate related guidance into README, AGENTS, developers guide, users guide, and repository layout when Polonius is enabled.

Enhancements:

  • Update Cargo, Makefile, coverage, CI, and release workflow templates to propagate -Zpolonius=next whenever RUSTFLAGS are overridden, including mold and lld linker configurations.
  • Extend spelling/typos configuration to accept Polonius terminology and additional words, keeping checks green for the new documentation content.

Tests:

  • Expand template rendering and tooling contract tests to cover Polonius-enabled and disabled projects, including a compilation fixture that validates borrow-centric accessor patterns under Polonius.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

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: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: c3dacbd6-7828-4176-b0d0-1b2016147408

📥 Commits

Reviewing files that changed from the base of the PR and between 4eeeeca and 40108c6.

📒 Files selected for processing (32)
  • .gitignore
  • README.md
  • copier.yaml
  • docs/adr-004-optional-polonius-support.md
  • docs/developers-guide.md
  • docs/execplans/rust-project-enhancements.md
  • docs/migrations/0.2.0.md
  • docs/users-guide.md
  • template/.cargo/config.toml.jinja
  • template/.github/workflows/ci.yml.jinja
  • template/.github/workflows/coverage-main.yml.jinja
  • template/.github/workflows/{% if flavour == 'app' %}release.yml{% endif %}.jinja
  • template/AGENTS.md.jinja
  • template/Makefile.jinja
  • template/README.md.jinja
  • template/docs/contents.md.jinja
  • template/docs/developers-guide.md.jinja
  • template/docs/repository-layout.md.jinja
  • template/docs/users-guide.md.jinja
  • template/docs/{% if enable_polonius %}polonius.md{% endif %}.jinja
  • template/rust-toolchain.toml.jinja
  • template/typos.local.toml
  • template/typos.toml
  • tests/helpers/rendering.py
  • tests/helpers/tooling_contracts/__init__.py
  • tests/helpers/tooling_contracts/polonius.py
  • tests/test_template/__snapshots__/test_snapshots.ambr
  • tests/test_template/test_basic_rendering.py
  • tests/test_template/test_compilation.py
  • tests/test_template/test_tooling_contracts.py
  • typos.local.toml
  • typos.toml

Summary

Add optional Polonius support to generated Rust projects through the enable_polonius Copier choice.

  • Enable Polonius by default for applications.
  • Disable Polonius by default for libraries.
  • Propagate -Zpolonius=next across Cargo, Make, coverage, CI, rustdoc and release workflows.
  • Preserve compatibility with mold, lld and Cranelift configurations.
  • Generate Polonius policy documentation and agent guidance.
  • Reject unsafe rust_nightly_date values before rendering release commands.
  • Extend template tests for configuration variants, tooling contracts and borrow-focused compilation.
  • Document the decision in ADR-004.
  • Mark the Rust project enhancements execplan as complete.
  • Add the 0.2.0 migration guide.
  • Update spelling configuration and repository guidance.

Walkthrough

Add optional Polonius support to generated projects. Configure Cargo, Makefile, CI, coverage, and release workflows. Generate policy documentation. Validate enabled and disabled outputs through rendering, contract, snapshot, and compilation tests.

Changes

Polonius template support

Layer / File(s) Summary
Configuration and rendering contract
copier.yaml, tests/helpers/rendering.py, README.md, docs/*, docs/execplans/*
Add the enable_polonius prompt with application and library defaults. Validate rust_nightly_date. Document configuration, migration, and implementation decisions.
Generated toolchain wiring
template/.cargo/*, template/Makefile.jinja, template/.github/workflows/*, template/rust-toolchain.toml.jinja
Apply -Zpolonius=next to build, documentation, coverage, CI, and release paths when enabled. Select the pinned nightly toolchain for enabled application releases.
Generated policy documentation
template/README.md.jinja, template/docs/*, template/AGENTS.md.jinja
Generate Polonius configuration, API guidance, audit classifications, repository references, and verification instructions when enabled.
Generated output validation
tests/helpers/tooling_contracts/*, tests/test_template/*, template/typos.toml, template/typos.local.toml, typos*.toml, .gitignore
Validate both Polonius states across generated configuration, workflows, documentation, snapshots, and compilation. Add spelling entries and ignore .grepai/.

Sequence Diagram(s)

sequenceDiagram
  participant Copier
  participant Templates
  participant GeneratedProject
  participant ContractTests
  Copier->>Templates: Set enable_polonius
  Templates->>GeneratedProject: Render flags, toolchains, and documentation
  GeneratedProject->>GeneratedProject: Run build and workflow commands
  ContractTests->>GeneratedProject: Inspect generated configuration
  ContractTests->>ContractTests: Validate enabled and disabled contracts
Loading

Possibly related PRs

  • leynos/netsuke#472: Propagates Polonius configuration through Cargo, Makefile, CI, coverage, release tooling, and documentation.
  • leynos/netsuke#505: Shares Polonius nightly-toolchain configuration and documentation surfaces.
  • leynos/netsuke#410: Shares Makefile and Whitaker lint integration.

Suggested labels: Roadmap

Poem

Set the flag and pin the night,
Render each policy page right.
Cargo, CI, and tests align,
Stable paths stay flag-free by design.

🚥 Pre-merge checks | ✅ 20
✅ Passed checks (20 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding optional Polonius support to generated projects.
Description check ✅ Passed The description directly explains the Polonius option, configuration changes, workflow integration, documentation, and validation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 Rendered-project tests cover defaults, explicit overrides, targets, Cargo/Make/CI/coverage/release contracts, documentation presence, unsafe dates, and a Polonius typecheck fixture.
User-Facing Documentation ✅ Passed Keep the check passing: docs/users-guide.md documents enable_polonius, defaults, overrides, flags, and generated guidance; README.md and docs/migrations/0.2.0.md signpost the feature and upgrade path.
Developer Documentation ✅ Passed The developer guide documents Polonius test and RUSTFLAGS contracts; ADR-004 records the architecture decision, and the execplan marks the extension complete. No locale set exists.
Module-Level Documentation ✅ Passed All six changed Python modules have module-level docstrings that state their purpose and relationship to rendered Rust projects or tests; repository conventions are consistent.
Testing (Unit And Behavioural) ✅ Passed Tests render Copier projects, run generated make all and Cargo checks, compile a Polonius borrow fixture, reject unsafe dates, and cover 18 flavour/flag/target invariant cases plus workflow contr...
Testing (Property / Proof) ✅ Passed Retain the Hypothesis property test: it samples all 18 flavour, override, and target cases and checks the Polonius contract across rendered surfaces.
Testing (Compile-Time / Ui) ✅ Passed Accept: exercise Rust compilation with a Polonius borrow-returning fixture via make typecheck, and snapshot structured Cargo, Makefile, CI and release output with semantic contracts.
Unit Architecture ✅ Passed Keep the separation: changes are template configuration and edge commands; contract helpers receive rendered data explicitly, while tests isolate rendering, parsing, file writes, and command execut...
Domain Architecture ✅ Passed Pass: the PR changes template infrastructure, documentation, and contract tests only; git diff shows no changes under template/src or template/tests and no domain or adapter logic.
Observability ✅ Passed Accept this check: the change affects generated build and CI tooling, not production service behaviour; workflows log effective coverage flags and tests validate all RUSTFLAGS paths and modes.
Security And Privacy ✅ Passed Pass this check: scans found no secret values; workflows use GitHub secret expressions only, pin actions, limit permissions, and validate nightly dates before shell use.
Performance And Resource Use ✅ Passed Keep the change: production templates add no unbounded work; new checks use bounded workflow/text scans, and the 18-case render matrix has finite inputs with no growth, hot-path I/O, or cloning.
Concurrency And State ✅ Passed The PR adds template flags and isolated test helpers only; no shared mutable state, async tasks, locks, transactions, or concurrency protocol is introduced.
Architectural Complexity And Maintainability ✅ Passed Approve: the change adds one focused Polonius contract helper, reuses existing parsers, centralizes flag composition, adds no dependency or cycle, and documents the maintenance contract.
Rust Compiler Lint Integrity ✅ Passed No Rust source files changed; no broad unused/dead-code suppressions or artificial anchors were added, and the fixture uses only the required key.to_owned() for HashMap<String> ownership.
✨ 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 polonius-support

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

@sourcery-ai

sourcery-ai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds an optional enable_polonius Copier choice and wires Polonius (-Zpolonius=next) coherently through Cargo, Makefile, coverage, CI, and release workflows, plus documentation and tests, with different defaults for app vs lib flavours and a dedicated tooling contract helper.

Sequence diagram for make test with Polonius enabled

sequenceDiagram
    actor Developer
    participant Makefile
    participant Cargo
    participant RustCompiler

    Developer->>Makefile: make test
    Makefile->>Makefile: RUST_FLAGS := -D warnings RUST_FLAGS
    Makefile->>Makefile: POLONIUS_FLAGS := -Zpolonius=next
    Makefile->>Makefile: DEV_RUST_FLAGS := RUST_FLAGS + POLONIUS_FLAGS + DEV_LINKER_FLAGS
    Makefile->>Cargo: CARGO TEST_CMD TEST_FLAGS BUILD_JOBS
    note right of Makefile: RUSTFLAGS=DEV_RUST_FLAGS
    Cargo->>RustCompiler: compile tests with -Zpolonius=next
    Makefile->>Cargo: cargo test --doc --workspace --all-features
    note right of Makefile: RUSTFLAGS=DEV_RUST_FLAGS
    Cargo->>RustCompiler: compile doc-tests with -Zpolonius=next
    RustCompiler-->>Developer: tests and doc-tests built under Polonius
Loading

Flow diagram for optional Polonius configuration propagation

flowchart LR
    Copier[Copier template]
    Choice[enable_polonius choice]
    CargoConfig[template/.cargo/config.toml.jinja]
    Makefile[template/Makefile.jinja]
    Workflows[template/.github/workflows ci.yml.jinja, coverage-main.yml.jinja, release.yml.jinja]
    Toolchain[template/rust-toolchain.toml.jinja]
    Docs[template/docs/polonius.md.jinja, AGENTS.md.jinja]

    Copier --> Choice
    Choice -->|true| CargoConfig
    Choice -->|true| Makefile
    Choice -->|true| Workflows
    Choice -->|true| Toolchain
    Choice -->|true| Docs
    Choice -->|false| CargoConfig
    Choice -->|false| Makefile
    Choice -->|false| Workflows
    Choice -->|false| Toolchain
    Choice -->|false| Docs

    CargoConfig -->|build.rustflags, target rustflags| RustBuild[Rust build commands]
    Makefile -->|POLONIUS_FLAGS, DEV_RUST_FLAGS, COVERAGE_RUST_FLAGS| RustBuild
    Workflows -->|RUSTFLAGS env| RustBuild
    Toolchain -->|nightly rust_nightly_date| RustBuild
    Docs -->|policy and guidance| Contributors[Project contributors]
Loading

File-Level Changes

Change Details Files
Introduce an enable_polonius Copier option with app-default, and thread it through project rendering and tests.
  • Add enable_polonius bool prompt in copier.yaml with app-flavour default true.
  • Extend render_project helper to accept enable_polonius and pass it into Copier answers.
  • Update tooling-contract tests to parametrize enable_polonius per flavour/target, read new docs surfaces, and expect Polonius state in typos overlay.
  • Add basic rendering tests asserting app projects enable Polonius and ship polonius.md, while libs default to disabled and omit the doc.
  • Clarify in root docs that tests now cover both flavours with Polonius on/off.
copier.yaml
tests/helpers/rendering.py
tests/test_template/test_tooling_contracts.py
tests/test_template/test_basic_rendering.py
docs/developers-guide.md
README.md
Wire Polonius flag into Cargo configuration, Makefile, and toolchain so CLI, rust-analyzer, and builds agree when enabled.
  • Add optional [build] rustflags = ["-Zpolonius=next"] in .cargo/config.toml when enabled.
  • Ensure Linux dev target rustflags include Polonius flag alongside mold linker settings because target rustflags override build-level flags.
  • Introduce POLONIUS_FLAGS, DEV_LINKER_FLAGS, and DEV_RUST_FLAGS in the Makefile, using DEV_RUST_FLAGS for test, build, lint, typecheck, and Whitaker commands, and propagating POLONIUS_FLAGS into COVERAGE_RUST_FLAGS.
  • Annotate rust-toolchain.toml with Polonius guidance and nightly pin comments when enabled.
template/.cargo/config.toml.jinja
template/Makefile.jinja
template/rust-toolchain.toml.jinja
Ensure CI, coverage, and app release workflows preserve Polonius when enabled and fall back to stable without it.
  • Template coverage-main workflow as Jinja, inserting -Zpolonius=next into logged and env RUSTFLAGS when enabled.
  • Mirror the same Polonius-aware RUSTFLAGS handling in the CI workflow coverage job.
  • Adjust app release workflow to choose nightly- + Polonius RUSTFLAGS when enabled, otherwise stable with empty RUSTFLAGS, and remove previous +stable override comments.
  • Update repository-layout docs to include polonius.md when enabled and describe its role.
  • Document in user/developer guides how Polonius interacts with Cargo config, Makefile, coverage, and release tooling.
template/.github/workflows/coverage-main.yml.jinja
template/.github/workflows/ci.yml.jinja
template/.github/workflows/{% if flavour == 'app' %}release.yml{% endif %}.jinja
template/docs/repository-layout.md.jinja
template/docs/users-guide.md.jinja
template/docs/developers-guide.md.jinja
docs/users-guide.md
Add Polonius policy documentation and agent guidance, plus a verification-focused tooling contract helper and tests.
  • Introduce polonius.md template (conditional on enable_polonius) documenting compiler contract, borrow-centric design, audit tags, and verification steps.
  • Extend AGENTS.md with a Polonius section gating contributor behaviour, including POLONIUS(...) and POLONIUS-REFUSED(...) tag rules, when enabled.
  • Expose Polonius guidance in README, docs contents, users guide, developers guide, and repository layout when enabled; suppress all Polonius mentions when disabled.
  • Add tests/helpers/tooling_contracts/polonius.py implementing assert_polonius_toolchain_contracts, which parses Cargo, Makefile, workflows, and docs to validate enabled/disabled state coherently.
  • Wire new helper into tooling_contracts init and test_tooling_contracts usage, including coverage-main and release workflow inspection.
  • Add a compilation test that renders a Polonius-enabled lib and verifies a single-lookup get_or_insert accessor typechecks under make typecheck.
template/docs/{% if enable_polonius %}polonius.md{% endif %}.jinja
template/AGENTS.md.jinja
template/README.md.jinja
template/docs/contents.md.jinja
template/docs/users-guide.md.jinja
template/docs/developers-guide.md.jinja
template/docs/repository-layout.md.jinja
tests/helpers/tooling_contracts/polonius.py
tests/helpers/tooling_contracts/__init__.py
tests/test_template/test_tooling_contracts.py
tests/test_template/test_compilation.py
Update spelling/typos configuration to accept new Polonius and related vocabulary and adjust ignore patterns.
  • Add .terraform to typos extend-exclude and rust-analyzer ignore regex.
  • Add Polonius and a set of en-gb↔en-us vocabulary pairs (dialog/dialogs, organizational variants, oxidise/polymerise/underutilise families, italicise family, handwritten) to the Oxford spelling extension.
  • Add Polonius to local typos accepted word lists for template and root configs.
  • Ensure tooling-contract tests expect Polonius in the typos overlay.
template/typos.toml
template/typos.local.toml
typos.toml
typos.local.toml
tests/test_template/test_tooling_contracts.py

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 2, 2026 09:52

@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 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: 3

🤖 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 `@tests/helpers/rendering.py`:
- Line 26: Replace the public helper’s one-line docstring with a complete
NumPy-style docstring, documenting every parameter, the return value, and the
behavior of the `None` option versus a Boolean override for `enable_polonius`.
Keep the documentation aligned with the helper’s existing signature and
behavior.

In `@tests/helpers/tooling_contracts/polonius.py`:
- Around line 106-123: Update _assert_release_workflow to parse the
[toolchain].channel value from rust_toolchain and require the enabled release
setup toolchain to equal that channel instead of merely starting with
“nightly-20”. Also assert the build command uses cross +<toolchain> with the
same parsed channel, while preserving the existing stable and RUSTFLAGS checks.
- Around line 125-143: Expand the docstring of the public
assert_polonius_toolchain_contracts helper with NumPy-style Parameters and
Raises sections, documenting every argument as its rendered project surface and
stating that AssertionError is raised when the selected Polonius state does not
match.
🪄 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: 0fc3accc-6a75-402e-9a5d-74f051a53094

📥 Commits

Reviewing files that changed from the base of the PR and between 204f8e1 and 62d5e2b.

📒 Files selected for processing (29)
  • .gitignore
  • README.md
  • copier.yaml
  • docs/developers-guide.md
  • docs/users-guide.md
  • template/.cargo/config.toml.jinja
  • template/.github/workflows/ci.yml.jinja
  • template/.github/workflows/coverage-main.yml.jinja
  • template/.github/workflows/{% if flavour == 'app' %}release.yml{% endif %}.jinja
  • template/AGENTS.md.jinja
  • template/Makefile.jinja
  • template/README.md.jinja
  • template/docs/contents.md.jinja
  • template/docs/developers-guide.md.jinja
  • template/docs/repository-layout.md.jinja
  • template/docs/users-guide.md.jinja
  • template/docs/{% if enable_polonius %}polonius.md{% endif %}.jinja
  • template/rust-toolchain.toml.jinja
  • template/typos.local.toml
  • template/typos.toml
  • tests/helpers/rendering.py
  • tests/helpers/tooling_contracts/__init__.py
  • tests/helpers/tooling_contracts/polonius.py
  • tests/test_template/__snapshots__/test_snapshots.ambr
  • tests/test_template/test_basic_rendering.py
  • tests/test_template/test_compilation.py
  • tests/test_template/test_tooling_contracts.py
  • typos.local.toml
  • typos.toml
🔗 Linked repositories identified

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

  • leynos/whitaker (auto-detected)

Comment thread tests/helpers/rendering.py Outdated
Comment thread tests/helpers/tooling_contracts/polonius.py Outdated
Comment thread tests/helpers/tooling_contracts/polonius.py Outdated
@leynos

leynos commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@coderabbitai coderabbitai Bot added the Roadmap label Aug 2, 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: 3

🤖 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/adr-004-optional-polonius-support.md`:
- Around line 19-29: Rewrite the Decision paragraph in
docs/adr-004-optional-polonius-support.md without first-person or second-person
pronouns. Replace the awkward “decided for ... and against ...” construction
with direct statements covering the enable_polonius defaults, propagation,
toolchain-contract rationale, and dated-nightly/RUSTFLAGS constraints, using
en-GB-oxendict spelling and grammar.

In `@template/.cargo/config.toml.jinja`:
- Around line 1-8: Propagate Polonius settings to rustdoc: in
template/.cargo/config.toml.jinja, add rustdocflags to the enabled [build]
block; in template/Makefile.jinja at lines 54-55 and 69-70, define RUSTDOC_FLAGS
with POLONIUS_FLAGS as its default and pass RUSTDOCFLAGS="$(RUSTDOC_FLAGS)" to
both cargo test --doc and cargo doc.

In `@tests/helpers/tooling_contracts/polonius.py`:
- Around line 85-94: Extend the Makefile validation in the existing
compile-recipe test to inspect the coverage recipe body and directly assert it
contains RUSTFLAGS="$(COVERAGE_RUST_FLAGS)". Keep the current compile_lines
filtering and composed-flag assertions unchanged, and use the existing makefile
content variable rather than broadening the filter.
🪄 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: 5891a8c2-8fef-4738-93d5-1584c8763dfe

📥 Commits

Reviewing files that changed from the base of the PR and between 204f8e1 and 4eeeeca.

📒 Files selected for processing (31)
  • .gitignore
  • README.md
  • copier.yaml
  • docs/adr-004-optional-polonius-support.md
  • docs/developers-guide.md
  • docs/execplans/rust-project-enhancements.md
  • docs/users-guide.md
  • template/.cargo/config.toml.jinja
  • template/.github/workflows/ci.yml.jinja
  • template/.github/workflows/coverage-main.yml.jinja
  • template/.github/workflows/{% if flavour == 'app' %}release.yml{% endif %}.jinja
  • template/AGENTS.md.jinja
  • template/Makefile.jinja
  • template/README.md.jinja
  • template/docs/contents.md.jinja
  • template/docs/developers-guide.md.jinja
  • template/docs/repository-layout.md.jinja
  • template/docs/users-guide.md.jinja
  • template/docs/{% if enable_polonius %}polonius.md{% endif %}.jinja
  • template/rust-toolchain.toml.jinja
  • template/typos.local.toml
  • template/typos.toml
  • tests/helpers/rendering.py
  • tests/helpers/tooling_contracts/__init__.py
  • tests/helpers/tooling_contracts/polonius.py
  • tests/test_template/__snapshots__/test_snapshots.ambr
  • tests/test_template/test_basic_rendering.py
  • tests/test_template/test_compilation.py
  • tests/test_template/test_tooling_contracts.py
  • typos.local.toml
  • typos.toml
🔗 Linked repositories identified

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

  • leynos/whitaker (auto-detected)

Comment thread docs/adr-004-optional-polonius-support.md Outdated
Comment thread template/.cargo/config.toml.jinja
Comment thread tests/helpers/tooling_contracts/polonius.py

@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: 3

🤖 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 `@copier.yaml`:
- Around line 116-119: Update the rust_nightly_date validator to use a strict
full-string regex that rejects trailing newlines, replacing the current
regex_search pattern’s end anchor with an end-of-string match. Add a regression
test covering a value ending in “2025-06-10\n” and assert that validation raises
ValueError.

In `@docs/migrations/0.2.0.md`:
- Line 22: Update the migration documentation sentence containing
`-Zpolonius=next` by removing the comma before the essential “because” clause,
preserving the surrounding wording and en-GB-oxendict grammar.

In `@tests/helpers/tooling_contracts/polonius.py`:
- Line 81: Update the four contract assertions in the relevant test function to
include descriptive failure messages: the RUSTDOC_FLAGS inheritance check,
coverage recipe check, rustdoc recipe count check, and all-rustdoc-lines check.
Preserve the existing assertion conditions and use the proposed context-specific
messages, including rendered line data for the count and all-lines assertions.
🪄 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: 2a7a898d-2f94-4a14-a3a5-aef723d41030

📥 Commits

Reviewing files that changed from the base of the PR and between 4eeeeca and bb27030.

📒 Files selected for processing (10)
  • README.md
  • copier.yaml
  • docs/adr-004-optional-polonius-support.md
  • docs/migrations/0.2.0.md
  • docs/users-guide.md
  • template/.cargo/config.toml.jinja
  • template/Makefile.jinja
  • tests/helpers/tooling_contracts/polonius.py
  • tests/test_template/__snapshots__/test_snapshots.ambr
  • tests/test_template/test_basic_rendering.py
🔗 Linked repositories identified

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

  • leynos/whitaker (auto-detected)

Comment thread copier.yaml
Comment thread docs/migrations/0.2.0.md Outdated
Comment thread tests/helpers/tooling_contracts/polonius.py Outdated
@leynos

leynos commented Aug 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

leynos and others added 4 commits August 2, 2026 15:29
Default Polonius on for applications and off for libraries while allowing
an explicit override. Preserve the compiler flag through Cargo target
configuration, Make compile paths, coverage, and release workflows so
Cranelift, mold, and lld remain coherent.

Generate borrow-checker policy documentation and agent guidance. Exercise
both configurations and compile a single-lookup borrow-returning accessor.
Ignore the local GrepAI index used during semantic exploration.
Bind release workflows to the exact generated toolchain channel and add a
render-only property test over the complete flavour, option, and target
class matrix.

Document the helper contracts and record the optional Polonius decision,
risks, progress, and outcome in ADR-004 and the completed tooling plan.
Carry the Polonius flag through rustdoc and directly verify the coverage
and documentation recipes that override compiler flags.

Reject unsafe nightly-date answers before rendering release shell commands,
and document the 0.2.0 migration path and refined architectural decision.
Reject nightly dates with trailing newlines using a strict end-of-string
match and retain regression coverage for the validation boundary.

Add actionable messages to rustdoc and coverage contract assertions, and
correct the migration guide's essential `because` clause.
Restore Ruff's required top-level spacing after Weave combines the scheduled
mutation-testing changes with the Polonius property contract.
@lodyai
lodyai Bot force-pushed the polonius-support branch from a350198 to 40108c6 Compare August 2, 2026 13:32
@leynos
leynos enabled auto-merge (squash) August 2, 2026 13:35
@leynos
leynos merged commit bd8c3cf into main Aug 2, 2026
6 checks passed
@leynos
leynos deleted the polonius-support branch August 2, 2026 13:40
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.

1 participant