Files
stack/docs/scratchpads/769-kbn100-schema-migration.md
2026-07-14 16:59:23 -05:00

2.7 KiB

Issue #769 — KBN-100 unified schema and N-1 migration

Status

IN PROGRESS — tracking and baseline gate. No schema or migration implementation is authorized until this scratchpad and docs/native-kanban-sot/TASKS.md are committed/pushed and baseline evidence is recorded.

Requirement authority

  • Provider issue: https://git.mosaicstack.dev/mosaicstack/stack/issues/769
  • Canonical requirements: docs/requirements/native-kanban-sot.md
  • Frozen integration contract: docs/native-kanban-sot/SHARED-CONTRACT.md v1.0.0-rc.4
  • Frozen target schema: docs/native-kanban-sot/contracts/kanban-schema.v1.ts
  • Threat/auth/constraint gate: docs/native-kanban-sot/KBN-010-THREAT-AUTH-CONSTRAINT-GATE.md
  • Dependency evidence: PR #765 merge 2e228007, issue #753 closed, post-main pipeline #1813 terminal success.

Fixed decisions

  1. PostgreSQL is the sole writable project/task/orchestration SOT; generated projections and external transports are never import/write authority.
  2. Expand is additive and N-1-safe. Do not drop, rename, narrow, or reinterpret legacy data during this card.
  3. Backfill is bounded, idempotent, resumable, checksummed, and quarantines ambiguity rather than guessing.
  4. rc.4 SI-001 creates missions_workspace_id_uidx(workspace_id,id) before both dependent artifact/approval FKs while retaining global and project-congruent keys.
  5. Runtime repositories, Gateway/MCP, Coordinator behavior, clients, fleet, channels, connector fencing, deployment, and production migration execution are out of scope.
  6. Critical schema/data behavior uses TDD RED/GREEN and real PostgreSQL integration evidence; PGlite-only evidence cannot certify the migration.

Authorized paths

  • packages/db/src/schema.ts
  • packages/db/drizzle/**
  • DB-package tests/config files explicitly enumerated by the author before first edit
  • docs/native-kanban-sot/TASKS.md
  • this scratchpad

Any additional path requires control-plane approval before edit.

Delivery cycle

baseline -> test design/RED -> schema+migration GREEN -> focused tests -> real PostgreSQL migration matrix -> full gates -> independent DB review -> SecReview -> remediate/rereview -> Codex-Ultron -> PR CI -> squash merge -> post-main CI -> issue close

Baseline evidence

Pending fresh author-lane intake and baseline test run.

Collision boundaries

  • #758 owns generic local Fleet configuration/lifecycle cards.
  • #757/#755 owns logical-agent connector identity/lease/fencing.
  • #756 channel foundation is merged and remains separate.
  • KBN-105 and all KBN consumers remain held until #769 completes.

Completion evidence

Pending implementation, reviews, PR, merge, terminal-green main CI, and issue closure.