44 lines
3.7 KiB
Markdown
44 lines
3.7 KiB
Markdown
# CODE_REVIEW: add-goal-mode
|
|||
|
|
|
||
|
|
Reviewed against SPEC.md R1-R8.
|
||
|
|
|
||
|
|
## R1-R8 checklist
|
||
|
|
|
||
|
|
| Req | Status | Notes |
|
||
|
|
|-----|--------|-------|
|
||
|
|
| R1 find_work dispatch | PASS | `_find_work` dispatches on `work_source.kind`; missing/unknown falls back to `single` with WARNING |
|
||
|
|
| R2 audit work_source | PASS | `_find_work_audit` calls `--audit --json`, sorts by severity, creates task via `--create-task` when no task field |
|
||
|
|
| R3 backlog work_source | PASS | `_find_work_backlog` reads `design/<area>/BACKLOG.md`, picks top `- [ ]`, slugifies bold heading |
|
||
|
|
| R4 verifier tokens | PASS | `{task_brief}`, `{acceptance_criteria}`, `{next_hint}` in extras; substituted via `_substitute` |
|
||
|
|
| R5 truncate_tokens | PASS | 4 chars/token heuristic; marker appended; caps at 4000/2000/1000 |
|
||
|
|
| R6 next_hint loop | PASS | `_next_hint_text` reads `last_verdict.next_hint`; empty on first tick; fed into implement and verify |
|
||
|
|
| R7 loop.json schema | PASS | ci-triage template has explicit `work_source` + `acceptance_criteria`; technical.md updated |
|
||
|
|
| R8 audit --json | PASS | `cmd_audit` emits JSON line with violations/loops/total_tasks/untracked_tasks |
|
||
|
|
|
||
|
|
## Edge cases checked
|
||
|
|
|
||
|
|
1. **Missing `work_source` field** -- falls back to `single` with no WARNING (only unknown kinds warn). Backward compat with ci-triage template preserved. PASS
|
||
|
|
2. **Unknown `work_source.kind`** -- WARNING logged, falls back to `single`. PASS
|
||
|
|
3. **Audit with no violations** -- returns `None` from `_find_work_audit`; skip reason `no_work`; does not increment iteration_count. PASS
|
||
|
|
4. **Audit violation with null task** -- slugifies message, calls `--create-task`, returns slug. PASS
|
||
|
|
5. **Audit violation with existing task** -- returns task name directly, no create-task call. PASS
|
||
|
|
6. **Backlog with all items checked** -- returns `None`; skip `no_work`. PASS
|
||
|
|
7. **Backlog with no bold marker** -- falls back to `_slugify(line_body)`. PASS
|
||
|
|
8. **Empty task_brief / acceptance_criteria / next_hint** -- `_truncate_tokens("")` returns `""`; substitution replaces with empty string; no KeyError. PASS
|
||
|
|
9. **`last_verdict` is None** -- `_next_hint_text` checks `isinstance(last, dict)`; returns `""`. PASS
|
||
|
|
10. **`--audit --json` with no violations** -- emits `{"violations":[], ...}`; runner sees empty list, skips. PASS
|
||
|
|
11. **`--audit --json` output pickable by `_run_json`** -- single JSON line on stdout; `_run_json` takes `splitlines()[-1]`. PASS
|
||
|
|
|
||
|
|
## Code-quality observations
|
||
|
|
|
||
|
|
1. **`_find_work_audit` subprocess timeout=15 for `--create-task`** -- reasonable; if create-task hangs, the runner swallows it and returns the slug anyway. The task dir may not exist yet, but the orchestrator will handle it on the next tick. Acceptable for v1.
|
||
|
|
2. **`_slugify` used for both audit and backlog** -- consistent slug derivation. The regex `[^A-Za-z0-9._-]+` -> `-` is reasonable.
|
||
|
|
3. **`_task_dir_for` duplicates `status.py` `_task_dir` logic** -- documented as intentional (no cross-script imports per technical.md). If the task dir layout changes, both need updating. Acceptable for v1.
|
||
|
|
4. **Token substitution only works if harness command contains the placeholder** -- the default command `["opencode", "run", "--prompt-file", "{prompt}", "--cwd", "{cwd}"]` does not include `{task_brief}` etc. Custom harness configs must add them explicitly. This is by design (SPEC R4: "tokens absent from the prompt stay literal").
|
||
|
|
5. **`_acceptance_criteria_text` handles both string and list** -- list joined with newlines. If the value is a dict or other type, `str(raw)` is called. Defensive enough.
|
||
|
|
6. **`_find_work_backlog` reads from `design/<area>/BACKLOG.md`** -- uses `project_dir == AUTOMATON_DIR` check to pick framework vs project path. Consistent with `_task_dir_for` pattern.
|
||
|
|
|
||
|
|
## Verdict
|
||
|
|
|
||
|
|
APPROVE. Ready for bug_find.
|