Skip to content

ci: use running postgres for pgschema desired-state planning#1070

Merged
wpfleger96 merged 1 commit into
mainfrom
duncan/pgschema-external-plan-db
Jun 16, 2026
Merged

ci: use running postgres for pgschema desired-state planning#1070
wpfleger96 merged 1 commit into
mainfrom
duncan/pgschema-external-plan-db

Conversation

@wpfleger96

Copy link
Copy Markdown
Collaborator

Problem

The Desktop E2E Integration job flakes with:

Error: failed to start embedded PostgreSQL: no version found matching 18.0.0

This is a misleading error. ./bin/pgschema apply spins up a throwaway embedded Postgres (a Zonky binary downloaded from Maven Central) to build its desired-state catalog for the diff. The vendored fergusstrange/embedded-postgres library returns the literal string no version found matching %s on any non-200 response from Maven (timeout, 5xx, connection reset) — not just a true 404. The 18.0.0 artifact exists and resolves with HTTP 200, so this is a transient Maven Central fetch hiccup wearing a version-mismatch costume, uncorrelated with any code change. Blind reruns pass because the jar is genuinely there.

Fix

Point pgschema at the already-running docker buzz-postgres (postgres:18) container as its external plan database via PGSCHEMA_PLAN_* env vars on the existing Apply database schema step.

In File Mode (--file), apply binds PGSCHEMA_PLAN_* to the --plan-* flags, and CreateDesiredStateProvider returns the external-database provider before the embedded path that calls StartEmbeddedPostgres. The Zonky/Maven download is never entered, so Maven Central is removed from the job's critical path permanently — this deletes the flaky dependency rather than dampening it.

Desired-state is built in a timestamp + crypto-random-suffixed temp schema (pgschema_tmp_<ts>_<8hex>) that is dropped on exit; public is never written during the plan phase. Plan and target are the same postgres:18 container, satisfying pgschema's exact-major-version requirement.

The Desktop E2E Integration job flaked with "failed to start embedded
PostgreSQL: no version found matching 18.0.0". pgschema apply spins up a
throwaway embedded Postgres (Zonky binary from Maven Central) to build its
desired-state catalog; the vendored fergusstrange/embedded-postgres returns
that literal "no version found" string on ANY non-200 from Maven, so a
transient fetch failure surfaces as a bogus version mismatch.

Pointing pgschema at the already-running docker buzz-postgres container via
PGSCHEMA_PLAN_* takes the external-database branch in CreateDesiredStateProvider,
which never reaches the embedded/Maven path. Removes Maven Central from the
job's critical path entirely.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
@wpfleger96

Copy link
Copy Markdown
Collaborator Author

Proof obligation — verified

Both Desktop E2E Integration shards passed on this branch (run 27629140515), jobs (1/2) and (2/2). A blind green isn't the proof — here is the dispositive log evidence that the embedded/Maven path is gone.

1. The five PGSCHEMA_PLAN_* env vars are present on the Apply database schema step

PGSCHEMA_PLAN_HOST: localhost
PGSCHEMA_PLAN_PORT: 5432
PGSCHEMA_PLAN_DB: buzz
PGSCHEMA_PLAN_USER: buzz
PGSCHEMA_PLAN_PASSWORD: buzz_dev

2. Embedded-Postgres / Maven fetch is ABSENT

Grepping each job's full log for embedded, maven, zonky, repo1.maven, no version found:

job (1/2)  81700236369 — 0 matches
job (2/2)  81700236290 — 0 matches

The embedded path is the only code that reaches Maven Central (internal/postgres/embedded.go is the sole importer of fergusstrange/embedded-postgres and the sole caller of StartEmbeddedPostgres — the function that emits the failed to start embedded PostgreSQL flake string). Zero matches ⟹ that branch was never entered.

3. The desired-state plan was built with no download phase

The step output, start to finish in ~1.3s:

##[group]Run ./bin/pgschema apply --file schema/schema.sql --auto-approve   15:41:22.073Z
Plan: 41 to add.                                                            15:41:23.360Z
DDL to be executed:
Applying changes...
Executing group 1/1...
  Executing 126 statements in implicit transaction

No jar fetch, no embedded-PG boot — the external plan DB was used.

On the pgschema_tmp_* temp schema

The temp schema is created only by the external path (NewExternalDatabase.ApplySchemaCREATE SCHEMA "pgschema_tmp_<ts>_<8hex>", internal/postgres/external.go:103). Verified at source (v1.7.4): pgschema references the temp schema name in stdout only inside error messages (failed to create temporary schema %s, failed to apply schema SQL to temporary schema %s). On the success path it is never logged, so a green run cannot surface pgschema_tmp_* by grep — by design.

The temp-schema usage is therefore established by mutual exclusion: with the embedded/Maven path proven absent (#2) and a desired-state plan proven produced (#3), the external path is the only code that can have run — and the external path's desired-state catalog is built exclusively in the pgschema_tmp_* temp schema, dropped on exit. There is no third desired-state provider.

@wpfleger96 wpfleger96 merged commit e3736f0 into main Jun 16, 2026
24 checks passed
@wpfleger96 wpfleger96 deleted the duncan/pgschema-external-plan-db branch June 16, 2026 15:52
wpfleger96 pushed a commit that referenced this pull request Jun 16, 2026
* origin/main: (50 commits)
  chore(release): release version 0.3.24 (#1074)
  feat(desktop): refine thread-unread badge to two-token form (#1069)
  fix(buzz): prevent reconnect storms from reaped ephemeral channels (#1071)
  fix(buzz-acp): trim oversized observer frames to fit instead of dropping (#1072)
  perf(ci): speed up PR CI wall clock and local dev builds (#1028)
  chore(deps): update react monorepo (#1048)
  Polish desktop visual details (#1067)
  ci: use running postgres for pgschema desired-state planning (#1070)
  fix(desktop): anchor active-turn badge to skew-corrected agent start (#1068)
  feat(desktop): add configurable transport reconnect hook (#1059)
  Add automatic database migrations (#988)
  Add composer spoiler formatting (#1055)
  feat(desktop): in-channel and in-thread unread indicators (#1008)
  perf(timeline): gate heavy message render behind useDeferredValue (#1022)
  Add animated profile avatars (#1031)
  Polish direct message and members modals (#1054)
  Polish huddles UI (#1041)
  Fix video review comments in threads (#1056)
  Polish message reaction tray (#1002)
  Refine app loading skeletons (#1001)
  ...

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>

# Conflicts:
#	desktop/src-tauri/Cargo.lock
wpfleger96 added a commit that referenced this pull request Jun 16, 2026
…fleger/persona-instantiation

* origin/wpfleger/persona-events: (50 commits)
  chore(release): release version 0.3.24 (#1074)
  feat(desktop): refine thread-unread badge to two-token form (#1069)
  fix(buzz): prevent reconnect storms from reaped ephemeral channels (#1071)
  fix(buzz-acp): trim oversized observer frames to fit instead of dropping (#1072)
  perf(ci): speed up PR CI wall clock and local dev builds (#1028)
  chore(deps): update react monorepo (#1048)
  Polish desktop visual details (#1067)
  ci: use running postgres for pgschema desired-state planning (#1070)
  fix(desktop): anchor active-turn badge to skew-corrected agent start (#1068)
  feat(desktop): add configurable transport reconnect hook (#1059)
  Add automatic database migrations (#988)
  Add composer spoiler formatting (#1055)
  feat(desktop): in-channel and in-thread unread indicators (#1008)
  perf(timeline): gate heavy message render behind useDeferredValue (#1022)
  Add animated profile avatars (#1031)
  Polish direct message and members modals (#1054)
  Polish huddles UI (#1041)
  Fix video review comments in threads (#1056)
  Polish message reaction tray (#1002)
  Refine app loading skeletons (#1001)
  ...

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
tellaho added a commit that referenced this pull request Jun 17, 2026
* origin/main: (26 commits)
  fix(desktop): restore timeline zoom via rem tokens + chat-as-base type scale (#1052)
  fix(release): format changelog as linked markdown bullets (#1075)
  chore(release): release version 0.3.24 (#1074)
  feat(desktop): refine thread-unread badge to two-token form (#1069)
  fix(buzz): prevent reconnect storms from reaped ephemeral channels (#1071)
  fix(buzz-acp): trim oversized observer frames to fit instead of dropping (#1072)
  perf(ci): speed up PR CI wall clock and local dev builds (#1028)
  chore(deps): update react monorepo (#1048)
  Polish desktop visual details (#1067)
  ci: use running postgres for pgschema desired-state planning (#1070)
  fix(desktop): anchor active-turn badge to skew-corrected agent start (#1068)
  feat(desktop): add configurable transport reconnect hook (#1059)
  Add automatic database migrations (#988)
  Add composer spoiler formatting (#1055)
  feat(desktop): in-channel and in-thread unread indicators (#1008)
  perf(timeline): gate heavy message render behind useDeferredValue (#1022)
  Add animated profile avatars (#1031)
  Polish direct message and members modals (#1054)
  Polish huddles UI (#1041)
  Fix video review comments in threads (#1056)
  ...

Co-authored-by: Taylor Ho <taylorkmho@gmail.com>
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>

# Conflicts:
#	desktop/src/features/messages/lib/useRichTextEditor.ts
#	desktop/src/features/messages/ui/MessageComposer.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant