Repository navigation
Description
Substrate mints most of its identifiers from crypto/rand, so a recorded run and its replay produce different identifiers. This is the shared prerequisite of #833 and #817, and no issue covers it.
grep across non-test emulator/ code: 78 generate* functions, in 31 files that import crypto/rand. Nearly all draw from it directly.
What it blocks, concretely
#833 — authorization fidelity. A stream containing a mid-stream CreateAccessKey or AssumeRole mints a different AKIA…/session token on replay. The recorded Authorization header then names a key that is absent from replayed state, resolvePrincipal returns nil, and CheckAccess fails open the instant reqCtx.Principal == nil:
if reqCtx.Principal == nil {
return nil
}(emulator/authz.go:151-153)
So a replay of a recorded stream would authorize everything — the opposite of the fidelity #833 asks for — and it would do so silently.
#817 — body comparison. Any create whose response carries a generated identifier diverges, so a strict body differ reports a mismatch on essentially every mutating event. Criterion 3 of #817 assumes the opposite.
State-hash validation. As of the v0.115.0 reporting work, IncludeStateHashes is honoured and ValidateState actually runs. A stream containing any create now reports a state_hash_after mismatch, because the state key or record contents embed the freshly minted identifier. That is the correct answer — the divergence is real — but it means state validation is only useful once identifiers are reproducible.
The convention already exists in two places and was never generalised
- CloudFormation derives its stack and change-set UUIDs from account + region + name (
docs/services.md:1414-1418), specifically so a redeploy and a replay mint the same value. error_protocol.go:10-14states the principle outright:substrateRequestID = "SUBSTRATE"is a fixed constant because "an error body has to be byte-identical across two replays of one recorded run".- Config rules do the same (
configservice_rules.go:412): "AWS mints an opaque config-rule-xxxxxx; substrate derives it by hash so replaying …".
So the design question is not whether to derive rather than randomise, but what to derive from, given that the same operation may legitimately be called twice in one run with identical inputs (two CreateAccessKey calls for one user must produce two distinct keys).
The design question this issue has to answer first
A pure hash of the request is wrong for exactly that reason. The candidate inputs, and what each costs:
| Source | Reproducible? | Distinguishes repeat calls? | Notes |
|---|---|---|---|
| account + region + name | yes | n/a (name is the discriminator) | works for named resources; CFN's approach |
| hash(request) | yes | no | two identical creates collide |
| hash(request + event sequence) | yes | yes | needs the plugin to see the sequence number, which it does not today |
| a seeded PRNG per stream | yes | yes | needs a seeded source threaded to every mint site; ReplayEngine.RandInt64 already exists (replay.go:642) but is reachable by nothing |
| a monotonic per-namespace counter in state | yes | yes | reproducible because it is state, which replay resets; needs a state write per mint |
Note that ReplayEngine already carries a seeded rng and exposes RandFloat64/RandInt64 (replay.go:629-647), and ReplayConfig.RandomSeed is plumbed — but no plugin can reach any of them, because a plugin holds no reference to the replay engine. That is the missing wiring, whichever source is chosen.
Whether the answer is one mechanism for all 78 sites or a per-shape choice (ARNs and names derived from inputs; opaque tokens from a seeded source) is the first decision, and it should be made before either replay issue is scheduled.
Acceptance criteria
- A written decision on the identifier source, recorded where the existing conventions are (
docs/services.md, alongside the CloudFormation UUID note) rather than only in code. - A single seam every mint site goes through, so the answer cannot be given two ways in two plugins — the same "one builder, so they cannot drift" structure SQS state keys disagree: the tagging API and the authorizer address queue:<name>, the plugin writes queue:<account>/<name> #826 established for ARNs.
- Two identical create calls in one run still produce distinct identifiers. This is the criterion a naive
hash(request)fails, and it must be a test. - Recording a stream and replaying it produces byte-identical identifiers, asserted through a real
state_hash_aftercomparison (which the v0.115.0 work makes possible). - The 78 sites are enumerated in the issue or a checklist so the migration is auditable rather than "mostly done".
- Scoped explicitly: which identifier kinds are in scope (ARNs, resource IDs, opaque tokens, request IDs, ETags, session tokens) and which are deliberately left random, with the reason.
Also worth deciding here: MemoryStateManager.List returns Go map iteration order with no sort (state.go:80-97), across 118 non-test state.List( call sites. That makes two identical ListBuckets requests differ within one run, independent of identifier minting. It is a smaller fix (sort in List, once) and arguably belongs in this issue since it has the same symptom and the same two dependents; it is recorded here so it is not researched a third time.
Filed as the prerequisite for #833 and #817 during the v0.115.0 replay-reporting research.
Activity
fix(replay): a counter that stood for work, and a comparison that ran (…
fix(replay): a recorded success body's RequestId is reproducible (#866)…
scttfrdmn commentedon Sep 15, 2026
Deferred out of v0.116.0 to v0.117.0. Three corrections to this issue's premises, verified against the tree at
bd1dca7, plus what v0.116.0 discharged.The central claim does not hold: this issue's cheap form unblocks nothing
The issue positions itself as the prerequisite of #833. It is not, in the scoping it proposes.
Deriving an identifier from its inputs (option i, S/M) cannot serve #833, because #833 needs
CreateAccessKey(iam_plugin.go:1475) andAssumeRole(sts_plugin.go:285,:506) reproducible, and neither has a unique-name input to derive from. Both are in the collision class, where identical inputs must legitimately yield distinct identifiers. Seven such sites are verified:RunInstanceswithMaxCount > 1(ec2_plugin.go:665-667)SendMessages with one bodyAssumeRoles with one session nameThe in-tree counter-argument is already written down.
iamSLRTaskUUID's doc comment (iam_service_linked_roles.go:245-249): "deriving one would make two deletions of the same role collide on a single ID."So the real dependency chain is the full seam (option ii), which is L, not the M this issue implies.
The inventory is wrong in four places
generate*functions, not 78.crypto/rand-backed, but "nearly all draw from it directly" is wrong twice: ~40 callrand.Read/rand.Intinline and 26 go through one choke point,randomHex(ec2_types.go:489, 40 call sites). That choke point is the good news in this issue — it is the difference between 66 edits and 40.crypto/randat all: three already deterministic (ec2_plugin.go:3703,kinesis_plugin.go:880,secretsmanager_types.go:57), five wall-clock (eventstore.go:929,:934,parser.go:823,replay.go:633,s3_plugin.go:3008), onemath/rand(organizations_plugin.go:302).generate*is missing from the issue entirely:randomHex,stsGenerateSecret/stsGenerateToken(sts_plugin.go:631,:640),iamSLRTaskUUID(iam_service_linked_roles.go:250), S3 version IDs (s3_plugin.go:927,:1200), SESv2MessageId(sesv2_plugin.go:243), and Omics' clock-seeded PRNG (omics_plugin.go:38).Two shortcuts are closed, and one of #817's premises falls with them
Event.Sequenceis not reachable at mint time. It is assigned insideRecordEvent(eventstore.go:289, pipeline step 8); minting happens at step 5. A sequence-derived identifier is not available where it would be needed.TimeController.Now()advances by wall-clock elapsed (types.go:245-250), so atc.Now()component is not deterministic. This independently falsifies Replay: deep-compare response bodies during verification #817's stated premise that "bodies carry simulated-clock times, which are reproducible." Recorded there too.A hard prerequisite that was not filed: #886
resetStateresets only theStateManager(replay.go:656-664) andPluginRegistryhas no reset hook (types.go:334-365), so the twoatomiccounters (s3_plugin.go:927/:1200,sesv2_plugin.go:20) survive a reset and a second replay in one process diverges from the first. Filed as #886. It is a prerequisite of this issue's full seam, and v0.116.0's CLI wiring (#855) made it reachable fromsubstrate replayrather than only from a hand-built engine.What v0.116.0 shipped toward this
Two of this issue's real prerequisites, both required by #817 regardless of which minting option is eventually chosen, and neither dependent on that choice:
MemoryStateManager.Listreturns lexicographic order, with the guarantee stated on the interface. 124 non-test call sites were following Go's map hash seed.Eventrecords the request ID, so a replayed success body carries the recordedRequestIdrather than a fresh wall-clock one. This was the missing half ofsubstrateRequestID(error_protocol.go:10-14), whose comment already stated the rule for the error path.The structural model when option (ii) is taken
#510 is the closed precedent for this class ("FaultController: the PRNG is shared across rules, so Probability determinism depends on request ordering"), and
NewFaultController(cfg, seed)(fault.go:157) with per-ruleruleRNGs(fault.go:188-199) is the shape to copy.Test blast radius, for the record
~45 shape assertions (
HasPrefixoni-,vol-,AKIA, …) and ~5 length assertions. Zero tests assert a minted value, because they structurally cannot today. Preserving prefix and length — ascfnNameSuffix's fixed 12 (cfn_physical_name.go:115) andcfgsvcMintRuleID's fixed 6 already do — breaks essentially nothing. That is the reassuring half of an L-sized change.scttfrdmn commentedon Sep 16, 2026
Moved to the v0.118.0 milestone, and the hardest structural piece of it is done.
Discharged this release: #886. The blocker filed out of this issue's own analysis in v0.116.0 was
that
PluginRegistryhad no reset hook, so a plugin holding mutable state on its own struct survivedresetState— meaning even fully deterministic minting would diverge on a second replay in one process.v0.117.0 added the
ResettablePlugincapability and wired it into bothReplayEngine.resetStateandPOST /v1/state/reset, clearing the state manager first and the plugins second. The three plugins thatmint from struct-local state —
S3Plugin.versionSeq,SESv2Plugin.msgSeq,OmicsPlugin.rng— arereset with it. That is one of the two reasons this issue was sized L; the lifecycle hook no longer
has to ship as part of it.
Unchanged, and still the reason it is deferred: the seam itself. 66
crypto/rand-backed minters,~40 of them inline and 26 through one choke point (
randomHex, 40 call sites), plus the mintingthat is not named
generate*at all and so is absent from this issue's inventory —stsGenerateSecret/
stsGenerateToken,iamSLRTaskUUID, S3 version IDs, the SESv2MessageId, and Omics' clock-seededPRNG. Two shortcuts remain closed off:
Event.Sequenceis assigned insideRecordEvent, after thepoint a handler mints, so it is not reachable at mint time; and
TimeController.Now()advances bywall-clock elapsed, so a
tc.Now()component is not deterministic either.Also still standing, and the thing this issue must decide first: the collision class. Seven verified
sites must yield distinct identifiers from identical inputs — two access keys for one user,
RunInstanceswithMaxCount>1, two snapshots of one volume, twoSendMessages with one body, twoAssumeRoles with one session name, two multipart uploads on one key, two identical Athena queries.iamSLRTaskUUID's own doc comment is the in-tree argument: "deriving one would make two deletions ofthe same role collide on a single ID." So deriving from inputs (the cheap option) unblocks neither
#833 nor #817, both of which need
CreateAccessKeyandAssumeRolereproducible.NewFaultController(cfg, seed)with its per-rule RNGs remains the structural model for the full seam.feat(secretsmanager): RotateSecret's parameters, VersionId and refusa…
fix(replay): re-decide authorization, quota, consistency and fault on…
feat(replay): compare response bodies during replay verification (#817)…
scttfrdmn commentedon Sep 17, 2026
Moved to the v0.119.0 milestone. Nothing in v0.118.0 touched the seam, but the release produced one
data point worth carrying, because it is evidence about the payoff rather than the cost.
#819's AWS Config arm turns on a derived minter, and it is the first place the benefit shows up
somewhere other than replay.
cfgsvcMintRecorderIDderives a configuration recorder's ID bySHA-256 over (account, Region, name), truncated to a fixed 8 characters — the same shape
cfnNameSuffixandcfgsvcMintRuleIDalready use. Because of that, a recorder's ARN is identicalacross a redeploy, and so is a rule's, which is minted from the rule name the same way.
That is what made #819's clobber/removal assertion writable for Config and unwritable for ten of the
twelve types before it. The reconciliation's two safeguards can only be observed on a second
deployment — a caller's own tag is preserved by comparing it against what the stack previously
propagated, and a withdrawn stack tag is removed only when the stored value still matches — and an
UpdateStackre-creates every resource in the template. A type whose create mints a fresh identity istherefore never revisited at the record a caller could have tagged, so the assertion has nothing to
assert against. A KMS key is the clean example: its update mints a new key, which is why that
spelling's defect had to be covered through an exported accessor instead.
So the argument for this issue is not only "a recorded run replays identically". It is also that a
derived identifier is what makes an update path testable at all, and there are behaviours — both of
this one's safeguards among them — that are unobservable without one.
It does not shrink the issue, and it does not touch the collision class. A configuration recorder
is one per account and Region and a Config rule's name is unique within one, so both have a
unique-by-construction input to derive from. That is exactly what the seven collision sites do not
have — two access keys for one user,
RunInstanceswithMaxCount>1, two snapshots of one volume, twoSendMessages with one body, twoAssumeRoles with one session name, two multipart uploads on onekey, two identical Athena queries — so this is a demonstration of the easy half, not a precedent for
the hard one. Everything in the previous comment stands: 66
crypto/randminters with 26 behindrandomHex, the minting not namedgenerate*and therefore absent from this issue's inventory,Event.Sequenceunreachable at mint time, andTimeController.Now()advancing by wall-clock elapsed.16 remaining items
fix(#856): the identity, keys and certificates family of draw sites (#…
scttfrdmn commentedon Sep 26, 2026
Tier 4 shipped — identity, keys and certificates (PR #1287,
f56717d)Eight generators across seven services move onto
IDMint: Cognito (both the user-pool and theidentity-pool API), IAM Identity Center, KMS, ACM, Secrets Manager, WAFv2, and API Gateway's API
keys.
rand.Readdraw sites: 23 → 15.Every rendering is byte-for-byte what the
crypto/randversion produced. Where the choice wasbetween
IDMint.UUIDandIDMint.HexUUID, the API model was consulted each time and settled nothingin three cases —
API_ApiKeypublishes no length and no pattern on eitheridorvalue,API_KeyMetadata.KeyIdpublishes 1–2048 and no pattern,CertificateArn's pattern admits eitherform — so per #671 the existing rendering stays. WAFv2 is the one place the model speaks, and it is
indifferent to the RFC 4122 nibbles, so
UUID()preserves what was recorded.What this tier taught
Not every value that must be derived is an identifier. Three of the eight are values a caller
hands back, which is what puts them in scope:
LockTokenmust be returned toUpdateWebACL, so a re-minted one answered a recordedupdate with
WAFOptimisticLockExceptioninstead of the recorded success.GetSecretValuereports an unknownVersionIdby omittingSecretStringrather than by refusing, so a replay answered a recordedread with a 200 that had silently lost a member — not a refusal any assertion would notice
without
Differences.GenerateDataKeystub data key is observed twice in one response, asPlaintextand wrappedinto
CiphertextBlob. A recordedDecryptwas never affected: substrate's ciphertext carries itsown plaintext, so the break was in the create, not the read.
One service was minting another's identifiers.
CreateApiKeyreached intogenerateACMCertIDforboth UUID-shaped strings it returns, so a change to ACM's rendering would have silently moved API
Gateway's. Worth grepping for on the remaining tiers.
The tier's replay assertion was shown non-vacuous by reverting
generateVersionIDtorandomHex: 21differences, comprising
VersionIdmajors on three operations, the lostSecretString, and astate-hash cascade through the rest of the stream.
Gaps filed rather than folded in
Keeping each tier shape-preserving is what lets its tests rest on "the rendering is unchanged", so:
VersionIdpublishes a minimum of 32,and
CreateSecret/PutSecretValuemint their own rather than using the caller'sClientRequestToken(RotateSecretalready echoes it).CreateUserPool/DescribeUserPool/UpdateUserPoolreport the pool ID asUserPool.UserPoolIdwhereUserPoolTypepublishesId. Found because the replay stream had toread
UserPoolIdto learn the pool ID at all;ListUserPoolsalready rendersId, so the servicedisagrees with itself.
The 15 that remain
Analytics —
athena_plugin.go:694,glue_plugin.go:864(viarandomHex),timestream_plugin.go:355(viarandomHex),opensearch_plugin.go:1002,redshiftdata_plugin.go:252,quicksight_plugin.go:297.CI/CD —
codebuild_plugin.go:364,codedeploy_plugin.go:426and:437,codedeploy_types.go:70,codepipeline_plugin.go:407.Long tail —
ssm_plugin.go:1040,ram_plugin.go:457,backup_plugin.go:461,bedrock_runtime_plugin.go:317.Then three that are not ordinary tiers:
cfn_deployer.go:4265— needs the deployer to thread a request ID through, which is also the workthat lets
IDMint's owncrypto/randfallback (ids.go:115) be removed.randomHex(ec2_types.go:500, with itsrand.Readat:502) once its four callers aregone.
ec2_plugin.go:879(anAIPA…instance-profile ID minted inside a describe) and EC2 key-pairmaterial, which needs a deterministic reader into the key generator rather than a derived
string — both their own issues rather than part of a tier.
docs(#856): three wording corrections
fix(#856): the analytics family of draw sites (#1288)
scttfrdmn commentedon Sep 26, 2026
Tier 5 shipped — the analytics family (PR #1288)
Seven generators across six services now derive from
IDMint: an Athena query execution ID, aRedshift Data statement ID, a Glue job-run ID, a Timestream
QueryId, an OpenSearch document_idand
_scroll_id(one generator, two kinds of value), and a QuickSight ingestion ID and responseRequestId. Every rendering is byte-for-byte the onecrypto/randproduced.What this tier taught
An analytics identifier names a submission, not a resource. That is the difference from the four
tiers before it: there is no caller-chosen name to fall back on, so the minted handle is the only
way to reach what was submitted. Athena is the extreme —
GetQueryExecution,GetQueryResultsandStopQueryExecutionall key on the one IDStartQueryExecutionreturned — and the refusals areper-service:
InvalidRequestException(Athena),ResourceNotFoundException(Redshift Data),EntityNotFoundException(Glue), anot_found404 for an OpenSearch document, andsearch_context_missing_exceptionfor a scroll cursor.Timestream is in the stream for the opposite property. Its
QueryIdreaches no later call —CancelQueryignores the ID it is given and answers an empty body — so a fresh draw there costs abody difference rather than a refusal. It is still a difference, and it is what makes a recorded
Queryreplay with zero differences at all.The published alphabet decided two renderings, not a preference.
API_query_QueryconstrainsQueryIdto[a-zA-Z0-9]+, which excludes the hyphen, so Timestream is 32 unbroken hexcharacters;
API_ExecuteStatementdocuments Redshift Data'sIdas a UUID and publishes the dashedpattern, so that one keeps its hyphens. Neither constrains a position, so both are indifferent to the
RFC 4122 version and variant bits — which is why
HexUUIDsatisfies the published pattern andderiving these preserved the exact rendering rather than quietly setting two nibbles (#671). Athena's
QueryExecutionIdpublishes\S+, which decides nothing; Glue'sJobRunIdadmits nearly any text,so the
jr_prefix stays as the service's own convention.One service in the family publishes no AWS pattern at all. OpenSearch's document and scroll APIs
are the domain's own REST interface, not the
es/opensearchcontrol plane, so substrate's sixteenURL-safe base64 characters are a convention it keeps rather than a constraint it meets (real
OpenSearch generates a wider 20-character Flake ID; substrate's was always narrower and #856 is not
where that changes). This is where
IDMint.Base64URLcomes from: a document ID travels in a URLpath, so
-and_are the alphabet and+and/are not.The cross-service borrow the tier-4 comment said to grep for turned up again.
CreateDataSetdrew its SPICE ingestion ID from the generator that mints the
RequestIdevery QuickSight responsecarries. An ingestion ID is a handle a recorded
DescribeIngestionURL contains, where a request IDis observed once and never sent back — so one function serving both meant a change to how a request
ID renders would have silently moved the identifier a recorded path depends on. Split, same as
ACM/API Gateway. That is two instances in two tiers; it is worth grepping for on every remaining
tier.
Non-vacuity
Reverting the Athena minter alone produces 38 differences and two refused reads out of the
19-request stream — the same check tier 4 ran with
generateVersionID.Census after tier 5
11 non-test
rand.Read(sites and 2randomHexcallers remain (the counters inids.go:64and
ec2_types.go:498are updated to match):codebuild_plugin.go:364(build ID,HexUUID),codedeploy_plugin.go:426and:437(application and deployment-group IDs,HexUUID),codedeploy_types.go:70(d-+ 9 uppercase alphanumerics,Chars),codepipeline_plugin.go:407(execution ID — the one site that already sets the RFC 4122 bits, so it wantsIDMint.UUIDrather thanHexUUID)ssm_plugin.go:1040,ram_plugin.go:457,backup_plugin.go:461,bedrock_runtime_plugin.go:317cfn_deployer.go:4265(randomHex(16)), which needs the deployer to thread a request id — the work that removesIDMint's owncrypto/randfallback atids.go:115randomHex(ec2_types.go:500) once its last caller movesTwo sites stay out of the tiering and want their own issues:
ec2_plugin.go:879, anAIPA…instanceprofile ID minted inside a describe rather than at create time, and EC2 key-pair material, which
needs a deterministic reader into the key generator rather than a derived string.
fix(#856): the CI/CD family of draw sites (#1289)
scttfrdmn commentedon Sep 26, 2026
Tier 6 (CI/CD) is merged — PR #1289, squash commit 2c90f4e. 6 draw sites remain on
crypto/rand.codepipeline_plugin.goexecution IDIDMint.UUIDcodebuild_plugin.gobuild IDIDMint.HexUUIDBuild.id: String, min length 1, no patterncodedeploy_plugin.goapplication + deployment-group IDsIDMint.HexUUIDcodedeploy_types.godeployment IDIDMint.Chars(9, A-Z0-9)d-IIMHK0NHCWhat this tier taught
A tier can have no unbounded-draw site. Every one of the five operations mints exactly once, so
the ordinal-on-a-batch assertion tiers 1–5 each made had nothing to bite on. What replaced it is a
rendering assertion — the version nibble and variant bits on a pipeline execution ID,
^d-[A-Z0-9]{9}$on a deployment ID — because that is the property this family could actually get wrong. Worth keeping
in mind for the remaining tiers: pick the test from where the tier's risk is, not from the template.
"Published pattern" and "constrains the rendering" are different questions. CodePipeline publishes
[0-9a-f]{8}-[0-9a-f]{4}-…, which looks like it pins a UUID and pins nothing about the versionposition. The pattern is satisfied by
HexUUIDtoo. The reason that site keepsUUIDis not the modelat all — it is that the
crypto/randcode set those two nibbles, so dropping them would change bytes aconsumer may be validating. #671 decides whether to invent a constraint; the no-byte-changes rule
decides which rendering where the model is silent, and here they point at different methods for
sites in the same family.
Reading AWS's own sample response is not the borrow #671 forbids.
CreateDeploymentpublishes nopattern for
deploymentId, but the page showsd-IIMHK0NHC. That is observed provenance from theauthoritative source, not a bound lifted from a sibling operation, and it is all the reference offers.
docs/services.mdhad been calling that shape published — corrected in this PR.An underived ID does not always produce a refusal.
BatchGetBuildsreports an unknown build IDunder
buildsNotFoundin a 200 with an emptybuildslist, so a re-minted build ID answered aconsumer's wait-for-
buildStatusloop with nothing to wait on rather than failing it. That is thestalls-rather-than-fails shape, and it is the third distinct failure mode this migration has found
after outright refusal and the silently-missing-member one (Secrets Manager's
SecretString).Non-vacuity, checked numerically as in the tiers above: reverting
generateCodeDeployDeploymentIDalone to a seedless mint produces 10 differences and one refused read out of the 12-request stream,
with
DeploymentDoesNotExistExceptionon the recordedGetDeploymentand cascadingstate_hash_before/state_hash_afterdivergence through CodePipeline.Remaining
ssm_plugin.go:1040(command ID),ram_plugin.go:457(resource-share ID),backup_plugin.go:461(plan, version and selection IDs — four call sites, two of them in oneCreateBackupPlanrequest, which gives this tier its ordinal test back),bedrock_runtime_plugin.go:317(model-invocation job ID). All four render theHexUUIDshape todaycfn_deployer.go:4265viarandomHex, which needs the deployer to thread a request ID through its internal contexts. This is the work that letsIDMint'scrypto/randfallback atids.go:115be removed, after whichrandomHex(ec2_types.go:500) can be deletedTwo sites still want issues of their own rather than a tier:
ec2_plugin.go:879(anAIPA…instance-profileID minted inside a describe, which is a bug independent of derivation) and EC2 key-pair material,
which needs a deterministic reader into the key generator rather than a derived string.
fix(#856): the long tail of draw sites — SSM, RAM, Backup and Bedrock (…
scttfrdmn commentedon Sep 26, 2026
Tier 7 — the long tail — merged
PR #1290. Four generators across four unrelated services: an SSM Run Command
CommandId, theidentifier inside a RAM
resourceShareArn, AWS Backup'sBackupPlanId/VersionId/SelectionId(four call sites), and a Bedrock batch-inference job ID.
Three keep the rendering their draw site produced, because their pages publish no pattern (#671).
Bedrock's does not, and it is the one shape change in the whole migration:
jobArnis publishedas
arn:aws:bedrock:{region}:{account}:model-invocation-job/[a-z0-9]{12}andjobIdentifieras thatARN or a bare
[a-z0-9]{12}— the alphabet excludes the hyphen and the length is twelve, so the36-character UUID substrate minted satisfied neither. The no-byte-changes rule protects a rendering
the model permits; it cannot protect one the model forbids.
Backup gave the tier back the ordinal assertion tier 6 had to do without:
CreateBackupPlanis theonly draw site in the tree that mints twice in one request. Non-vacuity: reverting that minter alone
produces 14 differences and 3 refused reads out of a 10-request stream, because a selection is
stored under its plan ID and a re-minted plan strands the selection too.
What is left, and it is not what the counter says
The
TODO(#856)counter now reads 2 draw sites:randomHex(one caller) andIDMint's ownseedless fallback. Both numbers are true about literal
rand.Readcall sites and both understate theremaining surface, because the fallback is reached through every internal dispatch that builds a
RequestContextwithout anIDsmint:crypto/randbecause of itcfn_deployer.go:4592(dispatch)apigateway_plugin.go:1631lambda_plugin.go:1620/:1692ReceiveMessage(which mints receipt handles) and the invoke it drivescfn_deployer.go:4265(deploySSMAssociation)AWS::SSM::Associationphysical ID, the one remainingrandomHexcallerThe replay side is already right:
replay.go:482seeds every replayed event from its recordedrequest ID, and the deployer records each internal dispatch as its own event. So the divergence in a
CloudFormation stream is entirely on the recording side — the recording drew randomly, the replay
derives, and the two disagree.
Which makes tier 8 a different shape from tiers 1–7. It is not "move four more generators"; it is:
NewIDMint(reqCtx.RequestID)directly, since the request ID is recorded and the replay reuses it.
CreateStackis also an event, so a replayre-runs the whole deployment as well as replaying each internal event — and a re-run calls
generateRequestID()for each internal dispatch, which is wall-clock. So the deployer's internalrequest IDs have to be derived from the outer request's mint rather than generated, which is
what makes a re-deployment reproduce itself.
randomHexand the seedless fallback can both go, andNewIDMint("")stops being asupported state.
That third step is the one this issue has been aiming at, and step 2 is the reason it could not
happen earlier. I will file the analysis as the tier-8 plan before writing any of it.
scttfrdmn commentedon Sep 26, 2026
Tier 8 plan — the internal dispatch paths, and a correction to the comment above
Two things I got wrong in the comment above, found by reading the code rather than the counter.
The seedless fallback cannot be deleted, and should not be.
IDMint's nil-receiver andempty-seed paths are a public affordance, not a migration artefact: a consumer writing a plugin test
constructs
&emulator.RequestContext{AccountID: …, Region: …}by hand — substrate's ownram_plugin_test.go,backup_plugin_test.goand dozens of others do exactly that — and every one ofthose contexts has a nil
IDs. Removing the fallback would turn each into a panic.generateRequestIDalso draws through
NewIDMint(""), and the request ID is the seed, so it must stay random by design.So tier 8 ends with the fallback documented as intentional and reached by nothing that a replay
observes, rather than deleted.
randomHexhas one blocker that is not the deployer. Its second caller mints anAIPA…instanceprofile ID inside the item builder shared by
RunInstancesandDescribeInstances, so two describesof one instance report two different IDs. That is a fidelity bug rather than a derivation one and it
is now #1291;
randomHexgoes when both it and the deployer are done.What tier 8 actually changes
The deployment walk is already deterministic —
DeployWithOptionssorts its entries by(typePriority, logicalID)before dispatching — so a single mint per deployment reproduces the samesequence of internal request IDs on a re-run of the same template. That is what makes this tractable
without threading a logical ID through every dispatch site.
StackDeployergains a mint andWithDeployerMint, anddeployerForpassesreqCtx.IDs, so astack's deployment derives from the request that asked for it.
client.go's in-process deployerseeds one from a fresh request ID: its outer call is not a recorded AWS request, so a random seed
there is harmless — the internal events it records carry the derived IDs a replay reuses.
dispatchderives each internal request ID from that mint instead of callinggenerateRequestID(), and setsIDs: NewIDMint(thatID)on the context it dispatches. Both halvesare needed and they fix different failures: setting
IDsmakes a replayed internal eventreproduce its recording, and deriving the request ID makes a replayed outer
CreateStack—which re-runs the whole deployment — reproduce it too.
deploySSMAssociationmints from the deployer's mint, which removesrandomHex's deployer caller.IDs: NewIDMint(reqCtx.RequestID):apigateway_plugin.go:1631(a proxy integration's Lambda invoke) andlambda_plugin.go:1620/:1692(an ESM's SQS
ReceiveMessage, which mints receipt handles, and the invoke it drives).Verification
The regression test is the one this issue has never been able to write: record a stack with a handful
of resources, replay the stream with
ValidateState, and assert zero differences — including on theouter
CreateStackevent, whosestate_hash_aftercovers every resource identifier in the stack.Non-vacuity the usual way, by reverting one of the two halves of step 2 and counting what breaks.
fix(#856): the internal dispatch paths (#1293)
scttfrdmn commentedon Sep 26, 2026
Tier 8 — the internal dispatch paths
Merged as #1293. This is the tier the draw-site counter could not have found, and it is
the largest single correction in the issue.
What was wrong. Every earlier tier migrated a generator. Counting generators answers the
wrong question: a plugin whose minters are all migrated still publishes random identifiers if it
is called with nothing to derive from. Substrate has four internal dispatch sites — a
RequestContextbuilt in-process rather than parsed off the wire — and the CloudFormationdeployer is one of them. Deploying a stack turns each resource into an internal EC2, IAM or S3
request, built with a fresh
generateRequestID()and no mint, so every plugin it reached tookIDMint's seedless fallback.The consequence: every identifier of every resource in every CloudFormation stack was
undirected randomness, while the counter read "2 draw sites remaining" — because
StackDeployercontains no
rand.Readcall of its own. A replayedDescribeStackResourcesreported fourdifferent
PhysicalResourceIdvalues in a 200, andCreateStack'sstate_hash_afternevermatched, because that hash covers all of them.
What fixed it — two changes, two different failures.
dispatchsetsIDs: NewIDMint(requestID). This makes a replayed internal event reproduce.WithDeployerMintderives the internal request id from the mint of the request that asked forthe deployment. This makes a replayed outer
CreateStackreproduce — replaying it re-runs thewhole deployment, so the internal ids have to come out the same way twice. Reproducible because
DeployWithOptionsalready sorts by type priority then logical id, never by map iteration.Both halves measured by reverting each alone against the new replay test: 7 differences
without the mint, 6 without the derived request id. In both cases the replay reported every
event as a success — the silent-wrong-answer class, not a visible failure.
Three things fell out of the same seam.
DetectStackDriftwas answering aStackDriftDetectionIdthat was substrate's internalreq-…string verbatim, a shape no AWSreference describes, in an element a consumer hands back to
DescribeStackDriftDetectionStatus;it is now UUID-shaped within the published maximum length of 36 (observed from the page's own
sample,
2f2b2d60-df86-11e7-bea1-500c2example).deploySSMAssociationwas the deployer's lastrandomHexcaller. And an API Gateway proxy integration now carries a derived mint into theLambda invocation it dispatches.
Deliberately out. The other two internal dispatch sites are both in the Lambda ESM poller.
Its dispatches come from a wall-clock ticker and are recorded nowhere, so there is no recorded id
to derive from and a seed there would be no more reproducible than the fallback — #1292, with an
in-code note at the site.
The regression test this issue could not previously write now exists: record a four-resource
stack over three services, replay with
ValidateState, assert zeroDifferences,TotalEvents == SuccessEventsandStateValidtrue — including on the outerCreateStack.Where the issue stands
rand.Readsites: 2 —randomHexandIDMint's own fallback.randomHexcallers: 1 — theAIPA…instance-profile id minted inside a describe, whichis a fidelity bug in its own right (An EC2 instance profile's AIPA… ID is minted on every describe, so a read is not idempotent #1291).
randomHexcan be deleted when that moves.IDMintseedless fallback stays, and is documented as intentional: a nil or seedlessmint is what every hand-built
RequestContextcarries, which is how every plugin unit test —substrate's and a consumer's — constructs one, and
generateRequestIDdraws through it becausethe request id is the seed and is deliberately random (replay: a success body's RequestId derives from the wall clock and the event never records it, so a recorded run cannot be reproduced #866).
the key generator rather than a derived string.
scttfrdmn commentedon Sep 30, 2026
The draw-site migration is complete
randomHexis deleted. Its last caller was theAIPA…instance-profile id EC2 minted inside adescribe, which #1291 resolved out of IAM state instead — so no plugin draws an identifier from
crypto/rand, andIDMint.bytes's own seedless fallback is the only read of it left in the tree.A correction to #1291's own text while I am here: it was filed expecting
randomHexto keep onecaller, the CloudFormation deployer. The deployer never called it. Tier 8 gave the deployer's
internal dispatch a derived mint rather than moving a draw, so the deployer's
randomHexuse hadalready gone by the time #1291 was reached, and the count of "2 remaining draw sites" in the tier-7
changelog entry was one site plus the fallback, not two sites. The entry is corrected in the same
## [Unreleased]section rather than left to be read as history.Why that fallback stays. A nil or seedless mint is what a hand-built
RequestContextcarries,and that is how every plugin unit test constructs one — substrate's and a consumer's. Removing the
fallback would make those panic or mint a constant, and a constant collides two resources onto one
id.
generateRequestIDalso draws through it, because the request id is the seed and #866 settledthat it stays wall-clock and recorded rather than derived.
What is still not derived, and why each one is not a gap
no AWS call observes.
nowhere, so a replay has nothing to derive from. Tracked on A Lambda ESM polls on the wall clock and records nothing, so its effect on state is neither frozen nor replayable #1292, which stays open by design.
replayed
CreateKeyPairstill answers a different key and fingerprint, because the generatorneeds a deterministic
io.Readerrather than a derived string. Substantively different work froma draw-site move.
instance id, a NAT gateway's private IP from its gateway id, a secret's ARN from its name,
CloudFormation's stack and change-set ARNs from account and region, and now an unresolvable
instance profile's
AIPA…id from its own name. An EC2 instance profile's AIPA… ID is minted on every describe, so a read is not idempotent #1291 is worth reading as the boundary case here:a value that must be stable across two different requests cannot come from
IDMintat all,because a request-derived value is stable across a replay of one request and still differs between
two describes. That is the bug An EC2 instance profile's AIPA… ID is minted on every describe, so a read is not idempotent #1291 fixed, and it is why "derive it from the request id" is not
the universal answer.
Closing
Every acceptance criterion is met, and each is ticked above with where it landed:
docs/services.md, in its own section beside the CloudFormation UUIDnote it generalises, and in the
ids.gopreamble.IDMintonRequestContext.IDs; a helper minting without a request context inscope takes the mint as a parameter rather than reaching for a package-level source, which is what
keeps the answer from being given two ways.
RunInstanceswithMaxCount=3publishes three distinct instance ids.state_hash_afterandStateValid, twiceover and in a second process.
MemoryStateManager.Listordering question the issue folded in was already answered —Listsorts, and
state.gonow carries a note saying Identifiers minted from crypto/rand make a replay diverge from its recording, and three replay checks are weakened for it #856 asked for it explicitly.EC2 key-pair material is not one of the deliberately-random kinds; it is a fidelity gap with a
different mechanism — a deterministic
io.Readerinto the key generator, not a call toHex— so itis split out as #1296 rather than held here. #1292 stays open by design.
chore(release): v0.121.0 (#1369)