Repository navigation
Conversation
scripts/atlas/atlas.ts gains two commands beside scan. copy reads the shared, unexpired credentials from SOURCE_URI and writes them to a DynamoDB table through the app's own dynamodb store, keeping id and createdAt and setting expiresAt from the TTL. It checks the AWS account against --expect-account before anything else, is a dry run unless --write is given, never writes to the source, skips and counts unshared, expired, malformed and over-limit records, counts records an earlier run copied as already present, and prints counts only. synthetic writes a generated data set in Atlas's 2.x shape, with a TTL index on createdAt, to a MongoDB on localhost or 127.0.0.1 only, and prints what copy should report for it, so a rehearsal never needs real data. Both commands take the app's size limit and TTL from the app, and the oversize fixture is sized from that limit. Tests cover selection, mapping, the account check and the generator, and, under TEST_STORES with mongodb and dynamodb, synthetic then copy into DynamoDB Local, read back through the credential service, run twice. vitest now includes scripts/**. @aws-sdk/client-sts is a dev dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DynamoDB Local without -sharedDb, as CI runs it, keeps a separate set of tables per access key, so copy --expect-account local could not see the table the rehearsal test created with key test. copy now signs with test, exported as LOCAL_CREDENTIALS, and the test uses the same constant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Stacked on #286 — review and merge that first.
Adds two commands to
scripts/atlas/atlas.ts, besidescan, for moving shared credentials from Atlas to the DynamoDB table the app uses on Lambda. Both are run by hand; neither is part of the app or its deployment.copyreads the shared, unexpired credentials fromSOURCE_URIand writes them through the app's owndynamodbstore (put, create-only-if-absent), keepingidandcreatedAtand settingexpiresAtfrom the TTL. It checks the AWS account against--expect-accountbefore anything else, is a dry run unless--writeis given, never writes to the source, skips and counts unshared, expired, malformed and over-limit records, counts records an earlier run copied as "already present" (so it can run before and after the DNS switch), and prints counts only.--sample-linksprints a few/credentials/<id>paths, for the staging account only.syntheticwrites a generated data set in Atlas's 2.x record shape, with a TTL index oncreatedAt, to a MongoDB onlocalhostor127.0.0.1only, and prints whatcopyshould report for it. A rehearsal never needs real data.Both take the size limit (
MAX_SHARED_VP_BYTES) and the TTL from the app's own modules, and the over-limit fixture is sized from that limit.scannow imports the same constants instead of repeating them.copyandsyntheticreadSOURCE_*rather thanATLAS_*because their source is Atlas only in the production run; the README explains this and gives the rehearsal and production procedures.The TTL index
syntheticcreates (365 days) is assumed: confirm it againstscan's output for production Atlas.New dev dependency:
@aws-sdk/client-sts, for the account check.vitestnow also runsscripts/**/*.test.ts.Validation (local)
npm test: 164 passed, 33 skipped.npx tsc --noEmit: clean.docker compose -f docker-compose.test.yml up -dthennpm run test:stores: 197 passed. This includes an end-to-end test that runssyntheticinto MongoDB andcopy --writeinto DynamoDB Local, reads copied records back through the credential service, and runs the copy a second time to see every record counted as already present.synthetic, thencopyas a dry run, with--write, and with--writeagain;scanon the same data; and each refusal and error path. Nothing was run against AWS or Atlas.🤖 Generated with Claude Code