chore(release): v0.43.2 — pre-commit review JSON + OpenSpec dogfood rules#462
chore(release): v0.43.2 — pre-commit review JSON + OpenSpec dogfood rules#462
Conversation
- Pre-commit gate writes ReviewReport JSON to .specfact/code-review.json - openspec/config.yaml: require fresh review JSON and remediate findings - Docs and unit tests updated Made-with: Cursor
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PR updates the pre-commit code review gate workflow to generate JSON output instead of using score-only mode, bumps the package version to 0.43.2, and updates documentation and configuration to reflect this change. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Line 16: The release bullet for the pre-commit hook
`specfact-code-review-gate` is a single long line; wrap it to respect the
markdown 120-character line-length rule by breaking the sentence into multiple
lines while preserving the bullet, inline code and command text (e.g., the
`specfact code review run --json --out .specfact/code-review.json` string and
the reference to `--score-only`), ensuring the `.specfact/` path remains intact
and the resulting lines are each under 120 characters.
- Around line 14-17: Update the 0.43.2 CHANGELOG.md entry to list all meaningful
changes introduced by the PR: expand the "Changed" item about the pre-commit
hook (mention switching the pre-commit specfact-code-review-gate to run
"specfact code review run --json --out .specfact/code-review.json" instead of
"--score-only"), add entries under appropriate headings for the OpenSpec
policy/config changes (e.g., "Changed" or "Added" for new/modified policies),
note documentation updates (under "Changed" or "Added"), and list test updates
or fixes (under "Fixed" or "Changed"); ensure each change references the
relevant feature or file names (e.g., OpenSpec policy/config, specfact
pre-commit gate, docs, tests) and is concise so the 0.43.2 release notes fully
reflect the PR.
In `@openspec/config.yaml`:
- Around line 168-170: Update the freshness rule that invalidates
.specfact/code-review.json so it does not self-invalidate when contributors add
or update supporting evidence files; specifically, modify the policy text around
the ".specfact/code-review.json" freshness check to exclude
openspec/changes/<change-id>/TDD_EVIDENCE.md (or to only consider non-evidence
files in openspec/changes/<change-id>/ for staleness) and add a short note
explaining that TDD_EVIDENCE.md updates are allowed without forcing a new
review; reference the existing freshness check wording that mentions
"openspec/changes/<change-id>/" and the guidance about recording evidence in
"TDD_EVIDENCE.md" when making the change.
In `@scripts/pre_commit_code_review.py`:
- Around line 91-97: The subprocess.run call that invokes
build_review_command(files) in scripts/pre_commit_code_review.py can hang; add a
timeout=300 to that call and wrap it in a try/except that catches
subprocess.TimeoutExpired (import TimeoutExpired from subprocess) and handles it
gracefully: log or print a clear timeout error (including the command or files),
set result to a failure-equivalent (e.g., non-zero return or raise a controlled
exception) so the pre-commit hook fails fast, and ensure the cwd=_repo_root()
usage remains unchanged; keep the rest of the logic that inspects
result.stdout/result.stderr intact.
In `@tests/unit/scripts/test_pre_commit_code_review.py`:
- Around line 67-71: The test's _fake_run currently only asserts
kwargs.get("cwd") is not None; change this to assert the exact expected repo
root to avoid false positives by comparing to the fixture/variable representing
the repo root (e.g., assert kwargs.get("cwd") == repo_root or
expected_repo_root). Keep the other asserts (presence of "--json" and
module.REVIEW_JSON_OUT) and return value the same; update the assertion in the
_fake_run function to perform an equality check against the known repo-root
value used by the test harness.
🪄 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
Run ID: d32a361a-7b12-480c-839b-e71f0ba61d4a
📒 Files selected for processing (10)
CHANGELOG.mddocs/modules/code-review.mdopenspec/config.yamlpyproject.tomlscripts/pre_commit_code_review.pysetup.pysrc/__init__.pysrc/specfact_cli/__init__.pytests/unit/scripts/test_code_review_module_docs.pytests/unit/scripts/test_pre_commit_code_review.py
|
superseded by a single PR from feature/doc-frontmatter-schema that includes the same code plus updated OpenSpec artifacts |
Description
Release v0.43.2 with pre-commit dogfood code review improvements and OpenSpec task rules for
.specfact/code-review.json.Summary
specfact-code-review-gaterunsspecfact code review run --json --out .specfact/code-review.json(structuredReviewReportJSON under gitignored.specfact/). Subprocess uses repo root ascwd.docs/modules/code-review.mdupdated for JSON output and portable hook example.openspec/config.yaml— context +tasksrules require a fresh.specfact/code-review.json, re-run when stale, remediate all severities before PR unless excepted in the proposal.test_pre_commit_code_review.pyandtest_code_review_module_docs.pyaligned with the new CLI.Fixes n/a (chore/release/process)
New Features n/a
Contract References: None (scripts, tests, docs, openspec config only).
Type of Change
Please check all that apply:
@icontractdecorators)Contract-First Testing Evidence
Required for all changes affecting CLI commands or public APIs:
Not applicable to public API surface; unit tests cover script behavior.
Contract Validation
@icontractdecorators on public APIs)@beartypedecorators applied)hatch run contract-test-explorationTest Execution
hatch run contract-test-contracts✅hatch run contract-test-exploration✅hatch run contract-test-scenarios✅hatch run contract-test-full✅Test Quality
How Has This Been Tested?
Contract-First Approach: N/A for new public contracts; targeted pytest for pre-commit and docs.
Manual Testing
Automated Testing
hatch run pytest tests/unit/scripts/test_pre_commit_code_review.py tests/unit/scripts/test_code_review_module_docs.py -qhatch run yaml-lint(openspec/config.yaml)Test Environment
Checklist
@icontract,@beartype) — N/AQuality Gates Status
Recommend full CI on merge; targeted checks run locally for this PR.
hatch run type-check)hatch run lint)hatch run contract-test-contracts)hatch run contract-test-exploration)hatch run contract-test-scenarios)Screenshots/Recordings (if applicable)
N/A