Skip to content

acc: select asserted fields on postgres GETs instead of del-ing volatile ones#5911

Merged
shreyas-goenka merged 2 commits into
mainfrom
pr-c-robustify-postgres-gets
Jul 14, 2026
Merged

acc: select asserted fields on postgres GETs instead of del-ing volatile ones#5911
shreyas-goenka merged 2 commits into
mainfrom
pr-c-robustify-postgres-gets

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Why

The Cloud postgres/database acceptance tests filtered each get-<resource> response with a deny-list and then asserted on everything left:

$CLI postgres get-branch "$name" | jq 'del(.create_time, .update_time, .status.logical_size_bytes)'

Every time the backend adds a response field the golden breaks — even though the test doesn't care about that field. That's what happened when the endpoint response gained read_only_pooled_host / read_write_pooled_host / last_active_time.

What changed

Flip the deny-list to an allow-list: a <resource>_fields() helper in each resource dir's script.prepare that jq-selects exactly the fields the test was already asserting.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: a93beda

Run: 29320250030

Env 🟨​KNOWN 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 230 1084 5:20
💚​ aws windows 4 4 232 1082 7:21
💚​ aws-ucws linux 4 4 316 1001 5:56
💚​ aws-ucws windows 4 4 318 999 7:03
💚​ azure linux 4 4 230 1083 5:39
🟨​ azure windows 3 1 4 232 1081 9:53
💚​ azure-ucws linux 4 4 318 998 6:08
💚​ azure-ucws windows 4 4 320 996 7:13
💚​ gcp linux 4 4 229 1085 4:53
💚​ gcp windows 4 4 231 1083 6:55
8 interesting tests: 4 SKIP, 3 KNOWN, 1 RECOVERED
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🟨​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 🟨​K 💚​R 💚​R 💚​R 💚​R
🟨​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 🟨​K 💚​R 💚​R 💚​R 💚​R
🟨​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 🟨​K 💚​R 💚​R 💚​R 💚​R
Top 10 slowest tests (at least 2 minutes):
duration env testname
6:08 aws windows TestAccept
6:07 azure-ucws windows TestAccept
6:06 gcp windows TestAccept
6:04 aws-ucws windows TestAccept
5:56 azure windows TestAccept
3:02 azure linux TestAccept
2:56 aws linux TestAccept
2:55 gcp linux TestAccept
2:46 azure-ucws linux TestAccept
2:41 aws-ucws linux TestAccept

@shreyas-goenka shreyas-goenka force-pushed the pr-c-robustify-postgres-gets branch from de1f1e0 to c81b986 Compare July 13, 2026 16:03
@shreyas-goenka shreyas-goenka changed the base branch from pr-a-missing-role-suffix to main July 13, 2026 16:03
@shreyas-goenka shreyas-goenka force-pushed the pr-c-robustify-postgres-gets branch from c81b986 to 3d81bfe Compare July 13, 2026 16:23
@shreyas-goenka shreyas-goenka changed the title acc: assert projected fields on postgres GETs instead of full payload acc: select asserted fields on postgres GETs instead of del-ing volatile ones Jul 13, 2026
@shreyas-goenka shreyas-goenka marked this pull request as ready for review July 13, 2026 16:33
…ile ones

The Cloud postgres/database acceptance tests filtered each `get-<resource>`
response with a deny-list — `jq 'del(.create_time, .update_time, ...)'` —
then asserted on everything that was left. Every time the backend adds a
response field the golden breaks even though the test does not care about it
(that is what happened when the endpoint response gained pooled-host / last-
active-time fields).

Flip the deny-list to an allow-list: a `<resource>_fields()` helper in each
resource dir's script.prepare that selects exactly the fields the test was
already asserting. Same fields, so the goldens are unchanged; the difference
is that a new field the backend starts returning is now ignored automatically
instead of breaking the golden.

Mirrors the existing endpoint_fields helper (postgres_endpoints/script.prepare).
Converted: postgres_branches, postgres_databases, postgres_projects,
postgres_roles, postgres_catalogs, database_instances.

Notes:
- No golden churn: each projection reproduces the previous filtered output
  byte-for-byte. The one exception is postgres_projects/recreate, whose
  get-project was previously piped straight to a file with no filter at all;
  it now drops create_time/update_time to match every other project test.
- branch_fields null-drops the source_* provenance fields, present on forked
  branches but absent on the default branch.
- Plan-file filters (bundle plan -o json) are left as-is; they already strip a
  single volatile field and do not assert a full GET payload.
- Local-only tests (jobs, pipelines_recreate) keep asserting the full payload:
  the mock controls that shape, so there is no live backend to add fields.

Verified local and against aws-ucws.

Co-authored-by: Isaac
@shreyas-goenka shreyas-goenka force-pushed the pr-c-robustify-postgres-gets branch from 3d81bfe to 861fd2b Compare July 13, 2026 16:39

@janniklasrose janniklasrose left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update agent instructions (testing.md) to ensure they don't print unstable/extra fields in API responses

Add a rule to the acceptance-testing agent instructions requiring that a
printed API GET/read response be projected to an allow-list of asserted
fields (a <resource>_fields() helper in script.prepare) rather than dumped
in full or filtered with a volatile-field deny-list. Addresses review
feedback to keep acceptance goldens from breaking on unstable/extra fields
in API responses.

Co-authored-by: Isaac
@shreyas-goenka

Copy link
Copy Markdown
Contributor Author

Added a rule to .agent/rules/testing.md (a93beda) requiring that a printed API GET/read response be projected to an allow-list of asserted fields via a <resource>_fields() helper in script.prepare, rather than dumped in full or filtered with a volatile-field jq 'del(...)'. Includes GOOD/BAD examples and the with_entries(select(.value != null)) note for optional fields. .cursor/rules/testing.mdc is a symlink to that file, so it picks up the rule too.


This comment was generated with GitHub MCP.

@shreyas-goenka shreyas-goenka added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit 7fcb9d9 Jul 14, 2026
23 checks passed
@shreyas-goenka shreyas-goenka deleted the pr-c-robustify-postgres-gets branch July 14, 2026 12:34
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.

3 participants