Carve-out of archie-core-7r0x.2's tail, and the shared shape the other four beads all need. Recon found the foundation is landed but unwired: postgres.Open/Migrate/Migrations have zero non-test callers, no database-URL config field exists anywhere, and docker-compose.yml has no postgres service. Every bead needs this; none of the five owns it.
Scope:
Postgres URL config field: internal/config, configuration/defaults.go, denied_keys policy, config.example.toml, all four deployments/*.toml, docker-compose.yml service, task dev wiring. Decide whether it is file-only/restart-required (like db_path) or a control-plane resource, and carry it through the ConfigView projection (webui/api_config.go StorageView, webui/config_schema.go) or it parses everywhere and takes effect nowhere.
Production wiring: the State Store process calls postgres.Open/Migrate.
Per-domain sqlc + goose layout: one sqlc entry per domain (own schema dir, own queries dir, own generated package), one goose provider per domain with its own version table (goose.WithTableName), postgres.Migrations() extended to subdirectories, and Taskfile db:check extended to cover every generated dir. Today db:check diffs one path, so a second generated dir would silently leave the gate. sqlc db.go is schema-independent and byte-stable; only models.go moves, and only when a table is added.
store.AcquireOwnership replaced by a Postgres advisory lock for serve ownership (currently no bead owns this; its callers are internal/app/archied/state_store.go and state_store_recovery.go).
Event-insert serialization: transaction-scoped advisory lock so bigserial ids commit in order. Decided by Sam 2026-09-24. The (at, id) cursor format is unchanged and is a wire contract.
2026-09-24: lanes run/pg-w1 (this bead's DB URL, compose, dev wiring, fail-closed pool, composition seam), run/pg-w2-2, w2-3, w2-5 merged onto origin/pg/foundation in branch worktree-giggly-marinating-lamport; task check clean. Still open here: per-domain sqlc/goose layout (one sqlc entry and goose version table per domain, db:check over every generated dir), advisory-lock serve ownership replacing store.AcquireOwnership, transaction-scoped advisory lock on event insert.
2ic ruling (approved): PostgreSQL advisory serve-ownership lock is a process-lifetime singleton guard, not merely a migration lock: acquire before serving and hold for the serving lifetime; fail closed if unavailable. This is required to preserve current turn recovery semantics for the single Gateway and State Store owners. Release only during orderly shutdown; test contention and crash/disconnect release.
Correction 2026-09-24: per-domain sqlc/goose split is NOT open work; locked decision D0.6 rejects it and the description's wording is stale. Remaining: advisory-lock serve ownership, event-insert advisory lock. Integration also lacks the uncommitted internal/domain/storecontract re-home in the .2 lane worktree (D8.1: preserve and reconcile).
2026-09-24: integration pushed to origin/pg/foundation at c32db5d9 (lanes w1, w2-2, w2-3, w2-5 plus the cp-pg2 storecontract re-home of resources.go/statestore_test.go); task check exit 0 on that tree.
Close reason
Closed
Imported from beads archie-core-7r0x.9 · GitHub #1013 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28
Carve-out of archie-core-7r0x.2's tail, and the shared shape the other four beads all need. Recon found the foundation is landed but unwired: postgres.Open/Migrate/Migrations have zero non-test callers, no database-URL config field exists anywhere, and docker-compose.yml has no postgres service. Every bead needs this; none of the five owns it.
Scope:
- Postgres URL config field: internal/config, configuration/defaults.go, denied_keys policy, config.example.toml, all four deployments/*.toml, docker-compose.yml service, task dev wiring. Decide whether it is file-only/restart-required (like db_path) or a control-plane resource, and carry it through the ConfigView projection (webui/api_config.go StorageView, webui/config_schema.go) or it parses everywhere and takes effect nowhere.
- Production wiring: the State Store process calls postgres.Open/Migrate.
- Per-domain sqlc + goose layout: one sqlc entry per domain (own schema dir, own queries dir, own generated package), one goose provider per domain with its own version table (goose.WithTableName), postgres.Migrations() extended to subdirectories, and Taskfile db:check extended to cover every generated dir. Today db:check diffs one path, so a second generated dir would silently leave the gate. sqlc db.go is schema-independent and byte-stable; only models.go moves, and only when a table is added.
- store.AcquireOwnership replaced by a Postgres advisory lock for serve ownership (currently no bead owns this; its callers are internal/app/archied/state_store.go and state_store_recovery.go).
- Event-insert serialization: transaction-scoped advisory lock so bigserial ids commit in order. Decided by Sam 2026-09-24. The (at, id) cursor format is unchanged and is a wire contract.
Evidence: .pi/pg-migrate-run/recon/04-coupling.md, 01-store-remainder.md, 05-import-and-removal.md.
### Notes
2026-09-24: lanes run/pg-w1 (this bead's DB URL, compose, dev wiring, fail-closed pool, composition seam), run/pg-w2-2, w2-3, w2-5 merged onto origin/pg/foundation in branch worktree-giggly-marinating-lamport; task check clean. Still open here: per-domain sqlc/goose layout (one sqlc entry and goose version table per domain, db:check over every generated dir), advisory-lock serve ownership replacing store.AcquireOwnership, transaction-scoped advisory lock on event insert.
2ic ruling (approved): PostgreSQL advisory serve-ownership lock is a process-lifetime singleton guard, not merely a migration lock: acquire before serving and hold for the serving lifetime; fail closed if unavailable. This is required to preserve current turn recovery semantics for the single Gateway and State Store owners. Release only during orderly shutdown; test contention and crash/disconnect release.
Correction 2026-09-24: per-domain sqlc/goose split is NOT open work; locked decision D0.6 rejects it and the description's wording is stale. Remaining: advisory-lock serve ownership, event-insert advisory lock. Integration also lacks the uncommitted internal/domain/storecontract re-home in the .2 lane worktree (D8.1: preserve and reconcile).
2026-09-24: integration pushed to origin/pg/foundation at c32db5d9 (lanes w1, w2-2, w2-3, w2-5 plus the cp-pg2 storecontract re-home of resources.go/statestore_test.go); task check exit 0 on that tree.
### Close reason
Closed
---
_Imported from beads `archie-core-7r0x.9` · GitHub #1013 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28_
sam
added the hightask labels 2026-10-27 13:34:59 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Carve-out of archie-core-7r0x.2's tail, and the shared shape the other four beads all need. Recon found the foundation is landed but unwired: postgres.Open/Migrate/Migrations have zero non-test callers, no database-URL config field exists anywhere, and docker-compose.yml has no postgres service. Every bead needs this; none of the five owns it.
Scope:
Evidence: .pi/pg-migrate-run/recon/04-coupling.md, 01-store-remainder.md, 05-import-and-removal.md.
Notes
2026-09-24: lanes run/pg-w1 (this bead's DB URL, compose, dev wiring, fail-closed pool, composition seam), run/pg-w2-2, w2-3, w2-5 merged onto origin/pg/foundation in branch worktree-giggly-marinating-lamport; task check clean. Still open here: per-domain sqlc/goose layout (one sqlc entry and goose version table per domain, db:check over every generated dir), advisory-lock serve ownership replacing store.AcquireOwnership, transaction-scoped advisory lock on event insert.
2ic ruling (approved): PostgreSQL advisory serve-ownership lock is a process-lifetime singleton guard, not merely a migration lock: acquire before serving and hold for the serving lifetime; fail closed if unavailable. This is required to preserve current turn recovery semantics for the single Gateway and State Store owners. Release only during orderly shutdown; test contention and crash/disconnect release.
Correction 2026-09-24: per-domain sqlc/goose split is NOT open work; locked decision D0.6 rejects it and the description's wording is stale. Remaining: advisory-lock serve ownership, event-insert advisory lock. Integration also lacks the uncommitted internal/domain/storecontract re-home in the .2 lane worktree (D8.1: preserve and reconcile).
2026-09-24: integration pushed to origin/pg/foundation at
c32db5d9(lanes w1, w2-2, w2-3, w2-5 plus the cp-pg2 storecontract re-home of resources.go/statestore_test.go); task check exit 0 on that tree.Close reason
Closed
Imported from beads
archie-core-7r0x.9· GitHub #1013 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28