Skip to content

test(pg): every control-plane statement's parameters must bind as declared (#1384) - #1428

Merged
athvin merged 1 commit into
mainfrom
ci/1384-pg-param-types
Nov 29, 2026
Merged

athvin merged 1 commit into
mainfrom
ci/1384-pg-param-types

Conversation

@athvin

@athvin athvin commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Closes #1384

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

New pg_param_types prepares every control-plane statement (214) against the reconciled schema. For each of their 852 parameters it checks that the Rust type the emitter binds for the declared type accepts the type Postgres infers. The failure message names the statement, the parameter, both types and the fix (a cast in the SQL). sql-analysis records the gate.

Why

er-entity analyse cannot know Postgres's inferred parameter types. A declared bigint inside make_interval(secs => $x) (inferred float8) planned cleanly and failed every call with WrongType. That shipped in requeue_launch and capacity_wait (#1383), and was caught before review in #544's enqueue_deferred. Decision: a pg test rather than a new E0xx code, because only a real Postgres knows the inferred type and er-entity verify runs without one. As a pg_* test it runs in CI's pg slices.

Proof

make check exit 0. Real Postgres: 214 statements, 852 parameters, pass. The required first run: with #1383's cast reverted it fails, naming exactly capacity_wait and requeue_launch (declared Bigint … Postgres infers float8). A params entry the parser can't read fails rather than being skipped.

Risk & rollback

Test only. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on brians-MacBook-Pro · 2026-11-29T10:41:53Z

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not: — a7ffca5, rust 46248352307 + frontend 46248352324 success; pg_param_types ran in the pg slices
  • images built, or correctly never ran because nothing that goes into
    an image changed: — success, run 46248352389
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: — run 46248780292 success; test only
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change: — infra, devcontainer success on a7ffca5
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: — Analyser: a declared parameter type that disagrees with Postgres's inferred type should fail (new E0xx) #1384 CLOSED by test(pg): every control-plane statement's parameters must bind as declared (#1384) #1428 via automation
  • follow-ups are open for everything deferred here — numbers: — none
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: — sql-analysis SKILL names the gate; a declared type is fixed by a cast in the SQL, never by changing the declaration

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

The type mapping mirrors er-sql-check's param_arg_type. The test lives in er-server so it rides the existing pg CI slices, without pulling DataFusion into er-server's test build.

🤖 Generated with Claude Code

…lared (#1384)

er-entity analyse plans each statement but cannot know what type Postgres
INFERS for a parameter. A declared bigint inside make_interval(secs => $x)
(inferred float8) planned cleanly and failed every call with WrongType.
The spot-reclaim requeue and the capacity wait were broken that way until
#1383, and nothing executed them.

pg_param_types prepares all 214 Postgres statements on the reconciled
schema and checks, for each of their 852 parameters, that the Rust type the
emitter binds for its declared type accepts what Postgres inferred. The
mapping mirrors er-sql-check's param_arg_type, and an unmapped type fails
to compile. A params entry it cannot read fails rather than being skipped.
With #1383's cast reverted it names exactly capacity_wait and
requeue_launch.

It is a pg test rather than an E0xx code because only a real Postgres knows
the inferred type, and er-entity verify runs without one. It runs in CI's
pg slices with every other pg_* test. sql-analysis records the gate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin merged commit a7ffca5 into main Nov 29, 2026
40 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 29, 2026 09:37 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 62284155 Deployed Nov 29, 2026 by athvin via remove closed PR previews #157
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.

Analyser: a declared parameter type that disagrees with Postgres's inferred type should fail (new E0xx)

2 participants