Repository navigation
fix(#1207): answer CodeDeploy's dates as epoch seconds, via a projection - #1327
Merged
Merged
Conversation
CodeDeploy speaks awsJson1_1, where a Timestamp is published as epoch seconds with fractional precision. API_ApplicationInfo types createTime as Timestamp, API_GetApplication renders it `"createTime": number` and samples it as 1446229001.211, and API_GetDeployment renders and samples createTime and completeTime the same way. All three answered an RFC3339 string. That did not give a caller a wrong value — it denied the whole response. An awsJson1_1 timestamp deserializer expects a number, so GetApplication and GetDeployment failed inside a typed SDK before any assertion of the caller's own ran. A hand-rolled client reading raw JSON was unaffected, which is why it survived: substrate's own tests read raw JSON. The dates could not be converted without a projection first, because the record was what each site marshaled: getApplication answered the persisted CodeDeployApp under `application`, getDeploymentGroup the CodeDeployGroup under `deploymentGroupInfo`, getDeployment the CodeDeployDeployment under `deploymentInfo`. So all three also answered accountID and region, which no CodeDeploy shape publishes (#756) — CodeDeploy is the one service in this family where every record leaked, the other six routed operations answering a map of published members only. New emulator/codedeploy_wire.go carries the three projections. The conversion happens there and the records keep their time.Time fields, so the persisted bytes are unchanged and a run recorded before this replays identically — which is why no RFC3339 fallback was needed for the event log, as #1207 anticipated for a stored-shape change that this approach avoids. codedeployGroupOut carries no date on purpose: API_GetDeploymentGroup publishes no top-level timestamp, its only dates being nested inside lastAttemptedDeployment and lastSuccessfulDeployment, neither of which substrate models. startTime and deploymentOverview stay absent for #1199's and #1196's account rather than being invented here. emulator/codedeploy_dates_test.go asserts on the raw bytes, since a decoder cannot tell 1446229001.211 from the RFC3339 string once both have landed in a time.Time. It pins each member as a bare number, and a catch-all over all nine routed operations fails on any RFC3339 date at any depth under any name. #1207 stays open: Timestream's two records and the class-wide audit criterion are untouched by this.
6 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
scttfrdmn
added a commit
that referenced
this pull request
Oct 2, 2026
Three records — CodeDeployApp, CodeDeployGroup and CodeDeployDeployment — each declare AccountID and Region under wire-visible json tags, six of the inventory's lines. #1327 projected all three through emulator/codedeploy_wire.go; this records that the projection holds, which is what scripts/wire-bookkeeping-projected.txt asks for before it will discharge a line. emulator/codedeploy_wire_test.go holds one test per record, together driving all nine routed operations and walking each decoded document for a member named for either at any depth, reporting the $.a.b[0].c path. Absence rather than exact membership, because GetApplication answers 4 of 6 published members, GetDeploymentGroup 4 of 23 and GetDeployment 6 of 31 (#1199), so an exact expectation would pin that gap and have to be rewritten by the PR closing it. The comparison folds case, so one entry covers both the record's spelling and the AccountID a projection in the house style of the other services might introduce, and it is an equality rather than a substring test, so the account inside a serviceRoleArn value is not a collision. Each case asserts a published member is present before asserting a bookkeeping one is absent, and the stored record is read back as raw JSON, so neither half can pass vacuously. Neither member carries ,omitempty on any of the three records and CodeDeploy routes none of the three tag operations, so no record declares EverTagged and #1304's trap does not arise. check-wire-bookkeeping goes from 165 projected across 65 records to 171 across 68, and from 154 still reachable to 148, of the same 319 declared. #756 stays open: EC2's 30 lines and a long tail remain in AC3.
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.
CodeDeploy speaks
awsJson1_1, where aTimestampis published as epoch seconds with fractionalprecision. Verified against the reference rather than from memory:
API_ApplicationInfo/API_GetApplicationcreateTime"createTime": number1446229001.211API_GetDeploymentcreateTime"createTime": number1446232639.487API_GetDeploymentcompleteTime"completeTime": number1446232681.319All three answered an RFC3339 string. That did not give a caller a wrong value — it denied the whole
response: an
awsJson1_1timestamp deserializer expects a number, soGetApplicationandGetDeploymentfailed inside a typed SDK before any assertion of the caller's own ran. A hand-rolledclient reading raw JSON was unaffected, which is exactly why it survived — substrate's own tests read
raw JSON.
The dates could not be fixed without a projection first
The record was what each site marshaled, so the order was forced:
CodeDeployAppgetApplication{"application": app}CodeDeployGroupgetDeploymentGroup{"deploymentGroupInfo": group}CodeDeployDeploymentgetDeployment{"deploymentInfo": deployment}So all three also answered
accountIDandregion, which no CodeDeploy shape publishes (#756).CodeDeploy is the one service in this family where every record leaked; the other six routed
operations each answer a map of one or two published members and render no record at all.
New
emulator/codedeploy_wire.gocarries the three projections. The conversion happens there and therecords keep their
time.Timefields, so the persisted bytes are unchanged and a run recordedbefore this replays identically — which is why no RFC3339 fallback was needed for the event log.
#1207's AC2 asks for one because it assumed a stored-shape change; projecting avoids the change
rather than compensating for it.
Two deliberate absences, so neither reads as an oversight:
codedeployGroupOutcarries no date.API_GetDeploymentGrouppublishes no top-level timestampat all — its only dates are nested inside
lastAttemptedDeploymentandlastSuccessfulDeployment,neither of which substrate models.
startTimeanddeploymentOverviewstay absent. Both are published, and both belong to fifteen records ship a fraction of their published members, and six add members AWS publishes nowhere #1199 andeight services reach a terminal state at birth, so no poll loop can observe a transition #1196; inventing a value for either would model the workload rather than the API.
Tests
emulator/codedeploy_dates_test.goasserts on the raw bytes, because a decoder cannot tell1446229001.211from"2015-10-30T16:56:41.211Z"once both have landed in atime.Time— andEpochSecondsaccepts either on the way in. It pins each of the three members as a bare number andrequires the string form absent; a catch-all over all nine routed operations fails on any RFC3339
date at any depth under any name. The clock is frozen with
Freeze()thenSetTime(), theordering
TimeController.Freezedocuments, so the expectation is an exact string and nothing readsthe wall clock.
emulator/codedeploy_plugin_test.goneeded no change: all three of its get assertions already decodea struct of published members and read no date. (Backup's counterpart did need changing, which was a
finding about that test.)
Negative controls, run and restored
Reverting
getApplicationto answer the record failed exactlyPublishedDatesAreEpochSeconds/GetApplication/createTimeplus the RFC3339 catch-all'sGetApplication; revertinggetDeploymentfailed exactly its two members plus its own catch-allsubtest.
Reverting
getDeploymentGroupfailed nothing, which is correct and worth stating: that record hasno date, so a dates test cannot see the difference. Its leak is
accountID/regionalone, and thetest that catches it is the next PR's. The control confirms the split is drawn in the right place
rather than leaving a hole.
Verification
make lint0 issues ·make testgreen (race,-count=1) · all seven doc and ratchet checks pass ·check-wire-bookkeepingreports the unchanged319 declared, 165 projected across 65 records, 154 still reachable, since this PR writes no projected line · the three projections at 100% statementcoverage.
Compatibility
A consumer asserting on
createTimeorcompleteTimeas a string must switch to a number. That is thepoint of the change: the string form could not be decoded by any typed SDK, so no SDK-based consumer
can be relying on it. Persisted state and recorded event logs are unaffected — the records still
hold
time.Timeand still serialize as RFC3339 to state.Refs #1207, #756. #1207 stays open deliberately — Timestream's two records and the class-wide
audit criterion remain untouched, so no closing keyword appears anywhere in this PR; see the issue
comment for what shipped versus what is left.