Fix 10 audit bugs: path prefix matching, verdict parsing, CORS, stale-task detection, phase mapping
CI / build (push) Has been cancelled

Batch 1 (High severity):
- Bug 1: --audit cat3 now checks .automaton/tasks/ paths
- Bug 4: Verdict PASS/FAIL uses structured ## Status: line parsing
- Bug 5: register-guards.sh checks .json/.jsonc, writes plugin key, strips comments
- Bug 7: --can-edit/--scope-check path prefix uses os.sep boundary

Batch 2 (Medium/Low severity):
- Bug 2: migrate-project.sh find command parentheses for -prune binding
- Bug 3: vram_detect model prefix matching with known-suffix whitelist
- Bug 6: dashboard reads .state file before artifact heuristic fallback
- Bug 8: removed wildcard CORS, added security headers (nosniff, DENY)
- Bug 9: stale-task detection uses .state.lastedit instead of .state mtime
- Bug 10: TEST_PLAN.md maps to test_design (was implement)

249 tests pass (up from 235). All 10 tasks driven through full workflow to completion.
This commit is contained in:
Lap Tran
2026-06-22 10:40:58 -04:00
parent f32f98575b
commit 81ccf548e5
106 changed files with 1643 additions and 436 deletions
+1
View File
@@ -0,0 +1 @@
complete
@@ -0,0 +1,2 @@
research:approved|2026-06-22T13:56:13.680386+00:00|user
code_review:approved|2026-06-22T14:06:36.841131+00:00|user
@@ -0,0 +1,18 @@
# Adversarial Bug Report: fix-cat3-audit-paths
## Summary
Adversarial review of the Category 3 audit path fix. No additional bugs found.
## Bugs Found
No bugs found.
## Analysis
- **Race conditions**: `_audit_category3` reads git diff state at a point in time. No concurrent modification risk since it's a read-only audit.
- **Path traversal**: The check uses `Path(changed_file).parts` which splits on path separators — no traversal bypass possible.
- **Edge case — nested subtasks**: `.automaton/tasks/parent/subtasks/child/file` has `parts[2]` = `parent`, which is in `task_names` (subtasks are listed as `parent` in `_all_task_dirs`). Correctly excluded.
- **Edge case — empty task_names**: If `tasks` is empty, `task_names` is empty, and no file matches — all files flagged as unauthorized. This is correct behavior (no tasks = no authorized edits).
## Score
0
ADVERSARIAL_BUG_FIND_COMPLETE
+15
View File
@@ -0,0 +1,15 @@
# Bug Report: fix-cat3-audit-paths
## Summary
The fix correctly handles both framework mode and regular project mode path prefixes in the Category 3 audit.
## Bugs Found
No bugs found.
## Verification
- The path check at status.py:718-732 correctly handles both `tasks/mytask/...` (framework) and `.automaton/tasks/mytask/...` (regular project).
- Subtask paths (`.automaton/tasks/parent/subtasks/child/...`) have `parts[2]` = `parent`, which is in `task_names` — correctly excluded.
- Test `TestCat3AuditRegularProjectPaths` passes.
## Score
0
+12
View File
@@ -0,0 +1,12 @@
# Code Review: fix-cat3-audit-paths
## Summary
Fix is minimal and correct. Adds a second path check for `.automaton/tasks/` prefix to handle regular projects.
## Findings
- **Correctness**: The fix correctly handles both framework mode (`tasks/...`) and regular project mode (`.automaton/tasks/...`). The `if not is_in_task_folder` guard before the second check avoids redundant evaluation.
- **Edge cases**: Subtask paths (`.automaton/tasks/parent/subtasks/child/...`) would have `parts[2]` = `parent`, which is in `task_names` (since `_all_task_dirs` includes subtasks with their parent name). This is correct — subtask files are also excluded from unauthorized.
- **No regressions**: Existing framework-mode audit tests still pass.
## Verdict
APPROVED — no issues found.
+11
View File
@@ -0,0 +1,11 @@
# Doc Review: fix-cat3-audit-paths
## Summary
No documentation updates needed. The Category 3 audit is an internal enforcement mechanism not documented in user-facing docs.
## Findings
- No references to the Cat 3 audit path logic exist in README.md, AGENTS.md, or other docs.
- The fix is internal to `status.py` and does not change any user-facing API.
## Verdict
No doc changes required.
@@ -0,0 +1,7 @@
# Implementation: fix-cat3-audit-paths
## Changes
- **scripts/status.py** `_audit_category3()` (~line 696): Added a second path check for regular projects. Files matching `.automaton/tasks/{task_name}/...` are now correctly recognized as inside task folders, in addition to the existing `tasks/{task_name}/...` check for framework mode.
## Test
- `tests/test_status.py::TestCat3AuditRegularProjectPaths::test_regular_project_task_path_not_flagged` — verifies that changes inside `.automaton/tasks/` in a regular project are not flagged as unauthorized.
+14
View File
@@ -0,0 +1,14 @@
# Spec: fix-cat3-audit-paths
## Problem
`_audit_category3()` in `scripts/status.py:696` checks if changed files are inside task folders using `parts[0] == "tasks"`. This only works for the framework directory (`~/.automaton/`) where git paths are `tasks/mytask/...`. For regular projects, task files have git paths like `.automaton/tasks/mytask/SPEC.md`, where `parts[0]` is `.automaton`, not `tasks`. All task-folder changes are incorrectly flagged as unauthorized.
## Fix
Update the path check at `scripts/status.py:696` to handle both cases:
- Framework mode: `parts[0] == "tasks" and parts[1] in task_names`
- Regular project: `len(parts) >= 3 and parts[0] == ".automaton" and parts[1] == "tasks" and parts[2] in task_names`
## Acceptance Criteria
- `--audit` on a regular project with changes inside `.automaton/tasks/` does NOT flag them as unauthorized
- `--audit` on the framework directory still works correctly
- Add a test in `tests/test_status.py` covering the regular-project path check
+26
View File
@@ -0,0 +1,26 @@
# Verdict: fix-cat3-audit-paths
## Status: PASS
**Completion Date**: 2026-06-22
## Summary
The fix correctly handles both framework mode and regular project mode path prefixes in the Category 3 audit. All tests pass.
## Findings
- The fix adds a second path check for `.automaton/tasks/{task_name}/...` alongside the existing `tasks/{task_name}/...` check.
- Bug Finder found no bugs. Adversarial Bug Finder found no bugs.
- No contradictions between the two reports.
- Test coverage added: `TestCat3AuditRegularProjectPaths`.
- All 242 tests pass.
## Tasks for Review / Tie-Breaks
None.
## Remaining Issues
None.
## Score
+10 (PASS)
## Reviewer Comments