Files
TalkEdit/AI_dev_plan.md

158 lines
5.1 KiB
Markdown
Raw Permalink Normal View History

2026-04-15 17:13:56 -06:00
# AI Dev Plan (Must-Haves Only)
2026-04-15 16:36:21 -06:00
## Purpose
2026-04-15 17:13:56 -06:00
This is the minimum implementation needed for AI to reliably build, test, and debug TalkEdit with high confidence.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Target: reliable 80-90% autonomous implementation/debugging on scoped tasks.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## Must-Have Pillars
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## 1. Single Validation Command
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Required:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. One command that runs lint, build, backend tests, and smoke checks.
2. Works locally and in CI.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Current status:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Implemented via scripts/validate-all.sh.
2. Enforced in CI via .github/workflows/validate-all.yml.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## 2. CI Quality Gate
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Required:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Pull requests fail if validation fails.
2. Failures produce diagnostics artifacts.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Current status:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Implemented in .github/workflows/validate-all.yml.
2. Diagnostics collected by scripts/collect-diagnostics.sh on failure.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## 3. Spec Requirement for Feature Changes
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Required:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Feature code changes must include a spec file update.
2. Spec format must be standardized.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Current status:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Implemented via scripts/check-feature-spec.sh.
2. Spec template exists at docs/spec-template.md.
3. Specs folder guidance exists at docs/specs/README.md.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## 4. Backend Contract Test Coverage
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Required:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Router-level contract tests for success and error paths.
2. Tests are deterministic and mock heavy services.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Current status:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Implemented in backend/tests/test_router_contracts.py.
2. Cache utility baseline tests implemented in backend/tests/test_cache_utils.py.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## 5. Error-Tolerant Router Contracts
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Required:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Expected client errors must remain 4xx.
2. Server failures must return 5xx with useful detail.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Current status:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Implemented for captions/export HTTPException passthrough.
2. Covered by contract tests.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## 6. Basic Autonomy Policy
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Required:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Clear autonomous scope and escalation rules.
2. Clear restrictions for high-risk changes.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Current status:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Implemented in docs/ai-policy.md.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## Must-Have Remaining Work
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
No remaining must-have items.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Completed in this pass:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Added lightweight frontend tests and integrated them into scripts/validate-all.sh.
2. Added pull request template with required spec link and acceptance criteria checklist.
3. Added endpoint-level contract assertions for /file range requests and /audio/waveform cache-hit/cache-miss behavior.
4. Confirmed scripts/validate-all.sh passes end-to-end with frontend tests + expanded backend contracts.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## Out of Scope for Must-Have Baseline
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Useful later, but not required for strong day-to-day autonomous implementation:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Full quality dashboards.
2. Advanced autonomy telemetry.
3. Complete long-term governance expansion.
4. High-autonomy optimization beyond 90% reliability target.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## Definition of Done (Must-Have Plan)
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Must-have plan is complete when all are true:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. scripts/validate-all.sh passes locally and in CI.
2. Feature PRs without spec updates are blocked.
3. Backend router contracts cover core success and error paths.
4. Frontend has at least one stable test command integrated into validation.
2026-04-15 18:00:34 -06:00
## 7. AI Tools Validation Strategy
Required:
1. **Per-edit validation**: After each code change (file edit, replacement, or creation), validate immediately with appropriate tools.
2. **Tool selection by change type**:
- Frontend changes: ESLint (`npm run -s lint`), then TypeScript build (`npm run build`)
- Backend changes: Syntax check via Python import, then run relevant test suite
- Type/interface changes: Full type check via build or `tsc -b`
3. **Failure handling**: If validation fails, fix immediately before proceeding to next edit.
4. **Documentation updates**: When changing architecture, always update [.github/copilot-instructions.md](.github/copilot-instructions.md) as part of the same PR.
5. **Large multi-edit operations**: Use `multi_replace_string_in_file` to batch independent edits and reduce tool call overhead.
6. **Error collection**: Use `get_errors` tool to identify issues across multiple files in one call post-change.
Current implementation:
1. Electron removal completed with post-edit lint and build validation at each phase.
2. Zone editor feature implemented with immediate lint/build validation after component creation and UI integration.
3. Validation tools: `npm run -s lint`, `npm run build`, `get_errors`, `run_in_terminal` for test scripts.
Best practices established:
- Always run lint before build to catch TypeScript errors early
- Run full build after component changes to verify tree-shaking and bundling
- Use `get_errors` for multi-file error detection rather than sequential file reads
- Batch unrelated edits with `multi_replace_string_in_file` for efficiency
- Cache key decisions in session memory to avoid repeated exploration
2026-04-15 17:13:56 -06:00
5. AI policy + diagnostics workflow are active.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
## Current State Summary
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Completed:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. Validation and CI enforcement.
2. Diagnostics capture.
3. Spec policy and templates.
4. Backend contract test foundation (including AI endpoints).
5. Core router error-path correctness.
6. Autonomy policy baseline.
7. Frontend test command integrated into validation.
8. PR template requirement added.
9. /file and /audio/waveform contract assertions implemented.
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
Remaining:
2026-04-15 16:36:21 -06:00
2026-04-15 17:13:56 -06:00
1. No must-have items remaining.