Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
39e1dd4
docs: start milestone v0.17.0 Per-Prompt LLM Configuration
therealbrad Mar 21, 2026
1f3a262
docs: define milestone v0.17.0 requirements
therealbrad Mar 21, 2026
8ebcca5
docs: create milestone v0.17.0 roadmap (6 phases)
therealbrad Mar 21, 2026
a71045d
docs(34): smart discuss context
therealbrad Mar 21, 2026
e030a7e
docs(34-schema-and-migration): create phase plan
therealbrad Mar 21, 2026
1f29e62
docs(34): plan phase 34 — schema and migration
therealbrad Mar 21, 2026
d893669
feat(34-01): add llmIntegrationId and modelOverride fields to PromptC…
therealbrad Mar 21, 2026
ce97468
feat(34-01): regenerate ZenStack/Prisma artifacts with new PromptConf…
therealbrad Mar 21, 2026
94c54c8
docs(phase-34): complete phase execution
therealbrad Mar 21, 2026
55dff94
docs(35): smart discuss context
therealbrad Mar 21, 2026
e1e5606
docs(35-resolution-chain): create phase plan
therealbrad Mar 21, 2026
b25d9c1
docs(35): plan phase 35 — resolution chain
therealbrad Mar 21, 2026
de2b379
feat(35-01): extend PromptResolver and add LlmManager.resolveIntegration
therealbrad Mar 21, 2026
65bedb4
feat(35-01): update all call sites to use resolveIntegration chain
therealbrad Mar 21, 2026
b9ece5d
docs(35-01): complete resolution-chain plan — 3-tier LLM integration …
therealbrad Mar 21, 2026
3c45926
docs(phase-35): complete phase execution
therealbrad Mar 21, 2026
cb74be2
docs(36,37): smart discuss context for admin UI and project overrides
therealbrad Mar 21, 2026
910aa26
docs(37-project-ai-models-overrides): create phase plan
therealbrad Mar 21, 2026
eb3ef7b
docs(36-admin-prompt-editor-llm-selector): create phase plan
therealbrad Mar 21, 2026
1819fed
docs(36,37): plan phases 36 and 37 — admin UI and project overrides
therealbrad Mar 21, 2026
79e8e78
feat(36-01): add LLM integration and model override selectors to Prom…
therealbrad Mar 21, 2026
d84e3b8
feat(36-02): add mixed-integration indicator column to prompt config …
therealbrad Mar 21, 2026
65b8a5a
feat(36-01): wire llmIntegrationId and modelOverride into Add and Edi…
therealbrad Mar 21, 2026
2a0f8dc
feat(37-01): integrate FeatureOverrides into AI Models settings page
therealbrad Mar 21, 2026
6f34868
docs(36-02): complete mixed-integration indicator column plan
therealbrad Mar 21, 2026
601a9cc
docs(36-01): complete admin prompt editor LLM selector plan
therealbrad Mar 21, 2026
380616b
docs(37-01): complete per-feature LLM overrides plan — FeatureOverrid…
therealbrad Mar 21, 2026
b07fb90
docs(phase-36,37): complete phase execution
therealbrad Mar 21, 2026
14a7d1d
docs(38): smart discuss context
therealbrad Mar 21, 2026
e96d6cd
docs(38): create phase plan
therealbrad Mar 21, 2026
6847b95
docs(38): plan phase 38 — export/import and testing
therealbrad Mar 21, 2026
125a83f
test(38-02): add resolveIntegration unit tests for 3-tier resolution …
therealbrad Mar 21, 2026
0df3392
feat(38-01): create prompt config export API route
therealbrad Mar 21, 2026
51e56ee
docs(38-02): complete resolveIntegration unit tests plan
therealbrad Mar 21, 2026
88cbec5
feat(38-01): create prompt config import API route
therealbrad Mar 21, 2026
ac3895e
docs(38-01): complete prompt config export/import plan
therealbrad Mar 21, 2026
0f9d7b3
feat(38-03): add E2E tests for admin prompt editor LLM selector
therealbrad Mar 21, 2026
ba031c7
feat(38-03): add E2E tests for project AI Models per-feature overrides
therealbrad Mar 21, 2026
cfc1fff
docs(38-03): complete prompt LLM selector and AI models overrides E2E…
therealbrad Mar 21, 2026
d8ec193
docs(phase-38): complete phase execution
therealbrad Mar 21, 2026
0b7424b
docs(39): smart discuss context
therealbrad Mar 21, 2026
9db51f9
docs(39-documentation): create phase plan
therealbrad Mar 21, 2026
ad3bc36
docs(39): plan phase 39 — documentation
therealbrad Mar 21, 2026
e0e20d7
docs(39-01): add per-prompt LLM assignment section to prompt-configur…
therealbrad Mar 21, 2026
a9d3aab
docs(39-01): add per-feature overrides and resolution chain to llm-in…
therealbrad Mar 21, 2026
912ed4e
docs(39-01): complete documentation plan — update planning state and …
therealbrad Mar 21, 2026
09a369b
docs(phase-39): complete phase execution — all phases done
therealbrad Mar 21, 2026
ce7006f
Update build artifacts
therealbrad Mar 22, 2026
c8f3267
Merge remote-tracking branch 'origin/v0.17.0' into feature/per-prompt…
therealbrad Mar 22, 2026
9fbd9cf
feat: show LLM integration name in prompt feature accordion title
therealbrad Mar 22, 2026
a2fc1e8
feat: show 'Project Default' in accordion title when no LLM assigned
therealbrad Mar 22, 2026
1206f3c
fix: resolve lint errors — jsx literals, unused vars
therealbrad Mar 22, 2026
472570b
fix: remove unused baseURL from E2E test destructuring
therealbrad Mar 22, 2026
1e98e79
fix: remove duplicate useCountProjects mock in Cases.test.tsx
therealbrad Mar 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .planning/REQUIREMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Requirements: TestPlanIt

**Defined:** 2026-03-21
**Core Value:** Teams can plan, execute, and track testing across manual and automated workflows in one place — with AI assistance to reduce repetitive work.

## v0.17.0 Requirements

Requirements for per-prompt LLM configuration (issue #128). Each maps to roadmap phases.

### Schema

- [x] **SCHEMA-01**: PromptConfigPrompt supports an optional `llmIntegrationId` foreign key to LlmIntegration
- [x] **SCHEMA-02**: PromptConfigPrompt supports an optional `modelOverride` string field
- [x] **SCHEMA-03**: Database migration adds both fields with proper FK constraint and index

### Prompt Resolution

- [x] **RESOLVE-01**: PromptResolver returns per-prompt LLM integration ID and model override when set
- [x] **RESOLVE-02**: When no per-prompt LLM is set, system falls back to project default integration (existing behavior preserved)
- [x] **RESOLVE-03**: Resolution chain enforced: project LlmFeatureConfig > PromptConfigPrompt assignment > project default integration

### Admin UI

- [x] **ADMIN-01**: Admin prompt editor shows per-feature LLM integration selector dropdown alongside existing prompt fields
- [x] **ADMIN-02**: Admin prompt editor shows per-feature model override selector (models from selected integration)
- [x] **ADMIN-03**: Prompt config list/table shows summary indicator when prompts use mixed LLM integrations

### Project Settings UI

- [x] **PROJ-01**: Project AI Models page allows project admins to override per-prompt LLM assignments per feature via LlmFeatureConfig
- [x] **PROJ-02**: Project AI Models page displays the effective resolution chain per feature (which LLM will actually be used and why)

### Export/Import

- [x] **EXPORT-01**: Per-prompt LLM assignments (integration reference + model override) are included in prompt config export/import

### Compatibility

- [x] **COMPAT-01**: Existing projects and prompt configs without per-prompt LLM assignments continue to work without changes

### Testing

- [x] **TEST-01**: Unit tests cover PromptResolver 3-tier resolution chain (per-prompt, project override, project default fallback)
- [x] **TEST-02**: Unit tests cover LlmFeatureConfig override behavior
- [x] **TEST-03**: E2E tests cover admin prompt editor LLM integration selector workflow
- [x] **TEST-04**: E2E tests cover project AI Models per-feature override workflow

### Documentation

- [x] **DOCS-01**: User-facing documentation for configuring per-prompt LLM integrations in admin prompt editor
- [x] **DOCS-02**: User-facing documentation for project-level per-feature LLM overrides on AI Models settings page

## Future Requirements

None — issue #128 is fully scoped above.

## Out of Scope

| Feature | Reason |
|---------|--------|
| Named LLM "roles" (high_quality, fast, balanced) | Over-engineered for current needs — issue #128 Alternative Option 2, could layer on top later |
| Per-prompt temperature/maxTokens override at project level | LlmFeatureConfig already has these fields; wiring them is separate work |
| Shared cross-project test case library | Larger architectural change, out of scope per issue #79 |

## Traceability

Which phases cover which requirements. Updated during roadmap creation.

| Requirement | Phase | Status |
|-------------|-------|--------|
| SCHEMA-01 | Phase 34 | Complete |
| SCHEMA-02 | Phase 34 | Complete |
| SCHEMA-03 | Phase 34 | Complete |
| RESOLVE-01 | Phase 35 | Complete |
| RESOLVE-02 | Phase 35 | Complete |
| RESOLVE-03 | Phase 35 | Complete |
| COMPAT-01 | Phase 35 | Complete |
| ADMIN-01 | Phase 36 | Complete |
| ADMIN-02 | Phase 36 | Complete |
| ADMIN-03 | Phase 36 | Complete |
| PROJ-01 | Phase 37 | Complete |
| PROJ-02 | Phase 37 | Complete |
| EXPORT-01 | Phase 38 | Complete |
| TEST-01 | Phase 38 | Complete |
| TEST-02 | Phase 38 | Complete |
| TEST-03 | Phase 38 | Complete |
| TEST-04 | Phase 38 | Complete |
| DOCS-01 | Phase 39 | Complete |
| DOCS-02 | Phase 39 | Complete |

**Coverage:**
- v0.17.0 requirements: 19 total
- Mapped to phases: 19
- Unmapped: 0 ✓

---
*Requirements defined: 2026-03-21*
*Last updated: 2026-03-21 after initial definition*
495 changes: 464 additions & 31 deletions .planning/ROADMAP.md

Large diffs are not rendered by default.

110 changes: 24 additions & 86 deletions .planning/STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ gsd_state_version: 1.0
milestone: v2.0
milestone_name: Comprehensive Test Coverage
status: completed
stopped_at: Completed 33-02-PLAN.md (Phase 33 Plan 02 — folder copy/move UI entry point)
last_updated: "2026-03-21T17:18:20.987Z"
last_activity: 2026-03-21 — All v2.0 phases confirmed complete
last_updated: "2026-03-21T21:17:59.641Z"
last_activity: "2026-03-21 — Completed 39-01: per-prompt LLM and per-feature override documentation"
progress:
total_phases: 25
completed_phases: 23
total_plans: 59
completed_plans: 62
percent: 100
total_plans: 56
completed_plans: 59
---

# State
Expand All @@ -21,100 +19,40 @@ progress:
See: .planning/PROJECT.md (updated 2026-03-21)

**Core value:** Teams can plan, execute, and track testing across manual and automated workflows in one place — with AI assistance to reduce repetitive work.
**Current focus:** v2.0 Comprehensive Test Coverage — All phases complete, running lifecycle
**Current focus:** v0.17.0 Per-Prompt LLM Configuration

## Current Position

Phase: 24 of 24 (all complete)
Plan: All complete
Status: Running milestone lifecycle (audit → complete → cleanup)
Last activity: 2026-03-21 — All v2.0 phases confirmed complete

Progress: [██████████] 100% (v2.0 phases — 16 of 16 complete)

## Performance Metrics

**Velocity:**

- Total plans completed (v0.17.0): 3
- Average duration: ~6m
- Total execution time: ~18m

**By Phase:**

| Phase | Plans | Total | Avg/Plan |
|-------|-------|-------|----------|
| 28 | 2 | ~12m | ~6m |
| 29 | 1 | ~6m | ~6m |
| Phase 29 P03 | 7m | 2 tasks | 3 files |
| Phase 30-dialog-ui-and-polling P01 | 8 | 2 tasks | 7 files |
| Phase 31-entry-points P01 | 12 | 2 tasks | 5 files |
| Phase 32-testing-and-documentation P02 | 1 | 1 tasks | 1 files |
| Phase 32-testing-and-documentation P01 | 5 | 2 tasks | 1 files |
| Phase 33-folder-tree-copy-move P01 | 12 | 2 tasks | 4 files |
| Phase 33-folder-tree-copy-move P02 | 15 | 2 tasks | 7 files |
Phase: 39 of 39 (Documentation)
Plan: 39-01 complete
Status: Complete — all phases and plans done
Last activity: 2026-03-21 — Completed 39-01: per-prompt LLM and per-feature override documentation

## Accumulated Context

### Decisions

- Build order: worker (Phase 28) → API (Phase 29) → dialog UI (Phase 30) → entry points (Phase 31) → testing/docs (Phase 32)
(Carried from previous milestone)

- Worker uses raw `prisma` (not `enhance()`); ZenStack access control gated once at API entry only
- `concurrency: 1` on BullMQ worker to prevent ZenStack v3 deadlocks (40P01)
- `attempts: 1` on queue — partial retries on copy/move create duplicates; surface failures cleanly
- Shared step groups recreated as proper SharedStepGroups in target (not flattened); in-memory deduplication Map across cases
- Move: all RepositoryCaseVersions rows re-created with `repositoryCaseId = newCase.id` and `projectId` updated to target
- Copy: version 1 only, fresh history via createTestCaseVersionInTransaction
- Field option IDs re-resolved by option name when source/target templates differ; values dropped if no match
- folderMaxOrder pre-fetched before the per-case loop to avoid race condition (not inside transaction)
- Unique constraint errors detected via string-matching err.info?.message for "duplicate key" (not err.code === "P2002")
- Cross-project case links (RepositoryCaseLink) dropped silently; droppedLinkCount reported in job result
- Version history and template field options fetched separately to avoid PostgreSQL 63-char alias limit (ZenStack v3)
- mockPrisma.$transaction.mockReset() required in test beforeEach — mockClear() does not reset mockImplementation, causing rollback tests to pollute subsequent tests
- Tests mock templateCaseAssignment + caseFieldAssignment separately to match worker's two-step field option fetch pattern
- conflictResolution limited to skip/rename at API layer (overwrite not accepted despite worker support)
- canAutoAssignTemplates true for both ADMIN and PROJECTADMIN access levels
- Source workflow state names fetched from source project WorkflowAssignment (not a separate states query)
- Cancel key prefix `copy-move:cancel:` (not `auto-tag:cancel:`) — must match copyMoveWorker.ts cancelKey() exactly
- Active job cancellation uses Redis flag (not job.remove()) to allow graceful per-case boundary stops
- [Phase 29]: conflictResolution limited to skip/rename at API layer (overwrite rejected by Zod schema, not exposed to worker)
- [Phase 29]: Auto-assign template failures wrapped in per-template try/catch — graceful for project admins lacking project access
- [Phase 30-01]: No localStorage persistence in useCopyMoveJob — dialog is ephemeral, no recovery needed
- [Phase 30-01]: Progress type uses {processed, total} matching worker's job.updateProgress() shape (not {analyzed, total})
- [Phase 30-01]: Notification try/catch in copyMoveWorker: failure logged but does not fail the job
- [Phase 31-entry-points]: handleCopyMove placed before columns useMemo to avoid block-scoped variable used before declaration
- [Phase 31-entry-points]: BulkEditModal closes before CopyMoveDialog opens to prevent nested dialogs
- [Phase 32-02]: sidebar_position: 11 for copy-move docs (follows import-export.md at position 10)
- [Phase 32-02]: No screenshots in v0.17.0 copy-move docs — text is sufficient per plan discretion
- [Phase 32-01]: Data verification tests skip when queue unavailable (503) to avoid false failures in CI without Redis — intentional test resilience
- [Phase 32-01]: pollUntilDone helper polls status endpoint at 500ms intervals (up to 30 attempts) before throwing timeout
- [Phase 33-01]: FolderTreeNode uses localKey (string) as stable client key; BFS-ordered array trusted from client; merge behavior reuses existing same-name folder silently
- [Phase 33-02]: TreeView and Cases are siblings in ProjectRepository — folder copy/move state lifted to ProjectRepository, passed as props to both components
- [Phase 33-02]: onCopyMoveFolder prop guarded by canAddEdit in ProjectRepository — only shown to users with edit permission
- [Phase 33-02]: effectiveCaseIds replaces selectedCaseIds everywhere in CopyMoveDialog when in folder mode (preflight, submit, progress count)

### Roadmap Evolution

- Phase 33 added: Folder Tree Copy/Move — support copying/moving entire folder hierarchies with their content
- [Phase 34-schema-and-migration]: No onDelete:Cascade on PromptConfigPrompt.llmIntegration relation — deleting LLM integration sets llmIntegrationId to NULL, preserving prompts
- [Phase 34-schema-and-migration]: Index added on PromptConfigPrompt.llmIntegrationId following LlmFeatureConfig established pattern
- [Phase 35-resolution-chain]: Prompt resolver called before resolveIntegration so per-prompt LLM fields are available to the 3-tier chain
- [Phase 35-resolution-chain]: Explicit-integration endpoints (chat, test, admin chat) unchanged - client-specified integration takes precedence over server-side resolution chain
- [Phase 36-admin-prompt-editor-llm-selector]: llmIntegrations column uses Map<id,name> to collect unique integrations across prompts, renders three states: Project Default (size 0), single badge (size 1), N LLMs badge (size N)
- [Phase 36-01]: __clear__ sentinel used in Select to represent null since shadcn Select cannot natively represent null values; clearing integration also clears modelOverride
- [Phase 37-project-ai-models-overrides]: FeatureOverrides component fetches its own LlmFeatureConfig and PromptConfigPrompt data — page.tsx passes only integrations and projectDefaultIntegration as props
- [Phase 38-02]: Use createForWorker (not getInstance) for resolveIntegration tests to avoid singleton state bleed between tests
- [Phase 38-export-import-and-testing]: [Phase 38-01]: Export uses llmIntegrationName (human-readable) not raw ID for portability; import resolves names against active integrations only, sets null with unresolvedIntegrations reporting on miss
- [Phase 38-03]: Use api.createProject() for projectId in AI models tests; projectId fixture defaults to 1 which does not exist in E2E database
- [Phase 38-03]: __clear__ sentinel in LLM Integration select renders as 'Project Default (clear)' per en-US translation, not 'Project Default'
- [Phase 39-01]: Documentation updated in-place on existing pages — no new sidebar entries or pages needed; resolution chain section uses explicit anchor for cross-referencing

### Pending Todos

None yet.

### Quick Tasks Completed

| # | Description | Date | Commit | Directory |
|---|-------------|------|--------|-----------|
| 260321-fk3 | Fix #143 — add audit logging to workers | 2026-03-21 | 60e17043 | [260321-fk3](./quick/260321-fk3-fix-issue-143-add-audit-logging-to-worke/) |

### Blockers/Concerns

- [Phase 29] Verify `@@allow` delete semantics on RepositoryCases in schema.zmodel before implementing move permission check
- [Phase 29] Verify TemplateProjectAssignment access rules permit admin auto-assign via enhance(db, { user }) without elevated-privilege client
- [Phase 28] Verify RepositoryCaseVersions cascade behavior on source delete does not fire before copy completes inside transaction

## Session Continuity

Last session: 2026-03-21T03:31:04.647Z
Stopped at: Completed 33-02-PLAN.md (Phase 33 Plan 02 — folder copy/move UI entry point)
Resume file: None
None yet.
Loading