Skip to content

fix(#756): pin RDS's projection and report the published creation time - #1311

Merged
scttfrdmn merged 1 commit into
mainfrom
fix/756-rds-wire-projection
Oct 1, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
fix/756-rds-wire-projection

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

What this is

#756's AC3 — no unpublished member reaches a response body — measured by
scripts/check-wire-bookkeeping.sh. RDS was the largest remaining block: 16 baseline lines across
5 records.
The ratchet moves 239 → 223 still reachable, 80 → 96 projected, across 31 → 36
records. No baseline line added or removed.

Why this one is different

RDS already projected. grep 'RDSDB[A-Za-z]* .*xml:'matches nothing: every one of the seventeen sites that answers a resource hands an item struct tordsXMLResponse, so no bookkeeping member could reach a body even before this change. What was missing was the *assertion* that this holds — the position ECS's four already-projecting records were in at #1308. So this is a pin, not a new rendering layer: emulator/rds_wire.goholds the item structs and converters moved out of the 1,361-linerds_plugin.go, and emulator/rds_wire_test.gois whatscripts/wire-bookkeeping-projected.txt` cites.

Neither AccountID nor Region has a published home on any RDS shape — every one publishes the
resource's ARN, from which a caller recovers both. API_DBSnapshot.SourceRegion is not that
home: it carries a value only for a cross-account or cross-Region copy, which substrate does not
perform, so reporting the request's Region there would tell a caller the snapshot had been copied.

The assertion

RDS is the first query-protocol (XML) service on the projected list; the eight already there are
JSON or REST-JSON, where absence is asserted by decoding to map[string]json.RawMessage. The
analogue used here is stronger: the body is walked with xml.NewDecoder and the whole set of element
paths inside the record's element is compared against the published shape's. That subsumes every
absence check at once, cannot go vacuous the way a bare NotContains can, and additionally catches a
published member rendered at the wrong depth — which is how the cluster's DBSubnetGroup nesting
survived.

ever_tagged is ,omitempty, so each record that declares EverTagged is tagged through
AddTagsToResource and anchored on both ListTagsForResource and the stored record's raw JSON
before any absence assertion runs. The snapshot is tagged too, even though RDSDBSnapshot declares
no such field: taggingStampRecordEverTagged edits raw JSON, so the member lands on the record
anyway, and the test proves it cannot reach a body.

Four adjacent defects, folded in

A projection has to choose a membership and a nesting anyway (the #1310 precedent), so choosing the
published one costs nothing.

Defect Authority
The creation time was persisted and reported nowhere. CreatedAt is stamped on instance, cluster and snapshot and no item struct carried it, though AWS publishes one on each of the three shapes under a different name InstanceCreateTime (API_DBInstance), ClusterCreateTime (API_DBCluster), SnapshotCreateTime (API_DBSnapshot) — all Type: Timestamp, Required: No
DeleteDBCluster reported 3 of the 11 members it held, its inline struct declaring only DBClusterIdentifier, Status and DBClusterArn API_DeleteDBCluster's response element is the whole DBCluster
The cluster's DBSubnetGroup was nested as DBSubnetGroup>DBSubnetGroupName, so an SDK decoding DBCluster.DBSubnetGroup read "". The nested form is correct on the instance, which is how it reached the cluster API_DBCluster.DBSubnetGroup is Type: String; API_DBInstance.DBSubnetGroup is the object
Start/Stop/RebootDBInstance answered an unnamed <Result> element — found by the assertion above. The result field was untagged, so encoding/xml named the element from the field and the XMLResult substitution had nothing to match; an SDK found no result element in a 200 API_StartDBInstance publishes StartDBInstanceResult

All three cluster sites now share one xmlDBClusterItem, so a fourth cannot diverge again.

Not a #1305 instance. The Query protocol's default timestamp format is ISO8601 and
encoding/xml renders a time.Time as RFC3339Nano, so no format change was needed — unlike Glue's
JSON protocol, which publishes epoch seconds. redshift_plugin.go:84 is the in-tree precedent. #1305
still stands for ACM, Redshift Data and Firehose.

Each new timestamp is a *time.Time, not a bare one: ,omitempty has no effect on a struct type in
encoding/xml any more than in encoding/json, so a plain field would report
0001-01-01T00:00:00Z where AWS omits a Required: No member.

Verification

  • make lint — 0 issues.
  • make test (race, -count=1) — all packages pass.
  • make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check — all pass.
  • Ratchet: ok — 319 declared, 96 projected across 36 records, 223 still reachable (#756).
  • Negative control: AccountID, Region, CreatedAt and ever_tagged temporarily added to all
    five item structs and projected from the records. Every one of the seventeen sites failed — 8
    instance, 3 cluster, 3 snapshot, 2 subnet group, 2 parameter group (18 assertion points; Start,
    Stop and Reboot share one site). Restored from a backup, all green again.
  • Patch coverage: 100% on every function in rds_wire.go; setDBInstanceStatus 93.5%.

Compatibility

A consumer asserting on an RDS response body sees four changes, all toward what AWS publishes:

  • CreateDBInstance, DescribeDBInstances, ModifyDBInstance, DeleteDBInstance,
    Start/Stop/RebootDBInstance and RestoreDBInstanceFromDBSnapshot now carry
    InstanceCreateTime; the three cluster operations carry ClusterCreateTime; the three snapshot
    operations carry SnapshotCreateTime.
  • DeleteDBCluster answers the full DBCluster rather than three members.
  • DBCluster.DBSubnetGroup is now a flat string. A consumer reading
    DBCluster/DBSubnetGroup/DBSubnetGroupName must read DBCluster/DBSubnetGroup instead.
    The
    instance's nested form is unchanged.
  • Start/Stop/RebootDBInstance answer StartDBInstanceResult / StopDBInstanceResult /
    RebootDBInstanceResult rather than Result. An SDK that read nothing from these now reads the
    instance.

No stored record changes, so a recorded run replays unchanged and the Resource Groups Tagging API —
which reads the records, not these responses — still reports an RDS resource's tags and whether it
has ever been tagged.

Refs #756 — AC3 continues with Kinesis, ElastiCache, cfn_deployer.go CFNStackState, and SSO (which
needs a rename: AccountID is a misspelling of published AccountId).

RDS is the first service #756 has reached that was already answering through a
separate item struct rather than encoding its records, so its sixteen baseline
lines were reachable-by-declaration with nothing pinning them shut — the
position ECS's four already-projecting records were in at #1308. The rendering
layer moves out of the 1,361-line rds_plugin.go into emulator/rds_wire.go and
emulator/rds_wire_test.go asserts it: 239 still reachable -> 223.

RDS is also the first query-protocol service on the projected list, so the
assertion is a stronger analogue of the JSON one — the body's whole set of
element *paths* is compared against the published shape's, which catches a
member rendered at the wrong depth as well as one that should not be there.
That is how the three adjacent defects below were found; the negative control
confirms every one of the seventeen sites fails when a leaked member is added.

Deciding the projection's membership settled three published members substrate
held the value for and reported wrongly or not at all: the creation time, now
reported as InstanceCreateTime, ClusterCreateTime and SnapshotCreateTime;
DeleteDBCluster, which reported three of the eleven members it held;
and the cluster's DBSubnetGroup, nested where API_DBCluster publishes a flat
string. Writing the test surfaced a fourth — Start, Stop and RebootDBInstance
answered an unnamed <Result> element, the result field being untagged so the
placeholder substitution had nothing to match.

Neither AccountID nor Region has a published home on any RDS shape, and
API_DBSnapshot.SourceRegion is not one: it carries a value only for a copy
substrate does not perform.

Refs #756
@scttfrdmn
scttfrdmn merged commit 84a50e9 into main Oct 1, 2026
17 checks passed
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
emulator/rds_plugin.go 80.95% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn deleted the fix/756-rds-wire-projection branch October 1, 2026 03:37
scttfrdmn added a commit that referenced this pull request Oct 1, 2026
…tion times (#1312)

ElastiCache was already answering every resource through an item struct rather
than encoding its records, as RDS was at #1311: its four records declare eleven
bookkeeping fields and not one could reach a body. What was missing was the
assertion that this holds, so this adds elasticache_wire_test.go and moves the
rendering layer into elasticache_wire.go. 223 still reachable -> 212.

Writing the assertion settled one divergence: substrate stamped a creation
instant on the cache cluster and the replication group and reported it on
neither, though API_CacheCluster publishes CacheClusterCreateTime and
API_ReplicationGroup publishes ReplicationGroupCreateTime. Both are now
reported, as pointers so a zero time is omitted rather than rendered as the
year-one instant.

Neither AccountID nor Region has a published home on any of the four shapes;
all four publish ARN, from which a caller recovers both.

Refs #756
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