Repository navigation
chore: remove autoscale leftovers; mapping script deletes orphaned stream mappings (#1434) - #1435
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Fixes #1434
Removes what autoscale (#772) left behind. Its table
spawn-autoscale-groups-productionno longer exists. This PR also gives the processor's stream mappings a named deleter.What changed
lambda/dashboard-websocket-processor/main.go: dropped thespawn-autoscale-groups-productioncase andparseAutoscaleEvent. A record from an unknown table was already skipped.lambda/dashboard-api/scripts/setup-dashboard-lambda-role.sh:ProcessorStreamsnow grants only${T}/spawn-sweep-orchestration/stream/*.lambda/dashboard-websocket/scripts/enable-streams.shandsetup-event-source-mappings.sh: the autoscale table is removed fromTABLES.setup-event-source-mappings.shnow lists every mapping onspawn-dashboard-websocket-processor. For each DynamoDB-stream source it runsdescribe-tableon the source table, and deletes the mapping only onResourceNotFoundException, printingRemoved 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 inTABLES.lambda/dashboard-api/scripts/backfill-autoscale-user-ids.pyand the/api/autoscale-groupshint insetup-all.sh.AutoScaleGroupInfo,GroupDetailInfoandGroupInstanceInfomodels fromlambda/dashboard-api/models.go.Readers of the removed models
~/src/spore-host(Go/TS/Python/JS).dashboard-api/main.goroutes no/api/autoscale-groups*path, so nothing produced these types either.spore-host/spore-hostorigin/main 489f26c): it still renders an Autoscale Groups tab.web/js/main.jsfetches/api/autoscale-groupsand its pause/resume/delete routes, andweb/js/websocket.jshandlesautoscale:update/autoscale:delete. Those routes are already gone, so the tab is broken today, and this PR doesn't change that. I didn't edit that repo; its removal is filed as Dashboard still renders an Autoscale Groups tab for the autoscale removed in spawn#772 spore-host#617.Gates (
dashboard_streams_test.go, root module)Each one was watched failing against a revert that compiles:
TestDashboardStreamTablesAgreeAndExist: the processor'sparseStreamRecordswitch, the role script'sProcessorStreamsresources, and theTABLESarrays in both scripts must name the same set of tables. Every table they name must be created by a repo shell script runningdynamodb create-table; those scripts are found by walking the tree, not listed by hand.TestMappingScriptDeletesOnlyMappingsWhoseTableIsGone: runs the real script under a fakeawson 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 inTABLES, a table whose describe-table fails with AccessDenied, and an SQS source. The script must delete only the first, report it, and create nothing.TestNothingNamesTheRemovedAutoscaleTable: no file outside CHANGELOG.md may namespawn-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 lintreports 0 issues in all 10 modules,semgrep scan --config=auto --error .is clean, andshellcheckis clean on both scripts. No AWS calls were made.Deploy steps (owner-approved, at the v0.151.0 deploy; infra account, us-east-1)
setup-dashboard-lambda-role.sh). Expect exactly one change, in theProcessorStreamsstatement: the resource${T}/spawn-autoscale-groups-production/stream/*is removed. Nothing else should differ.lambda/dashboard-websocket/scripts/setup-event-source-mappings.sh spore-host-infra. It should printRemoved event source mapping 0ea19b0f-85c4-4709-b8c3-e10cf7588494: table spawn-autoscale-groups-production no longer exists (...)andRemoved 1 event source mapping(s).... The sweep-orchestration mapping should report "already exists". Confirm withaws lambda list-event-source-mappings --function-name spawn-dashboard-websocket-processor --region us-east-1.spawn-dashboard-websocket-processorfrom the release tag.