Makes the metadata format deterministic with project as a required field. Removes ~40 lines of inference/fallback logic for zero dead code. **1. Made project field required:** - types.ts: SessionMetadata.project is now required (not optional) - Moved to first position for clarity **2. Removed inference function:** - Deleted inferProjectId() (~20 lines) - Deleted escapeRegex() (no longer needed) - Removed longest-prefix matching logic - Removed regex pattern matching **3. Simplified metadataToSession():** - Before: projectId: meta["project"] || inferProjectId(sessionId, config) - After: projectId: meta["project"] - Removed config parameter (no longer needed) **4. Optimized list() filtering:** - Filter by raw["project"] BEFORE building session (more efficient) - No need to filter after metadataToSession() anymore **5. Removed fallback in merge route:** - Deleted single-project fallback logic (~5 lines) - Now fails fast with clear error if project is invalid **6. Fixed tests:** - Added project field to all test writeMetadata() calls - Tests now match required field constraint All 22 existing sessions manually updated with project=ao: - ao-1 through ao-21 - ao-sessions - ao-orchestrator (already had it) Lines removed: ~40 - inferProjectId(): ~20 lines - escapeRegex(): ~3 lines - Fallback logic: ~5 lines - Complex filter logic: ~3 lines - Documentation: ~10 lines Benefits: ✅ Zero inference/heuristic logic ✅ Single source of truth (metadata file) ✅ Fail fast with clear errors ✅ Simpler code, easier to understand ✅ More efficient (filter before building) ✅ No tech debt Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| e2e | ||
| screenshots | ||
| server | ||
| src | ||
| .env.local.example | ||
| .gitignore | ||
| next-env.d.ts | ||
| next.config.js | ||
| package.json | ||
| postcss.config.mjs | ||
| tsconfig.json | ||
| vitest.config.ts | ||