Repository navigation
fix(#1324): answer Backup's dates in the published Unix form - #1325
Merged
Merged
Conversation
Every date AWS Backup publishes is a Unix timestamp, and all eight sites that answer one rendered a time.Time instead — an RFC3339 string. The eight pages each gloss the member identically: "in Unix format and Coordinated Universal Time (UTC) ... accurate to milliseconds. For example, the value 1516925490.087", and each renders it as `number` in its Response Syntax. EpochSeconds, which #1090 introduced for ECR, marshals to exactly that three-decimal form. An SDK v2 caller is the one who could not read these: its decoder calls ParseEpochSeconds on a timestamp member, which a string does not satisfy. UpdateBackupPlan's UpdatedAt stays a string deliberately. No Backup page publishes the member (#1177), and giving it the published form would make one that is owed deletion look more correct than it is; a test pins that as a decision rather than an oversight, and will go with the member. The vault needed a projection before its date could be converted at all, which is the other half of this change (#756). describeBackupVault and listBackupVaults handed the persisted BackupVault to the marshaller, so AccountID and Region — neither carrying omitempty — were response members. The new emulator/backup_wire.go holds one backupVaultOut on ecr_wire.go's pattern: the five members substrate models are a subset of API_DescribeBackupVault's seventeen *and* of API_BackupVaultListMember's thirteen, so one type serves both shapes. CreateBackupVault keeps its own map — API_CreateBackupVault publishes three members and no more, and projecting it through the wider type would have added two the page does not publish. No projected line is recorded here, so the wire-bookkeeping figures are unchanged; the citation arrives with its test. The assertions are on the raw bytes, because a typed decoder cannot tell 1516925490.087 from the string — both land in the same time.Time, and EpochSeconds accepts either on the way in. backup_plugin_test.go had been decoding ListBackupVaults into []BackupVault, the record type, which is how nine sites agreed on the wrong form unnoticed; it now decodes published members only. The clock is frozen at AWS's own worked instant (Freeze then SetTime, the ordering TimeController.Freeze documents), so the expectation is an exact rendering rather than a tolerance and reads no wall clock.
9 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 2, 2026
Closed
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
Six baseline lines, two per record: BackupVault, BackupPlan and BackupSelection each declare AccountID and Region under wire-visible json tags. None reaches a response — the vault answers through backupVaultOut since #1325, and every plan and selection response is a map built member by member — but the projected inventory refuses a record until a named test asserts it on the raw bytes. emulator/backup_wire_test.go drives all twelve routed operations across three parallel tests and walks each decoded document, failing on a member named for either at any depth and reporting the $.a.b[0].c path. The walk covers the whole document rather than a record's subtree, which matters here: GetBackupPlan and GetBackupSelection nest the record's published members under BackupPlan and BackupSelection while answering others flat, so "the record's subtree" is not one place, and a member rendered on the envelope would pass a subtree walk. Absence rather than exact membership, which is the weaker of the two forms in the suite: DescribeBackupVault answers 5 of API_DescribeBackupVault's 17 published members and ListBackupVaults 5 of API_BackupVaultListMember's 13, so an exact expectation would pin that gap (#1199) and have to be rewritten by the PR closing it. Nothing here is vacuous for free. Neither member carries ,omitempty on any of the three records, and Backup routes no tag operation, so no record declares EverTagged and #1304's trap cannot arise; the records are read back as raw JSON as the presence anchor regardless. Each case also asserts a published member is present before asserting a bookkeeping one is absent, so a body that failed to render the record fails as a missing anchor rather than passing as an absence. The three deletes answer {} and read nothing off the record. They are driven anyway, so the set of twelve reads as complete rather than as a sample, and a control confirms all three subtests fail if a member is added to the empty object. Four more controls were run: a leak reintroduced on backupVaultOut, on one plan map and on one selection map each failed exactly the one test citing that record and no other, and a misspelt citation was refused by check-wire-bookkeeping. 159 projected across 62 records to 165 across 65; 160 still reachable to 154. No assertion equates a timestamp — TimeController.Now advances from its baseline by elapsed wall time, and pinning a Backup date's rendering is emulator/backup_dates_test.go's job (#1324).
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1324, except
UpdateBackupPlan'sUpdatedAt— see below.What was wrong
Every date AWS Backup publishes is a Unix timestamp. All eight sites that answer one rendered a
time.Time, soCreationDatecame back as"2018-01-26T00:11:30.087Z". The eight pages gloss themember identically — "in Unix format and Coordinated Universal Time (UTC) … accurate to
milliseconds. For example, the value 1516925490.087" — and each renders it as
numberin itsResponse Syntax:
API_DescribeBackupVault,API_BackupVaultListMember,API_CreateBackupVault,API_GetBackupPlan,API_BackupPlansListMember,API_CreateBackupPlan,API_GetBackupSelection,API_CreateBackupSelection. All six not already verified when #1324 was filed were read before anymember was converted.
The caller who could not read these is an SDK v2 one: its decoder calls
ParseEpochSecondson atimestamp member, which a string does not satisfy.
emulator.EpochSeconds— #1090's type, three decimals exactly — is what all eight now answer.The vault needed a projection first (#756)
describeBackupVaultandlistBackupVaultshanded the persistedBackupVaultto the marshaller, soAccountIDandRegion, neither carryingomitempty, were response members. The date could not beconverted at either site without that being fixed, so the two issues share one new file and the
order was forced.
emulator/backup_wire.goholds onebackupVaultOut, onemulator/ecr_wire.go's pattern. One typeserves both sites because the five members substrate models are a subset of
API_DescribeBackupVault's seventeen and ofAPI_BackupVaultListMember's thirteen, every memberof both being
Required: No. The twelve unmodelled members stay absent rather than present and empty(#1013's rule) — that gap is #1199's class and is recorded in
docs/services.md.One departure from the plan.
CreateBackupVaultis not projected through the wire type:API_CreateBackupVaultpublishes three members and no more, so routing it through a five-memberstruct would have added
EncryptionKeyArnandNumberOfRecoveryPointsto a response that publishesneither. It keeps its own map and converts its date there.
The record keeps both bookkeeping fields. A
json:"-"would change the format of every recorded run,since
MemoryStateManagersnapshots those bytes and a replay reads them back.No projected line is recorded here, so
make wire-bookkeeping-checkstill reports 319 declared,159 projected across 62 records, 160 still reachable — unchanged, which keeps this PR independent of
the #756 one that cites a test for these three records.
What is deliberately left
UpdateBackupPlan'sUpdatedAtstays an RFC3339 string. No Backup page publishes the member at all(#1177) — the page publishes
CreationDate, which substrate omits — and giving it the published formwould make a member that is owed deletion look more correct than it is.
TestBackupDates_UpdateBackupPlanStillAnswersTheUnpublishedUpdatedAtpins that as a decision ratherthan an oversight, and goes with the member when #1177 lands.
Why the assertions read raw bytes
A typed decoder cannot tell
1516925490.087from"2018-01-26T00:11:30.087Z": both land in atime.Timeholding the same instant, andEpochSecondsaccepts either on the way in. That is hownine sites agreed on the wrong form unnoticed —
emulator/backup_plugin_test.godecodedListBackupVaultsinto[]emulator.BackupVault, the record type, so the form it asserted was therecord's and not the API's. It now decodes published members only, and fails on a
number→time.Timetype error if the conversion is reverted.
The clock is frozen at AWS's own worked instant, so the expectation is an exact string rather than a
tolerance.
FreezethenSetTime, in that order, which is the orderingTimeController.Freezedocuments:
Freezealone stops the clock where it currently reads, and that sub-millisecond driftis visible in a rendered date. Nothing here reads the wall clock.
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; the two operationchecks report no change, and the wire figures are identical to
main's.describeBackupVaultto answer the record fails exactlyTestBackupDates_PublishedDatesAreUnixTimestamps/DescribeBackupVaultand the RFC3339 catch-all, andnothing else; reverting
listBackupPlans' conversion fails exactly its own subtest and thecatch-all. Both were run and both were restored.
backupVaultToWireandbackupVaultsToWireare at 100% statement coverage.