review r1 fixes: correct head SHA, exhaustive diff enumeration, ownership scope, migration lanes, origin/main measurement, inventory precision
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
fred
2026-08-29 15:50:37 -05:00
parent 29c898fe62
commit 6630bf9d9b
@@ -18,14 +18,22 @@ wins.
## 1. Currency verification (measured) ## 1. Currency verification (measured)
- Map pin: `e72388b2cbfe400842fe940fa6cabf984ed43711` (2026-07-13, `main`). - Map pin: `e72388b2cbfe400842fe940fa6cabf984ed43711` (2026-07-13, `main`).
- Lane-opening head: `abb0c93601e878035557a34e142c73e91c68d363` (`origin/next`, - Lane-opening head: `abb0c936011c7f6b8c0bcc90a20a865d5e8a40e9` (`origin/next`,
2026-08-29). 2026-08-29).
- Measurement: `git diff e72388b2 abb0c936 -- packages/db/src/schema.ts` reports - Measurement: `git diff e72388b2 abb0c936 -- packages/db/src/schema.ts` reports
**300 insertions, 0 deletions, 0 modifications**. **300 insertions, 0 deletions** — no existing declaration changed.
- The insertions are exclusively new declarations, none of them mapped sources: - The additions: the new declarations `logicalAgentConnectorLeases`,
`logicalAgentConnectorLeases`, `connectorLeaseAuditLog`, and the hierarchy layer `connectorLeaseAuditLog`, and the hierarchy layer (`companies`, `estates`,
(`companies`, `estates`, `platformProjects`, `workspaces`, `hierarchyGrants`, `platformProjects`, `workspaces`, `hierarchyGrants`, `hierarchyAuditEvents`,
`hierarchyAuditEvents`, `hierarchyOutbox`, plus their enums and constant arrays). `hierarchyOutbox`, plus their enums and constant arrays); a nullable `issuer`
column on the unmapped BetterAuth `accounts` table (shipped as
`drizzle/0017_accounts_issuer.sql`); and expanded `drizzle-orm` imports
(`sql`, `AnyPgColumn`, `unique`, `check`, `bigint`). None touch a mapped
source.
- Stronger literal fact: REQ-MIG-001's acceptance names `origin/main`. Measured
pin → `origin/main` (`7102ccb9`, 2026-08-13): **63 insertions, 0 deletions**
for `schema.ts`, and `origin/main` is an ancestor of `abb0c936`. The map is
therefore current at `origin/main` itself, and at the trunk head beyond it.
**Consequence:** every source column mapped in SHARED-CONTRACT.md §5.4 — **Consequence:** every source column mapped in SHARED-CONTRACT.md §5.4 —
`teams`/`team_members`, `projects`, `missions`, `tasks`, `mission_tasks`, `teams`/`team_members`, `projects`, `missions`, `tasks`, `mission_tasks`,
@@ -37,8 +45,10 @@ inspected. The field map is current as written. No row changes.
1. **The `workspaces` table exists.** The map predates contract 1's hierarchy 1. **The `workspaces` table exists.** The map predates contract 1's hierarchy
layer; its "bootstrap workspace" backfill step now has a shipped target: layer; its "bootstrap workspace" backfill step now has a shipped target:
`workspaces` (uuid PK, chained under platform projects per `workspaces` (uuid PK, chained under platform projects per
`docs/requirements/hierarchy-schema.md`, migration lane 0020). New `docs/requirements/hierarchy-schema.md`; hierarchy core in
`workspace_id` columns FK there. `drizzle/0018_clean_cobalt_man.sql`, audit/outbox in
`0019_volatile_killraven.sql`, visibility in
`0020_special_betty_brant.sql`). New `workspace_id` columns FK there.
2. **The audit/outbox envelope pattern is shipped.** `hierarchyAuditEvents` + 2. **The audit/outbox envelope pattern is shipped.** `hierarchyAuditEvents` +
`hierarchyOutbox` implement same-transaction semantic event + outbox. The `hierarchyOutbox` implement same-transaction semantic event + outbox. The
task lane's `task_events`/`task_outbox` mirror the pattern but are task lane's `task_events`/`task_outbox` mirror the pattern but are
@@ -46,12 +56,16 @@ inspected. The field map is current as written. No row changes.
§5.3 and REQ-SOT-004. The hierarchy tables are a pattern reference, never a §5.3 and REQ-SOT-004. The hierarchy tables are a pattern reference, never a
shared store for task events. shared store for task events.
3. **Trunk designation.** The integration trunk is `next` (`.mosaic/repo.json`). 3. **Trunk designation.** The integration trunk is `next` (`.mosaic/repo.json`).
The map's `origin/main` references resolve to the trunk head pinned above. §1 measures currency at both the literal `origin/main` REQ-MIG-001 names and
4. **Seat roster succession.** SHARED-CONTRACT.md §6 assigns schema/migration the trunk head pinned above, so no reinterpretation of the acceptance text
ownership to the July mission seat `coder2`. That roster is superseded by the is needed.
current M4 delivery lane (webui-audit, M4-PLAN). The invariant §6 protects is 4. **Migration ownership.** SHARED-CONTRACT.md §6 assigns schema/migration
unchanged and binding: exactly one lane generates migrations; expand is ownership to the mission seat `coder2`. Seat identity is operational fleet
additive; no drop/rename/narrow; constraints validate before NOT NULL. state, not resolvable from this repository, and is outside this document's
scope. The invariant §6 protects binds regardless of seat and is restated
here as binding on the M4-3 schema lane: exactly one lane generates
migrations at a time; expand is additive; no drop/rename/narrow; constraints
validate before NOT NULL.
## 3. Pre-expand writer inventory (measured 2026-08-29 at `abb0c936`) ## 3. Pre-expand writer inventory (measured 2026-08-29 at `abb0c936`)
@@ -59,15 +73,22 @@ SHARED-CONTRACT.md §5.1 phase 1 requires an N-1 patch that stops
`mission_tasks.status` as a write source, plus a writer inventory, before any `mission_tasks.status` as a write source, plus a writer inventory, before any
expand DDL. expand DDL.
- **Sole write path:** `packages/brain/src/mission-tasks.ts` `create`/`update` - **Sole status write path:** `packages/brain/src/mission-tasks.ts`
(Drizzle insert/update on `mission_tasks`), invoked by `create`/`update` (Drizzle insert/update on `mission_tasks`), invoked by
`apps/gateway/src/missions/missions.controller.ts`. `update` accepts `apps/gateway/src/missions/missions.controller.ts`. `update` accepts
`Partial<NewMissionTask>`, so `status` is writable through both DTOs today. `Partial<NewMissionTask>`, so `status` is writable through both DTOs today.
- **Read-only consumers:** federation verb services The same module also exposes `remove`/`removeByMission` DELETE paths —
(`get-query.service.ts`, `list-query.service.ts`) and the MCP `brain_*` immaterial to `status` writes, listed for inventory completeness.
tools select only. - **Read-only consumers of `mission_tasks`:** federation verb services
- Ruling 5 freezes this surface for new consumers but does not stop existing (`get-query.service.ts`, `list-query.service.ts`) select only. The MCP
writes. `brain_*` tools do not touch `mission_tasks` at all; `brain_create_task` /
`brain_update_task` write the separately mapped `tasks` table, a legitimate
N-1 writer through the compatibility window.
- The ratified contract 5 decision
(`docs/requirements/tool-gateway-mapping.md` §3.2, ruled 2026-08-27) freezes
the legacy endpoints — including MCP `brain_*` task mutations — for new
consumers, while existing consumers keep working until each surface's owning
contract retires it. It does not stop existing writes.
**Standing work item:** the phase-1 stop-write patch (reject or ignore `status` **Standing work item:** the phase-1 stop-write patch (reject or ignore `status`
on `mission_tasks` create/update) MUST land before the expand DDL of migration on `mission_tasks` create/update) MUST land before the expand DDL of migration
@@ -82,5 +103,5 @@ for the M4-3 schema lane at pinned head `abb0c936`. The ordered phases (§5.1),
mission candidate-key DDL order (§5.2), audit/proposal DDL order (§5.3), field mission candidate-key DDL order (§5.2), audit/proposal DDL order (§5.3), field
map (§5.4), and required migration tests (§5.5) bind as written. External map (§5.4), and required migration tests (§5.5) bind as written. External
import machinery (jarvis-brain/Vikunja shadow import, REQ-MIG-001) and client import machinery (jarvis-brain/Vikunja shadow import, REQ-MIG-001) and client
cutover (REQ-MIG-002) remain out of scope for M4-3; legacy consumers stay cutover (REQ-MIG-002) remain out of scope for M4-3; the legacy surface stays
frozen meanwhile (Ruling 5). frozen for new consumers meanwhile (`tool-gateway-mapping.md` §3.2 decision).