Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions openspec/changes/code-review-06-reward-ledger/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ Tests before code. Do not implement until failing tests exist.
## 8. Create GitHub issue and PR

- [x] 8.1 Link existing issue: `[Change] code-review-06 - Reward Ledger Supabase Persistence and ledger Subcommands` (#395)
- [ ] 8.2 Update proposal.md Source Tracking; commit, push, create PR
- [x] 8.2 Update proposal.md Source Tracking; commit, push, create PR

## Post-merge cleanup

- [ ] Remove worktree, delete branch, prune
- [x] Remove worktree, delete branch, prune
62 changes: 62 additions & 0 deletions openspec/changes/code-review-07-house-rules-skill/TDD_EVIDENCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# TDD Evidence: code-review-07-house-rules-skill

## Pre-implementation failing run

- **Timestamp**: 2026-03-16 10:27:00 +0000
- **Command**:
`hatch run test -- tests/unit/specfact_code_review/rules/test_updater.py -v`
- **Result**: failed during collection

### Failure summary

- `ModuleNotFoundError: No module named 'specfact_code_review.rules'`

This is the expected red-phase failure before implementing the new `rules`
package, updater, and CLI command surface.

## Status

Red phase complete. Production implementation may now begin.

## Post-implementation passing run

- **Timestamp**: 2026-03-16 10:30:00 +0000
- **Command**:
`hatch run test -- tests/unit/specfact_code_review/rules/test_updater.py -v`
- **Result**: pass

### Passing summary

- The new `specfact_code_review.rules` package imports cleanly and wires into the
existing `review` command surface.
- The updater algorithm now covers thresholded rule surfacing, stale-rule
pruning, version/timestamp updates, mirror generation, and the 35-line hard
cap.
- The command-level scenarios for `rules show`, `rules init`, and `rules update`
pass in the targeted test suite.

## Repository validation

- **Passing gates**:
- `hatch run format`
- `hatch run type-check`
- `hatch run lint`
- `hatch run yaml-lint`
- `hatch run contract-test`
- `hatch run smart-test`
- `hatch run test`
- **Blocked gate**:
- `hatch run verify-modules-signature --require-signature --enforce-version-bump`
fails because no signing key is configured in the local environment, so the
manifest can only be refreshed in checksum-only mode.

## Manual command verification

- Direct bundle-command invocation from the updated local source confirms:
- `rules init` creates `skills/specfact-code-review/SKILL.md`
- `rules show` prints the generated skill verbatim
- `rules update` increments the version, surfaces `C901` from ledger history,
and mirrors the result to `.cursor/rules/house_rules.mdc`
- The outer `specfact code review rules ...` wrapper in this environment still
resolves the previously bundled stub subgroup, so end-to-end CLI refresh
remains pending separate module-bundle bootstrap/signature availability.
58 changes: 29 additions & 29 deletions openspec/changes/code-review-07-house-rules-skill/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ Tests before code. Do not implement until failing tests exist.

## 1. Create git worktree

- [ ] 1.1 `git fetch origin`
- [ ] 1.2 `git worktree add ../specfact-cli-worktrees/feature/code-review-07-house-rules-skill -b feature/code-review-07-house-rules-skill origin/dev`
- [ ] 1.3 `cd ../specfact-cli-worktrees/feature/code-review-07-house-rules-skill`
- [ ] 1.4 `python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"`
- [x] 1.1 `git fetch origin`
- [x] 1.2 `git worktree add ../specfact-cli-worktrees/feature/code-review-07-house-rules-skill -b feature/code-review-07-house-rules-skill origin/dev`
- [x] 1.3 `cd ../specfact-cli-worktrees/feature/code-review-07-house-rules-skill`
- [x] 1.4 `python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"`

## 2. Verify blockers resolved

- [ ] 2.1 Confirm `code-review-01-module-scaffold` is merged
- [ ] 2.2 Confirm `code-review-06-reward-ledger` is merged (updater reads ledger data)
- [x] 2.1 Confirm `code-review-01-module-scaffold` is merged
- [x] 2.2 Confirm `code-review-06-reward-ledger` is merged (updater reads ledger data)

## 3. Write tests BEFORE implementation (TDD-first)

- [ ] 3.1 Write `tests/unit/specfact_code_review/rules/test_updater.py`
- [ ] 3.1.1 Test rule >= 3 hits surfaced in TOP VIOLATIONS
- [ ] 3.1.2 Test rule < 3 hits NOT added to TOP VIOLATIONS
- [ ] 3.1.3 Test rule with 0 hits for 10 consecutive runs pruned
- [ ] 3.1.4 Test version header increments
- [ ] 3.1.5 Test timestamp updated to current date
- [ ] 3.1.6 Test 35 line cap enforced (oldest/lowest-frequency pruned)
- [ ] 3.1.7 Test DO and DON'T sections unchanged after update
- [ ] 3.1.8 Test `@ensure` assertion fires if output > 35 lines
- [ ] 3.2 Run tests → expect failure; record in `TDD_EVIDENCE.md`
- [x] 3.1 Write `tests/unit/specfact_code_review/rules/test_updater.py`
- [x] 3.1.1 Test rule >= 3 hits surfaced in TOP VIOLATIONS
- [x] 3.1.2 Test rule < 3 hits NOT added to TOP VIOLATIONS
- [x] 3.1.3 Test rule with 0 hits for 10 consecutive runs pruned
- [x] 3.1.4 Test version header increments
- [x] 3.1.5 Test timestamp updated to current date
- [x] 3.1.6 Test 35 line cap enforced (oldest/lowest-frequency pruned)
- [x] 3.1.7 Test DO and DON'T sections unchanged after update
- [x] 3.1.8 Test `@ensure` assertion fires if output > 35 lines
- [x] 3.2 Run tests → expect failure; record in `TDD_EVIDENCE.md`

## 4. Create default SKILL.md

Expand All @@ -42,24 +42,24 @@ Tests before code. Do not implement until failing tests exist.

## 5. Implement updater and commands

- [ ] 5.1 Implement `rules/updater.py` — full update algorithm with `@require`/`@ensure`/`@beartype`
- [ ] 5.2 Implement `rules/commands.py` — `show`, `update`, `init` Typer commands
- [ ] 5.3 Create `rules/__init__.py`
- [ ] 5.4 Verify `rules init` creates correct SKILL.md
- [ ] 5.5 Verify no CLAUDE.md modification occurs
- [x] 5.1 Implement `rules/updater.py` — full update algorithm with `@require`/`@ensure`/`@beartype`
- [x] 5.2 Implement `rules/commands.py` — `show`, `update`, `init` Typer commands
- [x] 5.3 Create `rules/__init__.py`
- [x] 5.4 Verify `rules init` creates correct SKILL.md
- [x] 5.5 Verify no CLAUDE.md modification occurs

## 6. Quality gates
## 6. Quality gates and CLI checks

- [ ] 6.1 Run tests → expect passing; record in `TDD_EVIDENCE.md`
- [ ] 6.2 `hatch run format && hatch run type-check && hatch run contract-test && hatch run lint`
- [ ] 6.3 `specfact code review rules show` — verify output
- [ ] 6.4 `specfact code review rules init` — verify SKILL.md created correctly
- [x] 6.1 Run tests → expect passing; record in `TDD_EVIDENCE.md`
- [x] 6.2 `hatch run format && hatch run type-check && hatch run contract-test && hatch run lint`
- [x] 6.3 `specfact code review rules show` — verify output
- [x] 6.4 `specfact code review rules init` — verify SKILL.md created correctly

## 7. Module signing, docs, version, changelog

- [ ] 7.1 Verify/re-sign module
- [ ] 7.2 Update `docs/modules/code-review.md` with rules commands and house_rules skill section
- [ ] 7.3 Bump patch version; update CHANGELOG.md
- [x] 7.1 Verify/re-sign module
- [x] 7.2 Update `docs/modules/code-review.md` with rules commands and house_rules skill section
- [x] 7.3 Bump patch version; update CHANGELOG.md

## 8. Create GitHub issue and PR

Expand Down