Parent Epic
Part of #52 — Sequential stacked PR chains
Summary
Add columns to the tasks table for task dependencies, chain grouping, stacked PR targeting, and upstream tracking. This is the data model that enables the chain command and cascade engine.
Context
Currently at schema v8. This bumps to v9 with four new nullable columns. All are additive (no breaking changes), handled by the existing migration system.
Changes
persistence.py
- Bump
SCHEMA_VERSION to 9
- Add to
SCHEMA (CREATE TABLE):
parent_task_id TEXT — FK to tasks.id, the task this one depends on (NULL = no parent)
epic_id TEXT — groups tasks into a chain (NULL = standalone task)
base_branch TEXT — PR target branch (NULL = use repo default branch)
upstream_sha TEXT — last-known HEAD SHA of the upstream branch when task started
- Add migration entries to
_MIGRATIONS:
(9, "tasks", "parent_task_id", "TEXT")
(9, "tasks", "epic_id", "TEXT")
(9, "tasks", "base_branch", "TEXT")
(9, "tasks", "upstream_sha", "TEXT")
- Add all four to
_TASK_COLUMNS frozenset
- Add query helpers:
get_chain_tasks(epic_id) — SELECT tasks WHERE epic_id = ? ORDER BY created_at
get_dependent_tasks(task_id) — SELECT tasks WHERE parent_task_id = ?
get_parent_task(task_id) — get task record for the parent, if any
- Update
create_task() to accept optional parent_task_id, epic_id, base_branch
Depends On
Nothing — pure schema change, can be done first.
Testing
- Create tasks with parent_task_id →
get_parent_task() returns correct parent
- Create tasks with epic_id →
get_chain_tasks() returns all in order
get_dependent_tasks() returns correct dependents
- Migration from v8 → v9 adds all four columns
- NULL values work (backward compatible with existing tasks)
update_task() can set/update base_branch and upstream_sha
- Update
test_migration_from_pre_versioned_db to assert new columns
Parent Epic
Part of #52 — Sequential stacked PR chains
Summary
Add columns to the tasks table for task dependencies, chain grouping, stacked PR targeting, and upstream tracking. This is the data model that enables the chain command and cascade engine.
Context
Currently at schema v8. This bumps to v9 with four new nullable columns. All are additive (no breaking changes), handled by the existing migration system.
Changes
persistence.pySCHEMA_VERSIONto 9SCHEMA(CREATE TABLE):parent_task_id TEXT— FK to tasks.id, the task this one depends on (NULL = no parent)epic_id TEXT— groups tasks into a chain (NULL = standalone task)base_branch TEXT— PR target branch (NULL = use repo default branch)upstream_sha TEXT— last-known HEAD SHA of the upstream branch when task started_MIGRATIONS:(9, "tasks", "parent_task_id", "TEXT")(9, "tasks", "epic_id", "TEXT")(9, "tasks", "base_branch", "TEXT")(9, "tasks", "upstream_sha", "TEXT")_TASK_COLUMNSfrozensetget_chain_tasks(epic_id)— SELECT tasks WHERE epic_id = ? ORDER BY created_atget_dependent_tasks(task_id)— SELECT tasks WHERE parent_task_id = ?get_parent_task(task_id)— get task record for the parent, if anycreate_task()to accept optionalparent_task_id,epic_id,base_branchDepends On
Nothing — pure schema change, can be done first.
Testing
get_parent_task()returns correct parentget_chain_tasks()returns all in orderget_dependent_tasks()returns correct dependentsupdate_task()can set/update base_branch and upstream_shatest_migration_from_pre_versioned_dbto assert new columns