Repository navigation
Description
Problem
A plan is an ordered array of items. The only relation between items is array order, items have no stable server-side id, and plan_issues has no column that says which plan item a row came from. There is nowhere to say "this issue needs that one first" (#3385).
Goal
Plan items carry a stable id and an optional dependsOn list of other item ids. Both survive every path that rewrites a plan, and publication resolves them to issue numbers stored with the plan issues.
Acceptance criteria
- A plan item may carry
dependsOn: string[]naming theids of other items in the same plan. The MCPcreate_plan/update_planschema, the REST draft update and the Planner Studio types accept it. - Every item has a unique, stable
id. Items that arrive without one (planner output, older drafts) get one assigned server-side when the plan is stored; an existing id is never changed. Duplicate ids are rejected. - Validation rejects, with a clear error naming the item: a
dependsOnentry that matches no item, a self-reference, and a cycle. The same validation runs for MCP and REST (the REST draft update currently storesplan_jsonunvalidated). idanddependsOnsurvive refinement (edit operations and full-plan responses), the single-granularity merge, plan revisions and restore, and reordering in the UI.- The planner may emit
dependsOn(by item id) when one task needs another's code; the planner and refiner prompts, the file-mode task format and the in-workspace validator accept the optional field. A plan with nodependsOnanywhere is still valid and is the default. - At publication (both the REST finalize path and MCP
publish_plan) eachplan_issuesrow records its plan item id and its prerequisites as issue numbers. Re-publication and resume produce the same rows. Existing rows read as "no prerequisites". get_planand the REST plan-issues response return each issue's item id and prerequisite issue numbers.- Nothing is scheduled differently yet: the epic queue ignores the new data in this issue.
- Tests cover validation (unknown id, self, cycle, duplicate id), id assignment, preservation through each rewrite path listed above, both publication paths, and the migration on a database with existing rows.
Out of scope
- GitHub "blocked by" links (next issue) and any scheduling change (later issues).
- Editing dependencies in the Planner Studio UI beyond keeping them intact; a read-only display is enough.
Implementation
Key files: packages/core/src/claude/prompts/plannerPrompts.ts (PlanItem, planner Output Format, refiner rule "Maintain the schema"), packages/core/src/services/githubIssueService.ts (PlanTask), packages/api/mcp/toolsPlanning.ts (planTask zod is .strict(), plan max 20, validatePublicationPlan, publish_plan recordIssue raw insert into plan_issues and the final plan_json write), packages/api/routes/plannerRoutes.ts (updateDraft stringifies plan_json unvalidated), packages/api/routes/plannerHelpers/validation.ts, packages/core/src/services/taskPlanning/planFileGeneration.ts (buildPlanFilePrompt), planValidation.ts (REQUIRED, PLAN_VALIDATOR_SCRIPT), refinementOutput.ts (normalizeRefinedPlan), granularity.ts, packages/core/src/services/taskExecutionService.ts (executeDraft writes issue numbers back), packages/core/src/config/planIssueManager.ts (PlanIssue, createPlanIssue), packages/api/routes/plannerHelpers/planRevisions.ts, propr-ui/src/api/plannerTypes.ts, propr-ui/src/hooks/usePlanRefinement.ts (ensureTaskIds generates and renames ids client-side; reorderTasks), propr-ui/src/api/planIssuesApi.ts.
Put the validation (unique ids, known references, cycle detection) in one pure function in packages/shared and call it from MCP and REST. Migration: new file in packages/core/src/db/migrations/ named YYYYMMDDHHMMSS_snake_case.js adding the columns to plan_issues with hasColumn guards; do not rebuild task_drafts (it carries triggers that a table rebuild drops).
Tests to follow: packages/api/test/mcpPublishPlan.test.ts (full migrate.latest setup), packages/api/test/mcpRequestBounds.test.ts, packages/api/test/planRevisions.test.ts, test/planValidation.test.ts, test/refinementCompletePlan.test.ts, propr-ui/src/hooks/usePlanRefinement.test.tsx. Update docs/mcp.md and the planning docs. Verify with npm run test:prepare, npm run typecheck, the changed test files via node scripts/run-test-suite.mjs, and eslint --max-warnings 0 in each touched package.
Activity
propr-dev commentedon Nov 12, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-5-53470/claude-opus-5-5-add-stable-item-ids-and-d-20261112-1213-okq3470-epic-scheduler-primitives-nrjissue-3470-20261112-1213-claude-opus-5-5-okq🔍 Track Task Execution