Skip to content

Implement code review simplification feedback loop#278

Merged
djm81 merged 6 commits into
devfrom
feature/code-review-11-simplification-feedback-loop
May 21, 2026
Merged

Implement code review simplification feedback loop#278
djm81 merged 6 commits into
devfrom
feature/code-review-11-simplification-feedback-loop

Conversation

@djm81
Copy link
Copy Markdown
Contributor

@djm81 djm81 commented May 21, 2026

Summary

  • add simplification metadata and --focus simplify support for code review reports
  • expand deterministic AI-bloat and duplicate-intent simplification findings
  • update review/simplify prompts, docs, module packaging, and reusable code-review skill guidance
  • address review findings for simplify docs, deterministic metadata filtering, override validation, and simplify-scoped score neutrality

Verification

  • openspec validate code-review-11-simplification-feedback-loop --strict
  • hatch run format
  • hatch run type-check
  • hatch run lint
  • hatch run yaml-lint
  • hatch run check-bundle-imports
  • hatch run verify-modules-signature --payload-from-filesystem --enforce-version-bump
  • hatch run pytest tests/unit/specfact_code_review/run/test_findings.py tests/unit/specfact_code_review/run/test_scorer.py tests/unit/specfact_code_review/run/test_runner.py tests/unit/specfact_code_review/review/test_commands.py tests/unit/docs/test_code_review_docs_parity.py tests/unit/test_check_prompt_commands_script.py -q
  • hatch run pytest tests/unit/specfact_code_review/review/test_commands.py --cov=specfact_code_review.review.commands --cov-report=term-missing -q
  • hatch run contract-test
  • hatch run smart-test
  • hatch run test
  • hatch run specfact code review run --bug-hunt --json --out .specfact/code-review.json --scope changed
  • pre-commit on d1dd700: signature check, format, yaml-lint, check-bundle-imports, lint, staged code review, and contract-test all passed
  • real-world local linked module smoke: SPECFACT_MODULES_ROOTS=/packages SPECFACT_ALLOW_UNSIGNED=1 python -m specfact_cli.cli code review rules init --ide codex, then codex -C /tmp/specfact-skill-smoke-roots debug prompt-input "Use specfact-code-review" confirmed Codex listed specfact-code-review from the installed .codex skill path

Notes: the latest changed-scope SpecFact review exits 0. Remaining findings are non-blocking Typer wrapper shape advisories and score-neutral ai-bloat LOC-vs-complexity hints, not the pasted review findings. Initial skill smoke without SPECFACT_MODULES_ROOTS exposed that the user-scoped installed module can mask a local checkout, so the recorded smoke pins the local module root explicitly.

@strix-security
Copy link
Copy Markdown

Strix is installed on this repository, but we could not run this PR security review because this workspace does not have an active plan. If you'd like to continue receiving code reviews, you can add a payment method or manage billing here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9ae9e779-6e34-4a75-8834-1e1868b55576

📥 Commits

Reviewing files that changed from the base of the PR and between 6c52425 and 5aad09f.

📒 Files selected for processing (14)
  • docs/bundles/code-review/overview.md
  • docs/bundles/code-review/run.md
  • openspec/changes/code-review-11-simplification-feedback-loop/TDD_EVIDENCE.md
  • packages/specfact-code-review/module-package.yaml
  • packages/specfact-code-review/src/specfact_code_review/review/commands.py
  • packages/specfact-code-review/src/specfact_code_review/run/findings.py
  • packages/specfact-code-review/src/specfact_code_review/run/runner.py
  • packages/specfact-code-review/src/specfact_code_review/run/scorer.py
  • packages/specfact-project/module-package.yaml
  • packages/specfact-project/resources/prompts/specfact.08-simplify.md
  • tests/unit/specfact_code_review/review/test_commands.py
  • tests/unit/specfact_code_review/run/test_findings.py
  • tests/unit/specfact_code_review/run/test_runner.py
  • tests/unit/specfact_code_review/run/test_scorer.py

📝 Walkthrough

Bundle and Module Surface

specfact-code-review v0.47.18 (from 0.47.17):

  • New exported type alias: ReviewFocus = Literal["simplify"] in runner.py
  • New exported dataclass: ReviewOptions with fields no_tests, include_noise, progress_callback, bug_hunt, review_level, review_mode, focus (in runner.py)
  • Public function signature changed: run_review(files, options: ReviewOptions | None = None, **overrides: object) replaces individual keyword arguments, enabling options composition and kwargs validation via _review_options_from_kwargs()
  • CLI command specfact code review run now accepts --focus simplify via new _ReviewRunCliInputs dataclass and _validate_focus_flags() validation (rejects --focus with --include-tests/--exclude-tests, enforces mutually-exclusive test flags)
  • New deterministic simplification finding metadata attached via expanded AI-bloat heuristics and duplicate-intent grouping

specfact-project v0.41.12 (from 0.41.11):

  • Updated /specfact.08-simplify prompt to group candidates by intent_key (when present) before file/domain/rule fallback, display related locations, and mandate per-candidate confirmation before edits
  • Updated /specfact.03-review.md prompt with CLI reality-check instructions, command drift rules, and repository-specific validation gates

Review Model & Report Metadata

ReviewFinding dataclass extended with optional simplification metadata:

  • confidence: Literal["low","medium","high"] | None
  • rewrite_hint: str | None
  • canonical_pattern: str | None
  • intent_key: str | None
  • estimated_deletion_lines: int | None (non-negative)
  • related_locations: list[EvidenceRef] | None
  • New methods: has_simplification_metadata() and simplification_metadata_is_deterministic() for triage and filtering

ReviewReport schema version now "1.1" when any finding contains simplification metadata (backward-compatible; legacy reports remain "1.0").

Simplification findings remain score-neutral and non-blocking; score_review() now accepts simplification_score_neutral=True to zero-out deductions for dry/kiss findings with complete metadata when focus=="simplify".

Deterministic Simplification Analyzers

ai_bloat_runner.py (+345 lines):

  • Expanded heuristics emit deterministic findings for unused optional parameters, redundant temporaries, manual accumulators, verbose booleans, redundant None branches, pass-through try/except blocks, repeated equality branches (lookup-table candidates), stdlib helper candidates, and wrapper-chain pass-through detection
  • Each candidate produces a ReviewFinding with advisory category, high confidence, rewrite hint, canonical pattern, and estimated deletion lines

ast_clean_code_runner.py (+51 lines):

  • dry.duplicate-function-shape findings now enriched with intent_key derived from normalized function-name and file-path tokens (filtering stopwords)
  • Matching duplicates annotated with high confidence, rewrite hint, canonical pattern, and related_locations cross-references when intent key exists

Manifest & Integrity

specfact-code-review/module-package.yaml:

  • Version: 0.47.18 (minor bump justified by new exported types ReviewFocus/ReviewOptions, runner signature change, expanded simplification finding categories, and deterministic analyzer additions)
  • Updated checksum and signature: sha256:1de363f9286112d5676eee830583c96e5522d40b3c0f4226480fd38b48d0ca92
  • Core compatibility: >=0.44.0,<1.0.0 (unchanged)

specfact-project/module-package.yaml:

  • Version: 0.41.12 (patch bump for prompt resource-only changes)
  • Updated checksum and signature: sha256:cbae2549ae56e7271c4f4cd0d7140cf2d14ba23b4b49ad2a9afb802275b63833

Documentation & Contract

docs/bundles/code-review/:

  • overview.md: reworded to clarify code-review skill managed via rules command (not "house-rules" skill)
  • rules.md: updated to describe bundled specfact-code-review skill initialization with specfact code review rules init --ide {codex|cursor|vibe}
  • run.md: documented --focus simplify facet as repeatable (mutually exclusive with --include-tests/--exclude-tests), produces advisory ai_bloat + high-confidence dry/kiss findings with deterministic metadata, score-neutral and non-blocking; includes concrete example: specfact code review run --scope changed --focus simplify --json --out .specfact/code-review-simplify.json

docs/bundles/project/overview.md:

  • /specfact.08-simplify workflow now specified to group by intent_key and related context, operate on both ai_bloat and metadata-backed simplification findings from .specfact/code-review.json

docs/modules/code-review.md:

  • Replaced "House rules skill" section with "Code review skill" describing compact reusable SKILL.md for Codex/Claude/Vibe/Cursor; includes explicit --focus simplify guidance and rules init --ide codex example

packages/specfact-code-review/resources/skills/specfact-code-review/SKILL.md:

  • Header updated to "CLI-grounded SpecFact code review workflow"
  • DO section expanded with recommended simplification queue (--scope changed --focus simplify --json --out) and merge-quality review (--scope changed --bug-hunt --json --out) commands
  • DON'T section added/revised: prohibits prompt-template copying, treating simplification as authorship proof, bare except, mixing repository.* with http_client.*, module-level network-triggering imports, hardcoding secrets; prior KISS-threshold rule removed

Cross-Repo & CLI Integration

  • Uses specfact_cli.modules.module_io_shim for bundle-to-CLI bridging (import_to_bundle, export_from_bundle, sync_with_bundle, validate_bundle)
  • No breaking changes to specfact_cli contracts; ReviewOptions/ReviewFocus are module-internal exports
  • Test coverage: CLI validation tests confirm --focus simplify help text, rejection of conflicting test flags, and pass-through to run_command() with correct focus argument

OpenSpec Change Coverage

code-review-11-simplification-feedback-loop (all 7 checklist sections completed):

  1. Failing-before evidence: 13 failed, 99 passed; ReviewFinding lacked simplification metadata, ReviewReport remained v1.0, focus="simplify" unsupported, expanded AI-bloat patterns undetected, duplicate-intent findings lacked intent_key/related_locations, prompt grouping missing metadata support
  2. Passing-after evidence: 93 targeted tests passed; 709 contract/smart/full tests passed; all gates passed (format, type-check, lint, yaml-lint, check-bundle-imports, verify-modules-signature with version bump)
  3. Codex skill smoke test: local module root pinning via SPECFACT_MODULES_ROOTS verified skill installed with updated prompt guidance, --focus simplify flag, "Don't copy prompts" rule, and Codex detection confirmation
  4. Review finding follow-up: 7 failed → 94 passed; deterministic metadata helpers added, partial metadata correctly excluded from simplify queue, dry simplification findings correctly score-neutral only under focus="simplify", run_review kwargs validation enforced
  5. Final review outcome: --scope changed --bug-hunt exit 0, report: 4 findings (0 blocking); remaining advisories are non-blocking Typer wrapper shape hints and score-neutral ai-bloat.loc-vs-complexity items

Skill & Prompt Verification

  • Bundled SKILL.md resource included in tarball artifact; prompt validation tests confirm simplify and project review guidance, intent-key grouping, and related locations in confirmation flow
  • Pre-commit validation updated to check for check-prompt-commands.py presence before safe-change skip

Walkthrough

Adds a simplify-focused review flow: new simplification metadata on findings, --focus simplify CLI/runner plumbing, AST heuristics emitting deterministic simplification hints, score-neutral simplify-queue handling, skill/docs/prompts updates, package bumps, and expanded tests/TDD evidence.

Changes

Simplification feedback loop

Layer / File(s) Summary
Simplification metadata and report schema
packages/specfact-code-review/src/specfact_code_review/run/findings.py, tests/unit/specfact_code_review/run/test_findings.py
Adds simplification fields (confidence,rewrite_hint,canonical_pattern,intent_key,estimated_deletion_lines,related_locations) to ReviewFinding, helpers for presence/determinism, and upgrades ReviewReport.schema_version to "1.1" when present.
CLI inputs and focus validation
packages/specfact-code-review/src/specfact_code_review/review/commands.py, tests/unit/docs/test_code_review_docs_parity.py
Introduces _ReviewRunCliInputs, _validate_focus_flags, and refactors _resolve_review_run_flags to accept structured inputs; adds simplify to allowed focus facets and updates docs-parity tests.
Review run command wiring and facet filtering
packages/specfact-code-review/src/specfact_code_review/run/commands.py, tests/unit/specfact_code_review/run/test_commands.py
Adds ReviewFocus and ReviewRunRequest.review_focus, distinguishes file-affecting facets (source,tests,docs) from simplify, updates path-matching logic, and threads review_focus through the run loop and flags.
Runner orchestration and focus filtering
packages/specfact-code-review/src/specfact_code_review/run/runner.py, packages/specfact-code-review/src/specfact_code_review/run/scorer.py, tests/unit/specfact_code_review/run/test_runner.py
Introduces ReviewOptions, refactors run_review to accept options+overrides, adds structural pylint-noise suppression, implements _belongs_to_simplification_queue/focus filtering, and passes simplification_score_neutral into scoring/report build.
Scoring adjustment for simplify queue
packages/specfact-code-review/src/specfact_code_review/run/scorer.py, tests/unit/specfact_code_review/run/test_scorer.py
_deduction_for_finding and score_review accept simplification_score_neutral and can make eligible dry/kiss simplification findings score-neutral.
AI-bloat heuristics and simplification candidates
packages/specfact-code-review/src/specfact_code_review/tools/ai_bloat_runner.py, tests/unit/specfact_code_review/tools/test_ai_bloat_runner.py
Adds _SimplificationCandidate/_simplification_finding and expands AST heuristics to emit simplification findings (accumulators, verbose booleans, redundant None, pass-through try/except, repeated equality→lookup, stdlib replacements, wrapper-chain detection) with rewrite hints and deletion estimates.
DRY duplicate detection with intent-key grouping
packages/specfact-code-review/src/specfact_code_review/tools/ast_clean_code_runner.py, tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py
Adds tokenization/intent-key helpers and annotates duplicate-function findings with intent_key, rewrite_hint, canonical_pattern, estimated_deletion_lines, and related_locations when intent is detected.
Bundled skill content and updater
packages/specfact-code-review/src/specfact_code_review/resources/skills/specfact-code-review/SKILL.md, packages/specfact-code-review/src/specfact_code_review/rules/updater.py, tests/unit/specfact_code_review/rules/test_updater.py
Updates SKILL.md framing to a CLI-grounded workflow with --focus simplify JSON examples, expands DON’T bullets, adjusts generated default rules text, and updates tests to assert new CLI/help content.
Docs, prompts, and verification guidance
docs/bundles/code-review/*, docs/modules/code-review.md, packages/specfact-project/resources/prompts/specfact.03-review.md, packages/specfact-project/resources/prompts/specfact.08-simplify.md
Replaces house-rules references with bundled specfact-code-review skill, documents --focus simplify and IDE simplify queue JSON path .specfact/code-review-simplify.json, updates simplify prompt to require grouping by intent_key and to use simplify JSON as source, and adds verification commands.
Package manifests/version bumps
packages/specfact-code-review/module-package.yaml, packages/specfact-project/module-package.yaml
Bumps specfact-code-review 0.47.17→0.47.18 and specfact-project 0.41.11→0.41.12 and updates integrity checksum/signature metadata.
Tests, TDD evidence, and prompts validation
tests/unit/..., openspec/changes/code-review-11-simplification-feedback-loop/
Adds/updates unit tests for CLI focus routing, findings metadata, ai_bloat/DRY heuristic metadata, bundled SKILL packaging, prompt-command validation, and records failing/passing TDD evidence and completed task checklists.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related issues

Possibly related PRs

Suggested labels

module

✨ 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 feature/code-review-11-simplification-feedback-loop

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

@djm81 djm81 self-assigned this May 21, 2026
@djm81 djm81 added enhancement New feature or request codebase Specfact codebase related topic labels May 21, 2026
@djm81 djm81 moved this to In Progress in SpecFact CLI May 21, 2026
@djm81 djm81 linked an issue May 21, 2026 that may be closed by this pull request
5 tasks
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa5399f7b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/specfact-code-review/src/specfact_code_review/run/scorer.py Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/specfact-code-review/src/specfact_code_review/review/commands.py (1)

102-102: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update --focus help text to include simplify.

Line 102 still advertises only source/tests/docs, but the resolver accepts simplify. This creates CLI contract drift and hurts discoverability.

Suggested fix
-    focus: list[str] | None = typer.Option(None, "--focus", help="Limit to source, tests, and/or docs (repeatable)."),
+    focus: list[str] | None = typer.Option(
+        None,
+        "--focus",
+        help="Limit to source, tests, docs, and/or simplify (repeatable).",
+    ),
🤖 Prompt for 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.

In `@packages/specfact-code-review/src/specfact_code_review/review/commands.py` at
line 102, The CLI option declaration for focus (the variable named focus using
typer.Option in the command) advertises only "source, tests, and/or docs" while
the resolver also accepts "simplify"; update the help text on the focus
typer.Option (the focus: list[str] | None = typer.Option(...)) to include
"simplify" so the CLI help matches supported values and remains discoverable.
🤖 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/bundles/code-review/overview.md`:
- Around line 28-29: The intro paragraph currently uses the phrase “house-rules
skill management” which conflicts with the table entry that references the
`rules` command managing the bundled code-review skill; update the opening
paragraph to use the same terminology as the table (e.g., “bundled code-review
skill management” or explicitly mention the `rules` command) so the page
consistently refers to the code-review skill and `rules` throughout the
document.

In `@docs/bundles/code-review/run.md`:
- Around line 125-132: Update the docs to consistently document the new simplify
focus: add "simplify" to the key-options table and to the "--focus" facet
section so the command contract matches the example using "--focus simplify";
ensure the description explains that "simplify" produces simplification-focused
reports (retaining ai_bloat plus high-confidence dry and kiss findings with
deterministic simplification metadata such as rewrite_hint, canonical_pattern,
intent_key, estimated_deletion_lines, and related_locations) and mark it as
score-neutral/non-blocking just like the example; verify any lists or validation
text that previously limited --focus to "source/tests/docs" now include
"simplify" and update any related explanatory text to match.

In `@packages/specfact-code-review/src/specfact_code_review/run/runner.py`:
- Around line 312-317: The current _belongs_to_simplification_queue allows
dry/kiss findings with any metadata present; change it to require deterministic
simplification metadata by updating the condition for these categories to
include a deterministic check (e.g., replace the existing
has_simplification_metadata() call with something like
finding.has_simplification_metadata() and
finding.simplification_metadata_is_deterministic(), or check for presence of
explicit deterministic fields such as a concrete "replacement"/"patch" value),
and if that helper doesn't exist add a method on ReviewFinding (e.g.,
simplification_metadata_is_deterministic()) to encapsulate the
deterministic-field checks used by _belongs_to_simplification_queue.
- Around line 509-525: The _review_options_from_kwargs function currently
silently casts arbitrary entries from overrides into ReviewOptions; change it to
validate keys and value types and raise TypeError for unknown keys or invalid
types/values. Implement an explicit allowed_keys set for overrides and check
overrides.keys() ⊆ allowed_keys, validate booleans for
no_tests/include_noise/bug_hunt (using isinstance(..., bool)), ensure
progress_callback is callable or None, ensure review_level is one of
{"error","warning",None} and review_mode is one of {"shadow","enforce"}, and
validate focus against ReviewFocus or None; if any check fails, raise TypeError
explaining the offending key. Keep the constructor return logic using validated
values to build and return ReviewOptions.

In `@packages/specfact-project/resources/prompts/specfact.08-simplify.md`:
- Around line 83-85: The two specfact commands both write to the same artifact
`.specfact/code-review.json` and the second (`specfact code review run --scope
changed --bug-hunt --json --out .specfact/code-review.json`) overwrites the
first; update the outputs so they are distinct (for example change the first to
`--out .specfact/code-review-simplify.json` and the second to `--out
.specfact/code-review-bughunt.json`) by editing the two command lines in
specfact.08-simplify.md so the simplify snapshot is not lost.
- Line 50: The prompt currently instructs to stop when simplification metadata
(intent_key, rewrite_hint, canonical_pattern) is present, which is inverted;
change the condition so the tool only stops when there are no findings with
category == "ai_bloat" AND no simplification metadata present. Update the
sentence around the phrase 'category == "ai_bloat"' to read that you should
report "no simplification candidates and stop" only if neither ai_bloat findings
nor any of the metadata fields (intent_key, rewrite_hint, canonical_pattern) are
present, thereby allowing metadata-backed findings to be processed.

---

Outside diff comments:
In `@packages/specfact-code-review/src/specfact_code_review/review/commands.py`:
- Line 102: The CLI option declaration for focus (the variable named focus using
typer.Option in the command) advertises only "source, tests, and/or docs" while
the resolver also accepts "simplify"; update the help text on the focus
typer.Option (the focus: list[str] | None = typer.Option(...)) to include
"simplify" so the CLI help matches supported values and remains discoverable.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b220f582-3e32-4410-9e45-329638215c5f

📥 Commits

Reviewing files that changed from the base of the PR and between 29de7cd and cc14e2c.

📒 Files selected for processing (29)
  • docs/bundles/code-review/overview.md
  • docs/bundles/code-review/rules.md
  • docs/bundles/code-review/run.md
  • docs/bundles/project/overview.md
  • docs/modules/code-review.md
  • openspec/changes/code-review-11-simplification-feedback-loop/TDD_EVIDENCE.md
  • openspec/changes/code-review-11-simplification-feedback-loop/tasks.md
  • packages/specfact-code-review/module-package.yaml
  • packages/specfact-code-review/src/specfact_code_review/resources/skills/specfact-code-review/SKILL.md
  • packages/specfact-code-review/src/specfact_code_review/review/commands.py
  • packages/specfact-code-review/src/specfact_code_review/rules/updater.py
  • packages/specfact-code-review/src/specfact_code_review/run/commands.py
  • packages/specfact-code-review/src/specfact_code_review/run/findings.py
  • packages/specfact-code-review/src/specfact_code_review/run/runner.py
  • packages/specfact-code-review/src/specfact_code_review/run/scorer.py
  • packages/specfact-code-review/src/specfact_code_review/tools/ai_bloat_runner.py
  • packages/specfact-code-review/src/specfact_code_review/tools/ast_clean_code_runner.py
  • packages/specfact-project/module-package.yaml
  • packages/specfact-project/resources/prompts/specfact.03-review.md
  • packages/specfact-project/resources/prompts/specfact.08-simplify.md
  • tests/unit/docs/test_code_review_docs_parity.py
  • tests/unit/specfact_code_review/rules/test_updater.py
  • tests/unit/specfact_code_review/run/test_commands.py
  • tests/unit/specfact_code_review/run/test_findings.py
  • tests/unit/specfact_code_review/run/test_runner.py
  • tests/unit/specfact_code_review/tools/test_ai_bloat_runner.py
  • tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py
  • tests/unit/test_bundle_resource_payloads.py
  • tests/unit/test_check_prompt_commands_script.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: quality (3.13)
  • GitHub Check: quality (3.12)
  • GitHub Check: quality (3.11)
🧰 Additional context used
📓 Path-based instructions (6)
packages/**/module-package.yaml

⚙️ CodeRabbit configuration file

packages/**/module-package.yaml: Validate metadata: name, version, commands, dependencies, and parity with packaged src.
Call out semver and signing implications when manifests or payloads change.

Files:

  • packages/specfact-code-review/module-package.yaml
  • packages/specfact-project/module-package.yaml
docs/**/*.md

⚙️ CodeRabbit configuration file

docs/**/*.md: User-facing and cross-site accuracy: Jekyll front matter, links per documentation-url-contract,
CLI examples matching bundled commands.

Files:

  • docs/bundles/code-review/run.md
  • docs/bundles/project/overview.md
  • docs/modules/code-review.md
  • docs/bundles/code-review/rules.md
  • docs/bundles/code-review/overview.md
openspec/**/*.md

⚙️ CodeRabbit configuration file

openspec/**/*.md: Specification truth: proposal/tasks/spec deltas vs. bundle behavior, CHANGE_ORDER, and
drift vs. shipped modules or docs.

Files:

  • openspec/changes/code-review-11-simplification-feedback-loop/TDD_EVIDENCE.md
  • openspec/changes/code-review-11-simplification-feedback-loop/tasks.md
**/*.{js,ts,tsx,jsx,py,java,cs,go,rb,php,cpp,c,h}

📄 CodeRabbit inference engine (CLAUDE.md)

Preserve the clean-code compliance gate and its category references (naming, kiss, yagni, dry, and solid)

Files:

  • packages/specfact-code-review/src/specfact_code_review/run/scorer.py
  • tests/unit/test_bundle_resource_payloads.py
  • tests/unit/specfact_code_review/rules/test_updater.py
  • tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py
  • tests/unit/test_check_prompt_commands_script.py
  • tests/unit/specfact_code_review/run/test_findings.py
  • packages/specfact-code-review/src/specfact_code_review/run/findings.py
  • tests/unit/specfact_code_review/run/test_runner.py
  • tests/unit/specfact_code_review/run/test_commands.py
  • packages/specfact-code-review/src/specfact_code_review/tools/ast_clean_code_runner.py
  • packages/specfact-code-review/src/specfact_code_review/run/commands.py
  • packages/specfact-code-review/src/specfact_code_review/review/commands.py
  • packages/specfact-code-review/src/specfact_code_review/tools/ai_bloat_runner.py
  • tests/unit/specfact_code_review/tools/test_ai_bloat_runner.py
  • packages/specfact-code-review/src/specfact_code_review/rules/updater.py
  • tests/unit/docs/test_code_review_docs_parity.py
  • packages/specfact-code-review/src/specfact_code_review/run/runner.py
packages/**/src/**/*.py

⚙️ CodeRabbit configuration file

packages/**/src/**/*.py: Focus on adapter and bridge patterns: imports from specfact_cli (models, runtime, validators),
Typer/Rich command surfaces, and clear boundaries so core upgrades do not silently break bundles.
Flag breaking assumptions about registry loading, lazy imports, and environment/mode behavior.

Files:

  • packages/specfact-code-review/src/specfact_code_review/run/scorer.py
  • packages/specfact-code-review/src/specfact_code_review/run/findings.py
  • packages/specfact-code-review/src/specfact_code_review/tools/ast_clean_code_runner.py
  • packages/specfact-code-review/src/specfact_code_review/run/commands.py
  • packages/specfact-code-review/src/specfact_code_review/review/commands.py
  • packages/specfact-code-review/src/specfact_code_review/tools/ai_bloat_runner.py
  • packages/specfact-code-review/src/specfact_code_review/rules/updater.py
  • packages/specfact-code-review/src/specfact_code_review/run/runner.py
tests/**/*.py

⚙️ CodeRabbit configuration file

tests/**/*.py: Contract-first and integration tests: migration suites, bundle validation, and flakiness.
Ensure changes to adapters or bridges have targeted coverage.

Files:

  • tests/unit/test_bundle_resource_payloads.py
  • tests/unit/specfact_code_review/rules/test_updater.py
  • tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py
  • tests/unit/test_check_prompt_commands_script.py
  • tests/unit/specfact_code_review/run/test_findings.py
  • tests/unit/specfact_code_review/run/test_runner.py
  • tests/unit/specfact_code_review/run/test_commands.py
  • tests/unit/specfact_code_review/tools/test_ai_bloat_runner.py
  • tests/unit/docs/test_code_review_docs_parity.py
🔀 Multi-repo context nold-ai/specfact-cli

Findings for nold-ai/specfact-cli

  • Tests and runtime expect an installable specfact-code-review module and the bundled skill:

    • skills/specfact-code-review/SKILL.md exists in this repo and is referenced by multiple tests/specs (e.g. skills/specfact-code-review/SKILL.md lines) — callers and specs expect the skill file to be present. [::nold-ai/specfact-cli::skills/specfact-code-review/SKILL.md]
    • Many unit/integration tests reference "specfact-code-review" module ids, install flows, and module-package.yaml presence (examples: tests/unit/specfact_cli/registry/test_module_availability.py, tests/unit/specfact_cli/modules/test_multi_module_install_uninstall.py, tests/integration/test_bundle_install.py). These tests will consume any changes to the packaged module (version/integrity/manifest). [::nold-ai/specfact-cli::tests/unit/specfact_cli/registry/test_module_availability.py] [::nold-ai/specfact-cli::tests/unit/specfact_cli/modules/test_multi_module_install_uninstall.py] [::nold-ai/specfact-cli::tests/integration/test_bundle_install.py]
  • CI / verification tooling will exercise module manifest/signature changes:

    • scripts/verify-modules-signature.py, scripts/sign-modules.py, scripts/publish-module.py, scripts/verify-bundle-published.py and related tests reference module-package.yaml processing and signature checks. Changes to module-package.yaml (version/integrity) in specfact-code-review must be consistent with these scripts/tests. [::nold-ai/specfact-cli::scripts/verify-modules-signature.py] [::nold-ai/specfact-cli::scripts/sign-modules.py]
  • Specifications and openspec references assume the run_review contract:

    • openspec entries reference the specfact-code-review module and a run_review signature (e.g. def run_review(files: list[Path], options: ReviewOptions) in archived docs). If run_review signature changes upstream (ReviewOptions added), openspec/specs or any CLI-contract tests in this repo that validate review-run scenarios may need updating. [::nold-ai/specfact-cli::openspec/changes/archive/2026-03-17-code-review-04-contract-test-runners/design.md] [::nold-ai/specfact-cli::openspec/specs/code-review-module/spec.md]
  • IDE / prompt generation and skill installation paths:

    • src/specfact_cli/utils/ide_setup.py builds prompt templates and references module-package.yaml/name-based grouping; changes to how the code-review module exposes SKILL.md or commands (e.g., new flags like --focus simplify) may affect generated IDE instructions or the text expected by tests that assert presence of certain CLI flags in prompts/skills. [::nold-ai/specfact-cli::src/specfact_cli/utils/ide_setup.py]

Summary / impact

  • This repo contains tests, scripts, and specs that reference the specfact-code-review module, its SKILL.md, and module-package.yaml processing/signature verification. Upstream changes that alter module-package.yaml (version/integrity), exported CLI help text (adding flags like --focus), or public function signatures used by contract tests (run_review / ReviewOptions) are relevant here because CI scripts and tests will validate installations, signatures, and prompt/skill content.
  • No direct code-level callers of the new ReviewFinding simplification fields or internal runner types were found in this repo; impact is primarily via module packaging, skill text, CLI help text, module manifest/signature, and openspec/contract test expectations.
🔇 Additional comments (20)
packages/specfact-code-review/module-package.yaml (1)

2-2: LGTM!

Also applies to: 26-27

packages/specfact-project/module-package.yaml (1)

2-2: LGTM!

Also applies to: 30-31

tests/unit/test_bundle_resource_payloads.py (1)

272-272: LGTM!

tests/unit/test_check_prompt_commands_script.py (1)

14-15: LGTM!

Also applies to: 243-243, 249-272

openspec/changes/code-review-11-simplification-feedback-loop/TDD_EVIDENCE.md (1)

1-56: LGTM!

openspec/changes/code-review-11-simplification-feedback-loop/tasks.md (1)

3-8: LGTM!

Also applies to: 12-18, 22-25, 29-33, 37-40, 44-46, 50-54

packages/specfact-project/resources/prompts/specfact.03-review.md (1)

27-40: LGTM!

Also applies to: 731-745

packages/specfact-code-review/src/specfact_code_review/run/findings.py (1)

98-113: LGTM!

Also applies to: 115-120, 122-136, 178-179

tests/unit/specfact_code_review/run/test_findings.py (1)

9-9: LGTM!

Also applies to: 36-41, 66-89, 176-199

packages/specfact-code-review/src/specfact_code_review/review/commands.py (1)

29-37: LGTM!

Also applies to: 64-75, 78-90, 116-127

tests/unit/docs/test_code_review_docs_parity.py (1)

13-13: LGTM!

Also applies to: 66-74, 80-88

packages/specfact-code-review/src/specfact_code_review/run/commands.py (1)

19-19: LGTM!

Also applies to: 69-69, 81-81, 90-92, 100-103, 105-105, 395-395, 415-415, 465-473, 538-538, 590-592, 608-617

tests/unit/specfact_code_review/run/test_commands.py (1)

205-243: LGTM!

packages/specfact-code-review/src/specfact_code_review/run/runner.py (1)

59-73: LGTM!

Also applies to: 227-253, 320-326, 528-605

tests/unit/specfact_code_review/run/test_runner.py (1)

57-77: LGTM!

Also applies to: 182-216

packages/specfact-code-review/src/specfact_code_review/tools/ai_bloat_runner.py (1)

20-49: LGTM!

Also applies to: 223-239, 268-305, 307-332, 334-421, 423-528, 538-545, 547-579, 600-600

tests/unit/specfact_code_review/tools/test_ai_bloat_runner.py (1)

5-6: LGTM!

Also applies to: 91-194, 210-226

packages/specfact-code-review/src/specfact_code_review/tools/ast_clean_code_runner.py (1)

14-15: LGTM!

Also applies to: 19-37, 125-138, 173-200

tests/unit/specfact_code_review/tools/test_ast_clean_code_runner.py (1)

56-107: LGTM!

packages/specfact-code-review/src/specfact_code_review/run/scorer.py (1)

55-56: LGTM!

Comment thread docs/bundles/code-review/overview.md
Comment thread docs/bundles/code-review/run.md
Comment thread packages/specfact-project/resources/prompts/specfact.08-simplify.md Outdated
Comment thread packages/specfact-project/resources/prompts/specfact.08-simplify.md Outdated
@djm81 djm81 merged commit 2b02fdb into dev May 21, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in SpecFact CLI May 21, 2026
@djm81 djm81 mentioned this pull request May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codebase Specfact codebase related topic enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Change] Code review simplification feedback loop

1 participant