Repository navigation
feat(company-database): give each company its own resource database - #212
Conversation
Astra reviewOne-pass review, no subagents. Compared StandardsNo additional merge-blocking method or YAGNI findings. Spec[P1] Placement queries deadlock against the caller's platform poolPgCompanyDatabases.ts:114–121, reached by withCompany:291–303. #196 requires “the platform patch-row lock always” and company-pool “exhaustion fails with Verified on disposable real Postgres: held ten distinct patch-row locks, with nine transactions calling Required change: remove the circular acquisition: placement/provisioning work must not require another connection from the pool whose connections its callers are holding. Preserve independently committed claims and the specified lock order. Cover this saturation case with real platform transactions, not only concurrent company transactions. Verification
Summary: Standards: 0 blockers. Spec: 1 blocker; worst: P1 platform connection-pool deadlock. |
|
Two-axis review of this PR against issue #196, plus a method / YAGNI pass. Six read-only reviewers; Standards and Spec were isolated from each other. Issue 196 intent vs this PR. The ticket asked to birth StandardsHard violations
Judgement calls
Duplicated Code — in-memory Mysterious Name —
Spec(a) Missing / partial None. Required services, migration (b) Not asked for
(c) Looks implemented, wrong vs spec
MethodVerdict: sound with caveats. The birth cut is right: lazy one-DB-per-company, two-phase claim/ready, bounded pools, cumulative inventory, reverse path for orphans. Dual-login is the smallest model that does not hand Caveats for the next caller (primitives / publish):
YAGNIThe ticket asked for a fairly complete kernel. Not flagged: RcMap/budget, idle TTL, inventory schema including Must cut (small)
Judgement
What is simple
Surfaces
Misses
Orphan sweep is on the existing hourly schedule ( CorrectnessClaim/create is serialized on risk — inventory writes are unlocked. Only risk — file reclaim is check-then-delete, unlocked. risk — test-gap — interrupted CREATE. The interrupt test taps after test-gap — sweep Busy retry. The one 61s retry has no test. Foreground Busy is covered. Summary: Standards 6 findings (worst: |
|
Reviewed both PR comments, the Reviews tab, and inline review comments. Fixes are in Fixed
Kept, with reasons
Verification
All seven reported checks passed on |
5f8d093 to
8b8798f
Compare
079fda4 to
ec83a86
Compare
Patches need a browser-only operation path that cannot switch acting users mid-page and records mutations before execution. Adds runtime admission, loaded-version binding, host-supplied dispatch and durable runtime logging. Only `me` is admitted now; file routes are reserved for the Files ticket. Includes `0006_runtime_baseline`, migration wiring, admission/outcome coverage and updated API/domain documentation. Stacked on #212 (`sdk/196-company-database`), which is the base branch for this PR. Closes #197. ## Verification - Full offline suite: 428 tests passed across 46 files. - Focused runtime, migration and real-server checks: 47 tests passed. - `pnpm typecheck`, `pnpm lint` and `pnpm format:check` passed. - Grok/Astra review findings addressed or explicitly dispositioned in the PR review follow-up comment. Implemented with OpenAI GPT-6 Astra in the Oh My Pi harness.
Patch-owned resources need a durable home separate from platform records, without creating databases for companies that only publish primitive-free patches.
Add lazy, resumable company-database provisioning with bounded connection pools and transactional patch locks. Keep resource inventory consistent with schema changes, reclaim orphaned namespaces and files, and provide the same inventory services through a directory-backed PGlite development layer. Wire migrations and configuration through the server, dev runner and test harnesses.
Stacked on #211 (
sdk/195-addresses); this PR intentionally targets that branch and contains only the company-database work.Uses
0005_company_database_baselinebecause0004_invites_expiryalready occupies the issue's proposed migration number.Closes #196.
Verification
pnpm lint— passed.pnpm typecheck— passed.pnpm test— 395 tests passed across 41 files.Implemented with GPT-6 Astra in the Oh My Pi harness.