Skip to content

chore: remove autoscale leftovers; mapping script deletes orphaned stream mappings (#1434) - #1435

Merged
scttfrdmn merged 3 commits into
mainfrom
chore/1434-autoscale-leftovers
Oct 30, 2026
Merged

scttfrdmn merged 3 commits into
mainfrom
chore/1434-autoscale-leftovers

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Fixes #1434

Removes what autoscale (#772) left behind. Its table spawn-autoscale-groups-production no longer exists. This PR also gives the processor's stream mappings a named deleter.

What changed

  • lambda/dashboard-websocket-processor/main.go: dropped the spawn-autoscale-groups-production case and parseAutoscaleEvent. A record from an unknown table was already skipped.
  • lambda/dashboard-api/scripts/setup-dashboard-lambda-role.sh: ProcessorStreams now grants only ${T}/spawn-sweep-orchestration/stream/*.
  • lambda/dashboard-websocket/scripts/enable-streams.sh and setup-event-source-mappings.sh: the autoscale table is removed from TABLES.
  • Named deleter. setup-event-source-mappings.sh now lists every mapping on spawn-dashboard-websocket-processor. For each DynamoDB-stream source it runs describe-table on the source table, and deletes the mapping only on ResourceNotFoundException, printing Removed event source mapping <uuid>: table <t> no longer exists (<arn>) and a count. Any other error (AccessDenied, throttling) keeps the mapping with a warning. Non-DynamoDB mappings are never touched. A mapping for an existing table is never deleted, even when that table isn't in TABLES.
  • Removed lambda/dashboard-api/scripts/backfill-autoscale-user-ids.py and the /api/autoscale-groups hint in setup-all.sh.
  • Removed the AutoScaleGroupInfo, GroupDetailInfo and GroupInstanceInfo models from lambda/dashboard-api/models.go.

Readers of the removed models

Gates (dashboard_streams_test.go, root module)

Each one was watched failing against a revert that compiles:

  • TestDashboardStreamTablesAgreeAndExist: the processor's parseStreamRecord switch, the role script's ProcessorStreams resources, and the TABLES arrays in both scripts must name the same set of tables. Every table they name must be created by a repo shell script running dynamodb create-table; those scripts are found by walking the tree, not listed by hand.
    • Restoring main's processor makes it fail: the three lists disagree, and nothing creates the autoscale table.
    • Adding an extra stream to the role script makes it fail.
    • Adding an extra table to the mapping script makes it fail.
    • Restoring main's enable-streams.sh makes it fail.
    • Adding a ghost table consistently to all four makes it fail with "no setup script creates".
  • TestMappingScriptDeletesOnlyMappingsWhoseTableIsGone: runs the real script under a fake aws on PATH, in the style of setup-dashboard-lambda-role.sh can't delete the legacy managed policy (multiple versions); the role keeps three now-redundant hand-added inline policies #1376. The fixture has five mappings: one whose table is gone (0ea19b0f…), the sweep table's, another existing table that isn't in TABLES, a table whose describe-table fails with AccessDenied, and an SQS source. The script must delete only the first, report it, and create nothing.
    • Main's script without the deleter makes it fail (nothing deleted, nothing reported).
    • Deleting on any describe error makes it fail (the AccessDenied mapping is deleted).
    • Deleting without checking the table makes it fail (all four DynamoDB mappings are deleted).
    • Changing the report line makes it fail.
  • TestNothingNamesTheRemovedAutoscaleTable: no file outside CHANGELOG.md may name spawn-autoscale-groups. Restoring the backfill script makes it fail; so does restoring main's enable-streams.sh.

Checks

make check (from /private/tmp) passes, make lint reports 0 issues in all 10 modules, semgrep scan --config=auto --error . is clean, and shellcheck is clean on both scripts. No AWS calls were made.

Deploy steps (owner-approved, at the v0.151.0 deploy; infra account, us-east-1)

  1. Dry-run the role script (setup-dashboard-lambda-role.sh). Expect exactly one change, in the ProcessorStreams statement: the resource ${T}/spawn-autoscale-groups-production/stream/* is removed. Nothing else should differ.
  2. Run lambda/dashboard-websocket/scripts/setup-event-source-mappings.sh spore-host-infra. It should print Removed event source mapping 0ea19b0f-85c4-4709-b8c3-e10cf7588494: table spawn-autoscale-groups-production no longer exists (...) and Removed 1 event source mapping(s).... The sweep-orchestration mapping should report "already exists". Confirm with aws lambda list-event-source-mappings --function-name spawn-dashboard-websocket-processor --region us-east-1.
  3. Redeploy spawn-dashboard-websocket-processor from the release tag.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 057c155 into main Oct 30, 2026
9 checks passed
@scttfrdmn
scttfrdmn deleted the chore/1434-autoscale-leftovers branch October 30, 2026 03:54
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.

Leftovers of removed autoscale (#772): a dangling disabled event-source mapping and stale references to spawn-autoscale-groups-production

1 participant