Conversation
Render and assert both pure-Python and Python/Rust template variants using Rust-template-style helpers. Parse generated TOML and workflow YAML so the pytest-copier suite checks the local gates, coverage action inputs, release wheel jobs, and checkout credential policy. Template `release.yml` as Jinja so Rust projects use the wheel matrix while pure-Python projects keep the single pure-wheel path.
Let generated projects run local workflow validation with `make test WITH_ACT=1` by mapping the Make flag to `RUN_ACT_VALIDATION=1` for the pytest invocation. Document the flag in generated `AGENTS.md` and assert the rendered Makefile and guidance contracts for both pure-Python and Python/Rust variants.
Expose `make test` in the parent repository so template tests run through `uvx` with the required pytest-copier, PyYAML, and syrupy dependencies. Document the Makefile entrypoint in the README and suppress nested Make directory messages so rendered-project snapshots stay stable when tests run from the parent target.
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughModernise repo test wiring: add uvx-driven Makefile ChangesTemplate testing and validation
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Makefile
participant uvx
participant pytest
participant act
Developer->>Makefile: make test WITH_ACT=1
Makefile->>uvx: env RUN_ACT_VALIDATION=1 uvx run pytest --with pytest-copier --with pyyaml --with syrupy --with make-parser
uvx->>pytest: run tests/
Makefile->>act: (when invoked) run act for local workflow validation
act->>Docker: run containerised workflow steps (verify Docker available)
Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Make release asset uploads idempotent by passing `--clobber` to `gh release upload` in the generated release workflow. Expand the test package documentation and move generated-file parsing and workflow contract assertions into dedicated helper modules so `tests/test_template.py` remains focused on top-level test cases.
Expand public test and helper docstrings to follow the project NumPy-style convention. Keep subsidiary workflow contract assertions private so the helper module exposes only the functions consumed by top-level tests. Move the CI coverage-action assertion behind a helper to keep `tests/test_template.py` under the 400-line guideline after the docstring updates.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Delegate rendered file reads through the shared generated-file reader so OS errors become assertion failures consistently. Document `WITH_ACT` in generated user guidance, document the helper module split for parent-template contributors, and share the parsed CI workflow mapping across tooling contract checks.
|
@coderabbitai Have the following now been resolved? tests/test_template.py (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In tests/helpers/init.py (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In tests/helpers/rendering.py (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In tests/helpers/tooling_contracts.py (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== tests/test_template.py (around lines 285-370) ==="
sed -n '280,380p' tests/test_template.py
echo ""
echo "=== tests/helpers/__init__.py ==="
cat tests/helpers/__init__.py
echo ""
echo "=== tests/helpers/rendering.py ==="
cat tests/helpers/rendering.py
echo ""
echo "=== tests/helpers/tooling_contracts.py (first 310 lines) ==="
sed -n '1,310p' tests/helpers/tooling_contracts.pyLength of output: 19700
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check 1: Unit Architecture - read_generated_file in rendering.py
echo "=== tests/helpers/rendering.py ==="
cat tests/helpers/rendering.py
echo ""
echo "=== tests/helpers/generated_files.py ==="
cat tests/helpers/generated_files.pyLength of output: 8266 🏁 Script executed: #!/bin/bash
# Check 2: User-facing docs WITH_ACT
echo "=== template/docs/users-guide.md.jinja ==="
fd "users-guide.md.jinja" --exec cat {}
echo ""
echo "=== WITH_ACT mentions in template/docs ==="
rg -rn "WITH_ACT" template/docs/ 2>/dev/null || echo "No WITH_ACT in template/docs/"Length of output: 2873 🏁 Script executed: #!/bin/bash
# Check 3: Developer docs
echo "=== docs/developers-guide.md ==="
cat docs/developers-guide.md
echo ""
echo "=== references to helper modules ==="
rg -n "rendering\|generated_files\|tooling_contracts\|Test Helper" docs/ 2>/dev/null || echo "No references in docs/"Length of output: 4611 🏁 Script executed: #!/bin/bash
# Check 4: Redundant YAML parsing in tooling_contracts.py
echo "=== tests/helpers/tooling_contracts.py (parse_yaml_mapping calls) ==="
rg -n "parse_yaml_mapping\|_parse_ci_workflow\|_assert_ci_workflow_contracts\|assert_ci_coverage_action_contract" tests/helpers/tooling_contracts.pyLength of output: 608 🏁 Script executed: #!/bin/bash
echo "=== tests/helpers/tooling_contracts.py ==="
cat tests/helpers/tooling_contracts.pyLength of output: 17911
No further work is required for this PR. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Use the mandated Oxford `-ize` spelling in the test helper module section of the developer guide.
Cover generated-file parsing failures, rendered-file read errors, and public tooling contract edge cases without rendering full Copier projects. These tests make helper fallibility contracts explicit for OSError, invalid TOML, invalid YAML, wrong schema shapes, Makefile target checks, and CI coverage action requirements.
Avoid monkey-patching `Path.read_text` when testing generated-file read errors, defer the `CopierProject` import to type checking, and add explicit messages to direct equality assertions.
Expand helper module docstrings to describe their relationships within the test helper layer. Use a tmp_path-scoped missing file for generated-file read error coverage and add direct tests for the parent Makefile help and test target contracts.
|
@coderabbitai review |
|
@coderabbitai Have the following now been resolved? tests/helpers/tooling_contracts.py (1)
🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== Current state of tests/helpers/tooling_contracts.py ==="
wc -l tests/helpers/tooling_contracts.py
echo ""
echo "=== List files under tests/helpers/ ==="
fd . tests/helpers/ --type f
echo ""
echo "=== tests/helpers/tooling_contracts.py full content ==="
cat tests/helpers/tooling_contracts.pyLength of output: 5485
The public API ( |
|
@coderabbitai Have the following now been resolved? README.md (1)
Triage: [type:docstyle] 🤖 Detailed instructionsVerify each finding against current code. Fix only still-valid issues, skip the In |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== Current state of tests/helpers/ directory ==="
fd . tests/helpers/ --type f
echo ""
echo "=== Line count of tests/helpers/tooling_contracts.py ==="
wc -l tests/helpers/tooling_contracts.py
echo ""
echo "=== List all files under tests/helpers/ with line counts ==="
fd . tests/helpers/ --type f --exec wc -l {}Length of output: 1275
The orchestrator |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
echo "=== scripts/setup_test_deps.sh ==="
cat scripts/setup_test_deps.sh
echo ""
echo "=== README.md (lines 20-45) ==="
sed -n '20,45p' README.md
echo ""
echo "=== Makefile (test target) ==="
grep -n "make-parser\|pytest-copier\|pyyaml\|syrupy" MakefileLength of output: 1682
|
This comment was marked as resolved.
This comment was marked as resolved.
Add developer-guide coverage for the root Makefile targets, WITH_ACT flag, and separate parent CI workflows for normal template tests and act validation.
Mirror the parent act-validation workflow hardening into the rendered template: restrict workflow token permissions, pin markdownlint-cli2 and mbake, and verify the downloaded act archive checksum before extraction. Extend generated workflow contract assertions to cover these protections.
Add the generated audit target to the README make all flowchart, including pip-audit and cargo audit branches, and expand the caption. Wrap the opening README sentence so markdownlint passes.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/agents_contracts.py`:
- Around line 166-173: The loop over command_contracts currently indexes
makefile_rules[target] directly which raises a raw KeyError; before building
commands in the for target, checks in command_contracts loop, add an explicit
guard/assert that target exists in makefile_rules (e.g., assert target in
makefile_rules with a clear error message referencing target and
command_contracts) or use makefile_rules.get(target) and fail with an assertion
if None, then continue to join recipes — update references to
makefile_rules[target] in this block (inside the loop) so contract failures
produce an actionable assertion instead of a KeyError.
In `@tests/test_parent_ci.py`:
- Around line 63-65: The combined assert checking act_workflow should be split
into two atomic asserts so failures identify which fragment is missing: replace
the single assert that tests both "act_Linux_x86_64.tar.gz" and "${ACT_VERSION}"
with two asserts that each check one substring against act_workflow (e.g.,
assert "act_Linux_x86_64.tar.gz" in act_workflow, "expected parent
act-validation workflow to include act_Linux_x86_64.tar.gz" and assert
"${ACT_VERSION}" in act_workflow, "expected parent act-validation workflow to
include ${ACT_VERSION}"), referencing the existing act_workflow variable in
test_parent_ci.py.
🪄 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: 6768993c-c2a0-4f1d-af55-d44de492f5c0
📒 Files selected for processing (14)
.github/workflows/act-validation.yml.github/workflows/ci.ymlREADME.mddocs/developers-guide.mdtemplate/.github/workflows/act-validation.yml.jinjatemplate/Makefile.jinjatests/helpers/agents_contracts.pytests/helpers/ci_contracts.pytests/helpers/makefile_contracts.pytests/helpers/pyproject_contracts.pytests/helpers/release_contracts.pytests/helpers/tooling_contracts.pytests/helpers/wheel_contracts.pytests/test_parent_ci.py
💤 Files with no reviewable changes (1)
- template/Makefile.jinja
|
@coderabbitai pause |
✅ Action performedReviews paused. |
Add an explicit generated Makefile target guard before joining parsed recipes so missing command contracts fail with an actionable assertion instead of KeyError. Split the parent act workflow URL assertion into separate archive and version checks for clearer failure messages.
|
@coderabbitai Please investigate the cause of the following issue using codegraph exploration and research, identify a fix and provide an AI coding agent prompt for the fix: |
This comment was marked as resolved.
This comment was marked as resolved.
Add a step-level RUSTFLAGS override to the generated Rust CI tool installation step so host-inherited -D warnings does not break cargo install for third-party tools under act. Keep project build and test steps unaffected. Assert the rendered Rust workflow contains the override.
Check act logs for coverage and test execution before requiring coverage.xml on disk. This lets the known act composite-output/archive xfail apply after tests and coverage have been observed, instead of failing early with a misleading coverage-file assertion.
Require temporary lint suppressions in rendered AGENTS.md to link to the planned fix or implementation that will remove the suppression. Add a generated AGENTS contract assertion so the guidance does not regress.
Pin parent and rendered workflows to shared-actions commit 455d9ed. Constrain generated pytest discovery to the tests tree for xdist-backed SlipCover coverage. Add parent Makefile gate targets and contracts so check-fmt, lint, typecheck, and test all run from the repository root.
|
@coderabbitai Please investigate the cause of the following issue using codegraph exploration and research, identify a fix and provide an AI coding agent prompt for the fix: |
This comment was marked as resolved.
This comment was marked as resolved.
Upgrade parent and rendered act-validation workflows to act v0.2.84 so act supports Node24 JavaScript actions. Add a local act version preflight that skips optional act-backed tests when the installed binary is too old. Scrub host GitHub auth tokens from act subprocess environments so stale local credentials do not break public action clones.
|
@coderabbitai Please investigate the cause of the following issue using codegraph exploration and research, identify a fix and provide an AI coding agent prompt for the fix: |
This comment was marked as resolved.
This comment was marked as resolved.
Expose ACT_GITHUB_TOKEN only on the parent act-validation test step and forward it to nested act as the GITHUB_TOKEN secret. Keep ambient GITHUB_TOKEN and GH_TOKEN sanitisation unchanged so stale local credentials are not inherited accidentally. Add unit coverage for both the no-secret and explicit-secret run_act command paths.
Summary
This branch strengthens the Python Copier template tests and local validation path so generated projects cover both pure-Python and Python/Rust workflow scenarios. It adds rendered workflow contract checks, wires
actvalidation into generatedmake test WITH_ACT=1, and gives the parent template repository its ownmake testentrypoint.No linked issue, roadmap task, or execplan was found for this branch.
Review walkthrough
WITH_ACTMakefile/AGENTS contract checks.make test WITH_ACT=1support and documentation.actharness that the rendered workflow checks now protect.Validation
uvx ruff format --check tests scripts:5 files already formatteduvx ruff check tests scripts:All checks passed!uvx --with pytest-copier --with syrupy --with pyyaml ty check tests:All checks passed!uvx --with pytest-copier --with syrupy --with pyyaml pytest tests/test_template.py::test_generated_tooling_contracts -q:2 passeduvx --with pytest-copier --with syrupy --with pyyaml pytest tests -q:10 passed, 2 skippedmake help: listedtestandhelpmake test 2>&1 | tee /tmp/test-agent-template-python-act-tests.out:10 passed, 2 skippedNotes
The two skipped tests are the optional
actintegration tests. They collect successfully and remain gated by the repository fixture unlessRUN_ACT_VALIDATION=1is present; generated projects can now request that path withmake test WITH_ACT=1.