-
Notifications
You must be signed in to change notification settings - Fork 0
[codex] expand code review clean-code checks #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
openspec/changes/clean-code-02-expanded-review-module/TDD_EVIDENCE.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # TDD Evidence | ||
|
|
||
| ## 2026-03-31 | ||
|
|
||
| - `2026-03-31T00:56:00+02:00` Bootstrap: | ||
| `hatch run dev-deps` | ||
| linked the local `specfact-cli` checkout into this worktree so the bundle tests and review runner could execute against the live code. | ||
| - `2026-03-31T01:02:00+02:00` Red phase: | ||
| `SPECFACT_ALLOW_UNSIGNED=1 hatch run pytest tests/unit/specfact_code_review/run/test_runner.py tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py tests/unit/specfact_code_review/tools/test_radon_runner.py tests/unit/specfact_code_review/tools/test_semgrep_runner.py -q` | ||
| failed with 5 targeted regressions that matched the new spec change: | ||
| - `test_run_review_requires_explicit_pr_mode_token_for_clean_code_reasoning` | ||
| expected `clean-code.pr-checklist-missing-rationale` but `_checklist_findings()` returned `[]`. | ||
| - `test_run_ast_clean_code_reports_mixed_dependency_roles_for_injected_dependencies` | ||
| expected `solid.mixed-dependency-role` for `self.repo.save()` / `self.client.get()` but the leftmost dependency was still treated as `self`. | ||
| - `test_run_ast_clean_code_continues_after_parse_error` | ||
| expected a per-file `tool_error` plus later-file findings, but the parser branch returned early. | ||
| - `test_run_radon_uses_dedicated_tool_identifier_for_kiss_findings` | ||
| expected `tool="radon-kiss"` but the emitted finding still used `tool="radon"`. | ||
| - `test_run_semgrep_returns_tool_error_when_results_key_is_missing` | ||
| expected a `tool_error` for malformed Semgrep JSON, but the runner treated a missing `results` key as a clean run. | ||
| - `2026-03-31T01:04:30+02:00` Implementation: | ||
| updated `packages/specfact-code-review/src/specfact_code_review/run/runner.py`, | ||
| `packages/specfact-code-review/src/specfact_code_review/tools/ast_clean_code_runner.py`, | ||
| `packages/specfact-code-review/src/specfact_code_review/tools/radon_runner.py`, | ||
| `packages/specfact-code-review/src/specfact_code_review/tools/semgrep_runner.py`, | ||
| `packages/specfact-code-review/src/specfact_code_review/resources/skills/specfact-code-review/SKILL.md`, | ||
| `packages/specfact-code-review/src/specfact_code_review/resources/policy-packs/specfact/clean-code-principles.yaml`, | ||
| `docs/modules/code-review.md`, | ||
| and the targeted unit tests so the new clean-code checks, strict PR-mode gating, dependency-root detection, KISS tool labeling, and Semgrep parsing behavior matched the review comments. | ||
| - `2026-03-31T01:06:30+02:00` Green phase: | ||
| `SPECFACT_ALLOW_UNSIGNED=1 hatch run pytest tests/unit/specfact_code_review/run/test_runner.py tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py tests/unit/specfact_code_review/tools/test_radon_runner.py tests/unit/specfact_code_review/tools/test_semgrep_runner.py -q` | ||
| passed with `50 passed in 20.26s`. | ||
| - `2026-03-31T01:08:11+02:00` Release validation: | ||
| `hatch run verify-modules-signature --require-signature --payload-from-filesystem --enforce-version-bump` | ||
| passed after the module was signed again. | ||
| - `2026-03-31T01:10:42+02:00` Review validation: | ||
| `SPECFACT_ALLOW_UNSIGNED=1 hatch run specfact code review run --json --out .specfact/code-review.json` | ||
| passed with `findings: []`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/specfact-code-review/resources/policy-packs/specfact/clean-code-principles.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| pack_ref: specfact/clean-code-principles | ||
| version: 1 | ||
| description: Built-in clean-code review rules mapped to the governed code-review bundle outputs. | ||
| default_mode: advisory | ||
| rules: | ||
| - id: banned-generic-public-names | ||
| category: naming | ||
| principle: naming | ||
| - id: swallowed-exception-pattern | ||
| category: clean_code | ||
| principle: clean_code | ||
| - id: kiss.loc.warning | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.loc.error | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.nesting.warning | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.nesting.error | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.parameter-count.warning | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.parameter-count.error | ||
| category: kiss | ||
| principle: kiss | ||
| - id: yagni.unused-private-helper | ||
| category: yagni | ||
| principle: yagni | ||
| - id: dry.duplicate-function-shape | ||
| category: dry | ||
| principle: dry | ||
| - id: solid.mixed-dependency-role | ||
| category: solid | ||
| principle: solid | ||
| - id: clean-code.pr-checklist-missing-rationale | ||
| category: clean_code | ||
| principle: checklist |
41 changes: 41 additions & 0 deletions
41
...eview/src/specfact_code_review/resources/policy-packs/specfact/clean-code-principles.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| pack_ref: specfact/clean-code-principles | ||
| version: 1 | ||
| description: Built-in clean-code review rules mapped to the governed code-review bundle outputs. | ||
| default_mode: advisory | ||
| rules: | ||
| - id: banned-generic-public-names | ||
| category: naming | ||
| principle: naming | ||
| - id: swallowed-exception-pattern | ||
| category: clean_code | ||
| principle: clean_code | ||
| - id: kiss.loc.warning | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.loc.error | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.nesting.warning | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.nesting.error | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.parameter-count.warning | ||
| category: kiss | ||
| principle: kiss | ||
| - id: kiss.parameter-count.error | ||
| category: kiss | ||
| principle: kiss | ||
| - id: yagni.unused-private-helper | ||
| category: yagni | ||
| principle: yagni | ||
| - id: dry.duplicate-function-shape | ||
| category: dry | ||
| principle: dry | ||
| - id: solid.mixed-dependency-role | ||
| category: solid | ||
| principle: solid | ||
| - id: clean-code.pr-checklist-missing-rationale | ||
| category: clean_code | ||
| principle: checklist | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.