testutil: control-plane error contract and rotation-seam tests - #12
testutil: control-plane error contract and rotation-seam tests#12Kiran01bm wants to merge 1 commit into
Conversation
Two AWS-seam tests join the Ministack tier: typed RDS fault matching for unknown/duplicate identifiers, and master-password rotation landing on the running database (stale password refused as 28P01). The duplicate- instance case matches by error-code prefix because the emulator's wire code carries a Fault suffix real AWS omits. ProvisionAuroraPostgres now returns a cluster handle so tests can drive further control-plane calls.
|
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 (#11, #10, #15, #14, #9, #8, #7): 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 Two things here are better practice than the code they're attached to. First, the emulator divergence was found by running the thing rather than by reading its docs, and it's written down at the point of use with the real-AWS behavior spelled out beside it — most people would have quietly changed the assertion until it passed and left the next reader to rediscover why. Second, returning an The findings are about which contract these tests actually pin, and it's mostly not pg-sprite's. OSS lens
Integration lens
Verified solid
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, and the last of this stack. Method: same as #11 — for a test, the attack is "what would still pass if the thing under test were removed", plus "does the scenario it names match the failure it reproduces". Verified against a real PostgreSQL 16 at head Findings, most severe first1. The error-contract test writes an emulator defect into the contract, and instructs engine code to copy it. The comment is explicit about what future production code should do: // Match the code prefix so the assertion holds against both the
// emulator and a real endpoint — engine code consuming this error must
// do the same.
assert.True(t, strings.HasPrefix(apiErr.ErrorCode(), "DBInstanceAlreadyExists"), …)But engine code running against real AWS must not do the same: real AWS emits The permanence is the worse half. 2. The rotation test doesn't reproduce the failure it names. The PR body and the test comment both call the stale-password refusal "the exact failure a mid-migration connection hits after a production rotation". It isn't — PostgreSQL doesn't re-authenticate an established session, so a connection that is already open sails straight through a rotation: The failure lands on the next dial, not on the rotation: the pool growing past its idle set, a It also has a direct consequence for #15. 3. Neither test's load-bearing assertion needs the control plane. The rotation test's outcome reproduces in 1.4 seconds against a plain container with And the error-contract test asserts the AWS SDK's mapping of Ministack's wire codes — pg-sprite still makes no AWS API call anywhere outside The constructive version is short. The assertion this test is one line from making is about pg-sprite, and it's the one that would hurt if it regressed: a rotation must produce one clean failure, not a retry storm against an auth-failing endpoint. I checked the classifier directly — — and it's correct today. 4. The tier's provisioning cost triples, on a required gate. All three tests call 5. Probed and held
Reproduction tests
|
aparajon
left a comment
There was a problem hiding this comment.
🤖 Approving on Armand's behalf. My two-lens review and adversarial correctness pass are posted above — the findings there are for follow-up, not fix-before-merge blockers.
This approval was submitted by Claude Code (claude-fable-5) at Armand's direction.
Summary
Adds two AWS-seam tests to the Ministack AWS-boundary tier: a control-plane error contract test (typed RDS fault matching) and a password-rotation seam test (rotation via
ModifyDBClusterlands on the running database). Both are behaviors the engine's discovery and connection code will rely on in production.What
ProvisionAuroraPostgresnow returns anAuroraClusterhandle (control-plane client, cluster/instance IDs,URL()/URLWithPassword()) so tests can drive further control-plane operations against the provisioned cluster.TestAuroraControlPlaneErrorContract— describing an unknown cluster and creating duplicate cluster/instance identifiers surface as the AWS SDK's typed RDS faults, matched witherrors.As, never by message text.TestAuroraControlPlanePasswordRotation—ModifyDBClusterapplies a new master password to the real database: the new password connects throughpkg/dbconn, the stale one is refused with SQLSTATE28P01— the exact failure a mid-migration connection hits after a production rotation.docs/testing.md— the tier-share section now lists all three Ministack tests and their seams; the planned-growth list drops IAM-auth (not planned) and adds rotation recovery (oncepkg/dbconngrows a credential-refresh hook); logical replication is called out as a data-plane concern.Why
The tier existed with one provisioning E2E; these tests pin down the two seams the engine hits first in production — control-plane error handling during discovery, and credential rotation mid-migration. The rotation test also establishes the baseline the future credential-refresh hook must recover from.
One emulator fidelity gap found and documented: Ministack's duplicate-instance wire code is
DBInstanceAlreadyExistsFault, while real AWS emitsDBInstanceAlreadyExists— so the SDK cannot map it to the typed fault and that one case matches by error-code prefix (holds against both the emulator and a real endpoint). Worth contributing a fix upstream.References