Repository navigation
fix(ci): unbreak the kind probe and widen the ECR retention window - #1108
Merged
Merged
Conversation
#1075 (7cad4ad) reprojected list_job_tasks through TaskInstanceWire, which does not carry token_hash, and added a test that the public list must omit it. check_kind.sh still subscripted the field, so phase 1 died on `KeyError: 'token_hash'` and the probe has been red every day since 2026-11-10 — a sixth cause, and one a security fix introduced. Asserting `.get(...) is None` would stop the crash and prove nothing, since the key can no longer be present. This asserts the property the wire projection guarantees, which has a real failure mode: re-exposure. Mutation- tested — passes on today's shape, fails both with the field re-added as null and with a real hash, so it is strictly stronger than the assertion it replaces. Closes #1106
"Retain the last 30 images" reads as weeks and measured ~1.5 days, which is what broke a dev namespace pinned to a 33-day-old tag with `ErrImagePull ... not found`. The budget counts MANIFESTS and one build pushes three: measured on er-api, 16 tagged OCI indexes + 16 untagged platform manifests + 16 untagged buildkit attestations = 48. So 30 manifests was ten pullable builds. The tempting fix is an expire-untagged rule to reclaim that two-thirds. It would delete the platform children the tagged indexes resolve to — the 16/16/16 symmetry is not a coincidence — breaking every image in the registry. Raising the count is the only safe lever, and it stays a count because ECR permits one `tagStatus: any` rule, so an age rule cannot sit beside this one. Cost ceiling, from per-image sizes that double-count shared layers: 300 builds x (107 + 68 + 204) MB ~= 114 GB ~= $11/month. The three repos held 16.8 GB before this. Closes #1101
#1096 keyed aws_rds_cluster_instance.prod by identifier and carried the instances across with two moved blocks. That applied on 2026-11-17 — the cluster now has exactly one member, er-prod-2, the writer — so the blocks are inert. Records in their place that a single instance makes any reboot-requiring change an outage rather than a failover. Does not close #1100: its other half is re-measuring the RDS cost line, which needs ~3 days of billing data after the apply.
Contributor
terraform plan
Warning This plan DESTROYS resources in: core. Merging applies it unattended. core — 3 to add, 0 to change, 3 to DESTROYmodule.identity_center.data.aws_ssoadmin_instances.this: Reading...
data.aws_iam_policy_document.ci_tf_drift_refresh: Reading...
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Reading...
data.aws_iam_policy_document.ci_tf_plan_state: Reading...
data.aws_iam_policy_document.ci_tf_drift_refresh: Read complete after 0s [id=2350222434]
data.aws_iam_policy_document.ci_tf_plan_state: Read complete after 0s [id=2883378100]
data.aws_iam_policy_document.ci_tf_apply_no_prod_state: Read complete after 0s [id=2395007408]
data.aws_caller_identity.current: Reading...
data.aws_iam_policy_document.obs_pod_trust: Reading...
data.aws_iam_policy_document.obs_pod_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.audit_bucket: Reading...
data.aws_iam_policy_document.audit_bucket: Read complete after 0s [id=3031279952]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.cur_delivery: Reading...
data.aws_iam_policy_document.cur_delivery: Read complete after 0s [id=2207400467]
data.aws_iam_policy_document.config_bucket: Reading...
module.github_oidc.data.aws_iam_policy_document.trust: Reading...
data.aws_iam_policy_document.config_bucket: Read complete after 0s [id=4067691321]
data.aws_iam_policy_document.openobserve: Reading...
module.github_oidc.data.aws_iam_policy_document.trust: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.openobserve: Read complete after 0s [id=2662704728]
data.aws_iam_policy_document.sccache_write: Reading...
data.aws_iam_policy_document.sccache_read: Reading...
data.aws_iam_policy_document.sccache_write: Read complete after 0s [id=786296009]
data.aws_iam_policy_document.sccache_read: Read complete after 0s [id=2701062528]
module.github_oidc.data.aws_iam_policy_document.push: Reading...
module.github_oidc.data.aws_iam_policy_document.push: Read complete after 0s [id=2177873069]
data.aws_iam_policy_document.sccache_trust_read: Reading...
data.aws_iam_policy_document.ci_tf_plan_trust: Reading...
data.aws_iam_policy_document.ci_tf_apply_trust: Reading...
data.aws_iam_policy_document.sccache_trust_write: Reading...
data.aws_iam_policy_document.ci_tf_plan_trust: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.ci_tf_drift_trust: Reading...
data.aws_iam_policy_document.sccache_trust_write: Read complete after 0s [id=4060172364]
data.aws_iam_policy_document.ci_tf_drift_trust: Read complete after 0s [id=3359896184]
data.aws_iam_policy_document.sccache_trust_read: Read complete after 0s [id=1630650595]
data.aws_iam_policy_document.ci_tf_apply_trust: Read complete after 0s [id=2538345208]
data.aws_iam_policy_document.ci_tf_apply_prod_trust: Reading...
data.aws_iam_policy_document.ci_tf_apply_prod_trust: Read complete after 0s [id=3513372776]
module.identity_center.data.aws_ssoadmin_instances.this: Read complete after 0s [id=us-east-2]
module.identity_center.data.aws_identitystore_user.admin: Reading...
module.identity_center.data.aws_identitystore_user.admin: Read complete after 0s [id=b17b2500-e0b1-7046-405b-23c088cf392b]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# aws_ecr_lifecycle_policy.this["er-api"] must be replaced
-/+ resource "aws_ecr_lifecycle_policy" "this" {
~ id = "er-api" -> (known after apply)
~ policy = jsonencode(
~ {
~ rules = [
~ {
~ description = "Retain the last 30 images" -> "Retain the last 900 manifests (~300 builds; 3 manifests per build)"
~ selection = {
~ countNumber = 30 -> 900
# (2 unchanged attributes hidden)
}
# (2 unchanged attributes hidden)
},
]
} # forces replacement
)
~ registry_id = "797781631727" -> (known after apply)
# (2 unchanged attributes hidden)
}
# aws_ecr_lifecycle_policy.this["er-pipeline"] must be replaced
-/+ resource "aws_ecr_lifecycle_policy" "this" {
~ id = "er-pipeline" -> (known after apply)
~ policy = jsonencode(
~ {
~ rules = [
~ {
~ description = "Retain the last 30 images" -> "Retain the last 900 manifests (~300 builds; 3 manifests per build)"
~ selection = {
~ countNumber = 30 -> 900
# (2 unchanged attributes hidden)
}
# (2 unchanged attributes hidden)
},
]
} # forces replacement
)
~ registry_id = "797781631727" -> (known after apply)
# (2 unchanged attributes hidden)
}
# aws_ecr_lifecycle_policy.this["er-web"] must be replaced
-/+ resource "aws_ecr_lifecycle_policy" "this" {
~ id = "er-web" -> (known after apply)
~ policy = jsonencode(
~ {
~ rules = [
~ {
~ description = "Retain the last 30 images" -> "Retain the last 900 manifests (~300 builds; 3 manifests per build)"
~ selection = {
~ countNumber = 30 -> 900
# (2 unchanged attributes hidden)
}
# (2 unchanged attributes hidden)
},
]
} # forces replacement
)
~ registry_id = "797781631727" -> (known after apply)
# (2 unchanged attributes hidden)
}
Plan: 3 to add, 0 to change, 3 to destroy.
|
This was referenced Nov 25, 2026
Closed
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 #1106
Closes #1101
Three follow-ups from the cost review and the open-PR sweep. Each is small; the
reasoning behind two of them is the part worth reading, because in both cases
the obvious fix is wrong.
1. The kind probe — red seven days, and a security fix caused it
#1075(7cad4ad) reprojectedlist_job_tasksthroughTaskInstanceWire,which does not carry
token_hash, and added a test that the public list mustomit it.
scripts/check_kind.shstill subscripted the field, so phase 1 diedon
KeyError: 'token_hash'. The API change landed 11-09; the probe went red11-10 and stayed red.
The obvious repair is
t.get("token_hash") is None. That stops the crash andasserts nothing — the key can no longer be present, so the condition cannot
fail. Instead this asserts the property the wire projection actually
guarantees, which has a real failure mode (someone re-exposing the field).
Mutation-tested by running the extracted phase-1 block against three shapes:
exit=0nullexit=1exit=1Note the middle row: the old assertion would have passed a re-exposed
null. This is strictly stronger than what it replaces, not a weakening to getgreen.
2. The ECR window — the free-looking fix destroys the registry
"Retain the last 30 images" reads as weeks and measured ~1.5 days, which is
what broke a dev namespace pinned to a 33-day-old tag with
ErrImagePull ... not found— a message that reads as a registry fault.The budget counts manifests, and one build pushes three. Measured on
er-api(48 manifests, 16 tagged):So 30 manifests was ten pullable builds, which at the measured ~10
builds/day is the 1.5-day window.
Two-thirds of the budget being untagged looks like free headroom, and an
expire-untagged rule is the natural reach. It would break every image in the
registry — the 16/16/16 symmetry is not a coincidence, those untagged
manifests are the live children of the tagged indexes, so expiring them deletes
the platform image each tag resolves to. Raising the count is the only safe
lever here, and it stays a count rather than an age because ECR permits one
tagStatus: anyrule, so an age rule cannot sit beside this one and anytag-scoped rule reintroduces the hazard.
900 manifests = ~300 builds = ~30 days at the measured rate, and longer while
the repo is quiet, which is the idle-dev-namespace case. Cost ceiling, using
per-image sizes that double-count shared layers so the real figure is lower:
300 x (107 + 68 + 204) MB ~= 114 GB ~= $11/month. The three repos held 16.8 GBbefore this.
3. The applied Aurora
movedblocks#1096 keyed
aws_rds_cluster_instance.prodby identifier and carried theinstances across with two
movedblocks. That applied — the cluster now hasexactly one member,
er-prod-2, the writer — so they are inert. Removed, andthe comment now records that a single instance makes any reboot-requiring
change (a static cluster parameter, say) an outage rather than a failover.
This does not close #1100. Its other half is re-measuring the RDS cost line
to confirm the ~$1.44/day fall was real rather than inferred from the ACU
floor, and that needs ~3 days of billing data after the apply.
Post-merge ledger
Closed by: agent · session
f14bf995-5565-41eb-9658-d3746dc3188eonMac· 2026-11-17T06:20:00Zmainis green with this change on it — merge SHA2d3a32bef453cd16ea26a5397ae7a2effb8db125, which is currentmain. Onthat SHA:
rust,frontend,infraanddevcontainerallcompleted/success.mainhad not moved since the branch was cut(
5723b006both times), so the green was not stale.images— n/a — correctly never ran.images.yml's push paths arerust/**,frontend/**,infra/k8s/**,scripts/dev_env.sh,scripts/obs_up.sh,scripts/ci/images-detect.shand the two workflowfiles. This change touches
scripts/check_kind.shandinfra/terraform/**, none of which is an image input. Verified: noimagesrun exists for this SHA.deploy— n/a —deploy.ymlis triggered only byworkflow_run: [images], andimagescorrectly did not run, so no deployfired and none should have. Nothing that goes into a running process
changed; the Terraform was applied by
infrainstead (below).of this change:
kind— dispatch run44025072671on the branch,completed/success,check_kind: ALL PHASES PASS, including the line that was crashing:phase 1 ok: both rows succeeded as real pods. This is the only way toprove it, since the probe is
if: github.event_name != 'pull_request'.drift— run44028569138, all four legs green (core,dev,prod,state-backend). See the note below on why it had been red.CLOSEDthroughGitHub's closing references rather than by hand.
(the unconfirmed SNS subscription, which is the real cause of the
driftred and needs one click from the owner) and Post-apply cleanup for the prod Aurora reader removal: drop the moved blocks, confirm the saving #1100 (re-measure the RDS
line; earliest meaningful read 2026-11-20).
kind-probe-never-passedupdated with the sixth cause and theOTLP-noise-at-the-tail trap, plus
ecr-retain-30-is-a-day-and-a-halfcorrected: the window is30 ÷ 3 manifests-per-build = ten builds, and the expire-untagged "fix"
would delete the tagged indexes' platform children.
Specific to this change
44025072671, all six phases, as above. A pull request cannot run it andthis one did not; the PR's green says nothing about the probe.
apply (core)applied the ECR policy, and the live policy reads 900on all three repositories — read back rather than inferred from the apply
conclusion:
er-api: countNumber=900,er-web: countNumber=900,er-pipeline: countNumber=900, eachimageCountMoreThan/tagStatus=any.The three
destroys in the plan were lifecycle-policy replacements, notimages, which is why
ALLOW-DESTROYwas correct to pass here.apply (prod)planned 0/0/0 for themovedremoval —plan (prod)readNo changes. Your infrastructure matches the configuration.andapply (prod)succeeded. Deleting an appliedmovedblock is a no-op, and anything else would have meant the state did not
move the way Remove the prod Aurora reader replica (-$43/mo, gives up automatic failover) #1096 believed.
drift (prod)red seen immediately after this merge wasinvestigated, not waved through. It reported
REAL DRIFT: aws_rds_cluster.prod [cluster_members]— a stale computedattribute left by Remove the prod Aurora reader replica (-$43/mo, gives up automatic failover) #1096's reader removal. It was a race, not a finding:
that drift run started at 06:02:07 and
apply (prod)ran 06:02:13→06:03:00,so the refresh-only plan read state mid-apply. Re-dispatching
driftafter the apply returned all four legs green.
said "Does not close Post-apply cleanup for the prod Aurora reader removal: drop the moved blocks, confirm the saving #1100" and GitHub's parser matched
close #1100, ignoring the negation. Reopened with the outstandingmeasurement recorded on it.
Context
drift (core), which was the other half of #1106 as originally filed, is notfixed here and is not broken. It was correctly reporting real drift: the
er-alertsSNS email subscription has never been confirmed, so AWS deleted thepending subscription about three days after the alarms were created.
tf-drift-classify.shflagged it exactly as designed. That is now #1107,which needs one click from the owner of the subscribed address — 19 alarms are
armed and reaching nobody — so #1106 was rescoped to the kind probe alone
rather than closed over a problem it does not cover.
Verified locally before pushing:
terraform fmt -check -recursive,credential-free
init -backend=false && validateon bothenvs/coreandenvs/prod,bash -n scripts/check_kind.sh, all five embedded python blockscompile, and
scripts-home-check/workflow-shell-check/tf-static-credentials-checkall pass. A full coldmake checkwas not run inthis worktree because the change touches no Rust and no frontend; CI runs it.