Skip to content

chore(infra): per-PR schema sweep owner and CI wiring for preview environments #57

Open

Description

@aRustyDev

Context

PR previews are meant to run on the shared dev database with one schema per PR (ADR-0092 line 76; Q-0092.2, QUESTIONS.md:227), on thrust-pg-dev, the one-instance cluster that hosts dev, staging and the per-PR schemas (ADR-0094 line 70). The infrastructure repository has products/thrust/kube/scripts/pr-schema.sh create|drop|list <n>: login role pr_<n> with a connection limit of 8, schema pr_<n> owned by it, and a role-level search_path, run with psql through kubectl exec on the dev primary (research/0010 lines 107-110). hyperdrive.sh ensure creates a per-PR Hyperdrive config with caching disabled (ADR-0094 line 95). Spike 0001 Stage 2 used both live: create, migrate as the role, the Worker found its tables with no application search_path, then drop with a clean catalog (ADR-0094 line 131; research/0004 §10.1 line 351 and §10.7 line 451). This repository's CI has no preview job (.github/workflows/: ci.yml, contract-cell.yml, flake-hunt.yml).

Problem

Nothing is automated (research/0010 lines 110-112): no wiring to PR events, no sweep of schemas left by PRs that closed without the hook, nobody calls hyperdrive.sh ensure, and there are no per-PR migrations or storage bounds. Q-0094.7 (QUESTIONS.md:339) and Q-0094.1 (QUESTIONS.md:300: "the per-PR schemas and CI wiring are still unowned") are open, and so is the owner question in research/0010 §9 item 7 (line 261). Round 25 flagged the missing cleanup, ownership and migration-lock story (REVIEW-NOTES.md:151), and spike 0002 step 9 asks for it (spikes/0002-database-engine.md:28). Review §4 lists the cleanup owner as unassigned. Every leaked schema keeps a login role with 8 connections on a one-instance cluster.

Proposal

Acceptance criteria

  • Q-0094.7's per-PR item is answered with the owner and the job's home, citing FR-10.
  • The reconcile script has hermetic tests with fake gh, kubectl and curl, in the style of test-pr-schema.sh (research/0010 line 131). Control: a sweep that ignores the open-PR list (and so drops an open PR's schema) fails them.
  • Live: a test PR's pr_<n> schema and Hyperdrive config appear within one period of opening; within one period of closing, pr-schema.sh list no longer shows it and the catalog check from research/0004 §10.7 (0 roles, 0 schemas, 0 pr_% role settings) passes.
  • The preview migration step runs as pr_<n>; a migration that writes to public fails with a permission error (control).

References

  • Review: .agents/plans/contrail/reviews/2026-10-19-fable-architecture-review.md (FR-10, §4 "Per-PR schemas")
  • Q-0094.7, Q-0094.1, Q-0092.2; ADR-0094 (lines 70, 95, 131), ADR-0092 (line 76)
  • research/0010-thrust-postgres-infra-plan.md lines 107-112, 131, 261
  • research/0004-rust-on-workers-binding-matrix.md §10.1 (line 351), §10.7 (line 451)
  • REVIEW-NOTES.md:151; spikes/0002-database-engine.md:28
  • Infra repository: products/thrust/kube/scripts/pr-schema.sh, hyperdrive.sh
  • Beads: plane-byd.4

Finding: FR-10 (Q-0094.7)

Activity

  1. added this to the M1 Walking skeleton milestone on Oct 20, 2026
  2. added
    area:infra
    review:fable-2026-10-19
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:infraprio:p1review:fable-2026-10-19

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions