testutil: AWS-boundary test tier via Ministack RDS/Aurora - #11
Conversation
Ministack (MIT, tokenless) replaces the LocalStack plan: the tier now runs on every code PR as a real merge gate, and the provisioned database follows PG_VERSION across the full 14-18 range. The full image is required so instance readiness is an authenticated probe, and the connection uses a pinned host-published port because the emulator's container-internal endpoint address is not routable from macOS hosts.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Review requested by Armand and performed by his agent — same two lenses used across this stack (#10, #15, #14, #9, #8, #7, #2): pg-sprite as an OSS-first, best-in-class Postgres DDL tool, and pg-sprite as a clean integration target for an orchestrator. Reviewed at head The documentation in this PR is the best part of it and I want to be specific about why: the tier table's "Cannot prove" column, and the "How much of the suite runs on Ministack — deliberately almost none" section, are the two things that stop an emulator tier from metastasizing. Every project that adds one of these ends up, eighteen months later, with core logic quietly running against the emulator because it was faster, and nobody able to say which claims are still real. Writing the ceiling down before the tier has any weight is the only thing that has ever prevented that, and the "its share grows only when AWS-facing features land, never by moving core-logic tests onto it" sentence is exactly the right form of the rule. The tokenless/MIT choice so forks get the same gate is also the right call, and the LIFO cleanup ordering comment — instance delete before cluster delete, because RDS refuses to drop a cluster with instances — is the kind of detail that's obvious only after it has bitten you. My concern is timing rather than direction. The adversarial comment shows this tier currently has nothing of pg-sprite's on the tested path: no production code makes an AWS API call, and the test's assertions all pass unchanged against a plain PostgreSQL container in 1.5 seconds. So the harness and the docs are an investment in a seam that doesn't exist yet — which is fine — but the PR wires it into the required merge gate today. OSS lens
Integration lens
Verified solidThe harness reads the endpoint back from This review was generated by Claude Code (claude-fable-5). |
|
🤖 Adversarial correctness review requested by Armand and performed by his agent — separate from the two-lens pass. Method: for a test tier, the attack is "what would still pass if the thing under test were removed". I took the tier's own assertions, swapped Ministack for a plain PostgreSQL container, and ran them at head Findings, most severe first1. No pg-sprite code is on the path this tier tests, and every assertion passes without Ministack. All three pass, in a second and a half, with no emulator, no AWS SDK, and no Docker socket. That is because pg-sprite makes no AWS API calls at all — This isn't an argument against the harness — the PR's own "planned growth" list names the features that will put real code on this seam, and it's a reasonable list. It's an argument about what the tier can be claimed to prove today, and specifically about wiring it into 2. The docs claim the test connects to the discovered endpoint; the code deliberately connects around it. require.NotEmpty(t, aws.ToString(clusters.DBClusters[0].Endpoint), …)
require.NotZero(t, aws.ToInt32(clusters.DBClusters[0].Port), …)
// The discovered endpoint address is container-internal; connect via the
// pinned host-published port instead (see dbPort above).
return fmt.Sprintf("postgres://%s:%s@localhost:%d/%s?sslmode=disable", …)The reason is legitimate and well explained — container IPs aren't host-routable on macOS. But the consequence is that "connect to the discovered endpoint" is proven only to the extent of "the string was not empty", and the connection is made to an address the test computed for itself before provisioning even started. The 3. 4. // The port is released before returning, so a collision is possible but
// unlikely within a test's lifetime.The window here isn't a test's lifetime, though: the port is handed to Ministack as 5. Fourteen AWS modules plus 6. Probed and heldThe cleanup path is correct and I tried to break it: Reproduction
|
|
🤖 Correction to my adversarial comment above, from the same agent. Finding 3 said the tier running inside
So it is documented, deliberate, and not a contradiction the author missed. What stands from that finding is the cost rather than the surprise: the tier runs twice per PR (once inside the Apologies for the mischaracterization — the rest of that comment stands as written. This correction was generated by Claude Code (claude-fable-5). |
Summary
Adds the AWS-boundary test tier: an aurora-postgresql cluster is provisioned through the real RDS control-plane API against Ministack (MIT-licensed, tokenless), and the test proves provisioning → instance
available→ endpoint discovery → connect throughpkg/dbconn. Because Ministack needs no license key, the tier runs on every code PR — forks included — as a real merge gate.What
internal/testutil/ministack.go—ProvisionAuroraPostgres: starts a pinnedministackorg/ministack:1.4.13-fullcontainer (Docker socket mounted so it can run the sibling PostgreSQL container backing the cluster), provisions cluster + instance via the AWS SDK, polls toavailable, discovers the endpoint, and returns a connection URL on a pinned host-published port.internal/testutil/ministack_integration_test.go— end-to-end assertions: server major matchesPG_VERSION,dbconnbounded session settings apply, DDL executes and is introspectable.make test-aws-boundarytarget and anaws-boundaryCI job wired intoall-green.docs/testing.md— the three-tier statement (data plane / AWS boundary / real Aurora), with each tier's "proves / cannot prove" spelled out.Why
The engine's production seam with AWS (RDS control plane, endpoint discovery, later Secrets Manager DSN resolution and IAM auth) had no test tier at all. Ministack covers exactly that seam without weakening the data-plane rule: core logic keeps running against real PostgreSQL, and the provisioned database is a real
postgres:<major>container that followsPG_VERSIONacross the full 14 → 18 matrix — this tier never stands in for real Aurora semantics.Notable constraints found by live-running the harness:
fullimage is required — the slim edition's readiness falls back to a TCP probe that can never succeed from inside the emulator container in this topology, leaving the instancecreatingforever;RDS_BASE_PORThost port rather than the API-returned endpoint address, because container IPs are not host-routable on macOS;References