Skip to content

[Change] code-review-09 - integrate code review into pre-commit workflows#417

Merged
djm81 merged 6 commits intodevfrom
feature/code-review-09-f4-automation-upgrade
Mar 17, 2026
Merged

[Change] code-review-09 - integrate code review into pre-commit workflows#417
djm81 merged 6 commits intodevfrom
feature/code-review-09-f4-automation-upgrade

Conversation

@djm81
Copy link
Collaborator

@djm81 djm81 commented Mar 17, 2026

Description

Integrates specfact code review run into this repository's pre-commit flow and rewrites code-review-09 away from the stale F-4/n8n framing into a repo-owned implementation.

This PR adds a staged-file pre-commit review gate, portable adoption guidance for other projects, JSON-first reward-ledger documentation, and fixes the local review environment by declaring radon in the package/dev/Hatch dependencies.

Fixes #393

New Features #393

Contract References: Adds @icontract decorators to the new scripts/pre_commit_code_review.py helper only.

Type of Change

Please check all that apply:

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Contract enforcement (adding/updating @icontract decorators)
  • 🧪 Test enhancement (scenario tests, property-based tests)
  • 🔧 Refactoring (code improvement without functionality change)

Contract-First Testing Evidence

Required for all changes affecting CLI commands or public APIs:

Contract Validation

  • Runtime contracts added/updated (@icontract decorators on public APIs)
  • Type checking enforced (@beartype decorators applied)
  • CrossHair exploration completed: hatch run contract-test-exploration
  • Contract violations reviewed and addressed

Test Execution

  • Contract validation: hatch run contract-test-contracts
  • Contract exploration: hatch run contract-test-exploration
  • Scenario tests: hatch run contract-test-scenarios
  • Full test suite: hatch run contract-test-full

Test Quality

  • CLI commands tested with typer test client
  • Edge cases covered with Hypothesis property tests
  • Error handling tested with invalid inputs
  • Rich console output verified manually or with snapshots

How Has This Been Tested?

Contract-First Approach: Added targeted unit tests for the new pre-commit helper and script/docs integration, then validated the changed Python scope with specfact code review run.

Manual Testing

  • Tested CLI commands manually
  • Verified rich console output
  • Tested with different input scenarios
  • Checked error messages for clarity

Automated Testing

  • Contract validation passes
  • Property-based tests cover edge cases
  • Scenario tests cover user workflows
  • All existing tests still pass

Test Environment

  • Python version: 3.11
  • OS: Ubuntu

Checklist

  • My code follows the style guidelines (PEP 8, ruff format, isort)
  • I have performed a self-review of my code
  • I have added/updated contracts (@icontract, @beartype)
  • I have added/updated docstrings (Google style)
  • I have made corresponding changes to documentation
  • My changes generate no new warnings (basedpyright, ruff, pylint)
  • All tests pass locally
  • I have added tests that prove my fix/feature works
  • Any dependent changes have been merged

Quality Gates Status

  • Type checking ✅ (hatch run type-check)
  • Linting ✅ (hatch run lint)
  • Contract validation ✅ (hatch run contract-test-contracts)
  • Contract exploration ✅ (hatch run contract-test-exploration)
  • Scenario tests ✅ (hatch run contract-test-scenarios)

Additional evidence actually run in this worktree:

  • openspec validate code-review-09-f4-automation-upgrade --strict
  • .venv/bin/pytest tests/unit/scripts/test_pre_commit_code_review.py tests/unit/scripts/test_pre_commit_smart_checks_docs.py tests/unit/scripts/test_code_review_module_docs.py -q
  • PYLINTHOME=/tmp/pylint .venv/bin/pylint scripts/pre_commit_code_review.py tests/unit/scripts/test_pre_commit_code_review.py tests/unit/scripts/test_pre_commit_smart_checks_docs.py tests/unit/scripts/test_code_review_module_docs.py
  • PATH=$(pwd)/.venv/bin:$PATH .venv/bin/specfact code review run --json scripts/pre_commit_code_review.py tests/unit/scripts/test_pre_commit_code_review.py tests/unit/scripts/test_pre_commit_smart_checks_docs.py tests/unit/scripts/test_code_review_module_docs.py

Known limitation:

  • full repo-wide hatch run lint / hatch run type-check were not closed out here because the branch still sees unrelated baseline findings outside this change, and Hatch env bootstrap was network-sensitive after adding radon

Screenshots/Recordings (if applicable)

Not applicable.

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@djm81 djm81 self-assigned this Mar 17, 2026
@djm81 djm81 added enhancement New feature or request code-review Code review automation and quality governance labels Mar 17, 2026
@djm81 djm81 moved this from Todo to In Progress in SpecFact CLI Mar 17, 2026
@djm81 djm81 merged commit c451134 into dev Mar 17, 2026
13 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in SpecFact CLI Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-review Code review automation and quality governance enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Change] code-review-09 - Integrate specfact code review into pre-commit and portable project workflows

1 participant