- Fix _infer_state_from_artifacts: SPEC-only maps to research (was bug_find) - Fix cmd_validate_folder: corrupted .state files now error instead of silent fallback - Fix upgrade.sh: remove || true, add python3 check, use git rev-parse --git-dir - Update README.md with --project flag, --can-edit modes, --upgrade, enforcement layers - Add 6 new tests for inference and validation fixes - Complete hook-install-process and readme-upgrade-docs tasks
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Implementation: Pre-existing Fixes
|
||||
|
||||
## Changes Made
|
||||
|
||||
### 1. `_infer_state_from_artifacts` heuristic fix (`scripts/status.py` lines 304-309)
|
||||
**Before**: `SPEC.md exists AND BUG_REPORT.md doesn't exist → bug_find` (wrong — most tasks only have SPEC.md)
|
||||
**After**: Simplified logic:
|
||||
- `BUG_REPORT.md` alone → `adversarial_bug_find` (bug_find done)
|
||||
- `IMPLEMENTATION.md` alone → `bug_find` (implement done)
|
||||
- `SPEC.md` alone → `research` (correct mapping)
|
||||
- Removed the buggy SPEC+no-BUG_REPORT case entirely
|
||||
|
||||
### 2. `cmd_validate_folder` corrupted state fix (`scripts/status.py` lines 563-568)
|
||||
**Before**: If `.state` exists but `_read_state()` returns None, silently falls back to `_infer_state_from_artifacts`
|
||||
**After**: Error out with clear message: "corrupted .state file — re-bootstrap with --upgrade"
|
||||
|
||||
### 3. `upgrade.sh` fixes (`scripts/upgrade.sh`)
|
||||
- **Removed `|| true`**: `python3 status.py --upgrade` now fails loudly with error message
|
||||
- **Added python3 check**: Script exits early with clear error if python3 not in PATH
|
||||
- **Git hooks directory**: Use `git rev-parse --git-dir` instead of assuming `.git/hooks/` (supports worktrees and bare repos)
|
||||
- **mkdir -p hooks**: Ensure hooks directory exists before symlinking
|
||||
|
||||
### 4. Tests added (`tests/test_status.py`)
|
||||
- `TestInferStateFromArtifacts`: 4 tests verifying heuristic correctness (spec→research, impl→bug_find, bug_report→adversarial_bug_find, spec+decomp→decomposition)
|
||||
- `TestValidateFolderCorruptedState`: 2 tests verifying empty/whitespace .state files produce errors
|
||||
|
||||
## Test Results
|
||||
All 206 tests pass (6 new tests, 200 existing).
|
||||
Reference in New Issue
Block a user