Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
acea6af
fix(cli-internal): replace lock rollback drift validation with stack …
iliapolo May 6, 2026
349c5fd
fix(cli-internal): revert retain policy to use RESOURCES_TO_RETAIN list
iliapolo May 6, 2026
c8626aa
chore: store locator needs to skip validations during refactor rollba…
iliapolo May 6, 2026
ccd2667
chore: dont run gen2 tests, remove cleanup dependency on migration e2es
iliapolo May 6, 2026
132101b
Merge branch 'dev' into epolon/e2e-rollback
iliapolo May 6, 2026
6e16383
fix(cli-internal): skip optional attributes in auth userAttributes ma…
iliapolo May 7, 2026
df9ea47
chore: reuse refresh logic, add lock rollback conditional resource check
iliapolo May 7, 2026
a2612b1
chore: touch function
iliapolo May 7, 2026
e950e6e
chore: remove init dep
iliapolo May 7, 2026
5881171
chore: mid work
iliapolo May 7, 2026
b90edd7
Merge branch 'dev' into epolon/e2e-rollback
iliapolo May 7, 2026
be69d6e
chore: revert a bunch
iliapolo May 7, 2026
fec938c
Merge branch 'dev' into epolon/e2e-rollback
iliapolo May 7, 2026
aa3cfea
chore: revert a bunch
iliapolo May 7, 2026
d78b9f8
Merge branch 'dev' into epolon/e2e-rollback
iliapolo May 7, 2026
44fbe6d
chore: add finance tracker e2e
iliapolo May 7, 2026
b54a497
chore: include windows tests
iliapolo May 7, 2026
b324620
chore: fixups
iliapolo May 8, 2026
f51b951
chore: fixups
iliapolo May 8, 2026
6aeec96
chore: pass directs creds to teardown is possible
iliapolo May 8, 2026
2660238
chore: log
iliapolo May 8, 2026
732f96a
chore: ignore cache in fromIni
iliapolo May 8, 2026
d2e1df5
chore(amplify-e2e-gen2-migration): consolidate e2e lifecycle into App…
iliapolo May 8, 2026
b66fd87
docs: update migration/config.json documentation
iliapolo May 8, 2026
7204710
chore: bring back windows exclusion
iliapolo May 8, 2026
82a3f74
chore: rename
iliapolo May 8, 2026
e49ca63
Merge branch 'dev' into epolon/e2e-rollback
iliapolo May 8, 2026
41cc57a
chore: override console logger
iliapolo May 8, 2026
6d72ad2
chore: checkout before retain
iliapolo May 8, 2026
2963f17
refactor(amplify-e2e-gen2-migration): extract printBanner helper
iliapolo May 8, 2026
409aaf5
refactor(amplify-e2e-gen2-migration): extract forward method and fix …
iliapolo May 8, 2026
b980944
refactor(amplify-e2e-gen2-migration): replace AWS CLI sts call with SDK
iliapolo May 9, 2026
16823ec
chore: touchups
iliapolo May 9, 2026
6a870d0
feat(amplify-e2e-gen2-migration): add post-rollback E2E hook and scripts
iliapolo May 9, 2026
ba597e5
test(cli-internal): add holding stack tests for auth cognito forward/…
iliapolo May 9, 2026
1be2255
chore: mid work
iliapolo May 9, 2026
954d262
fix(amplify-e2e-gen2-migration): add consistentRead and increase test…
iliapolo May 9, 2026
8e4758b
docs(amplify-e2e-tests): add duration and retry notes for gen2 migrat…
iliapolo May 9, 2026
a8e1f99
refactor(amplify-e2e-gen2-migration): push --debug into args array early
iliapolo May 9, 2026
566e0d2
chore: update snapshot
iliapolo May 10, 2026
adad78a
chore: fix script name
iliapolo May 10, 2026
ddadebd
fix(amplify-migration-tests): add explicit limit to list queries in t…
iliapolo May 10, 2026
6b1a303
chore: remove debug
iliapolo May 10, 2026
ca0fc02
chore(amplify-e2e-gen2-migration): remove --debug flag from push command
iliapolo May 10, 2026
2788dc4
fix(cli-internal): validate holding stack status before refactor oper…
iliapolo May 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions amplify-migration-apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Each app directory follows this layout:
│ ├── config.json # E2E system configuration (optional)
│ ├── post-generate.ts # Fixups after gen2-migration generate
│ ├── post-push.ts # Fixups after amplify push (optional)
│ └── post-refactor.ts # Fixups after gen2-migration refactor
│ ├── post-refactor.ts # Fixups after gen2-migration refactor
│ └── post-rollback.ts # Reverses post-refactor fixups after rollback (optional)
├── tests/ # Jest test suites for validating deployed stacks
│ ├── signup.ts # Cognito user provisioning (app-specific)
│ ├── jest.setup.ts # Jest setup (retry config)
Expand Down Expand Up @@ -60,17 +61,34 @@ caller's working directory.
### `migration/config.json`

Configuration file read by the [E2E system](../packages/amplify-e2e-gen2-migration/) at runtime.
Currently supports:
Each key corresponds to a migration step and accepts a `StepConfig` object:

```json
{
"lock": { "skipValidations": true }
"lockForward": { "skipValidations": true },
"lockRollback": { "skipValidations": false },
"refactorForward": { "skip": true },
"refactorRollback": { "skipValidations": true },
"generate": { "skipValidations": true }
}
```

- `lock.skipValidations` — pass `--skip-validations` to `gen2-migration lock`.
| Field | Type | Description |
| ------------------ | ------------ | ------------------------------------------------------------ |
| `lockForward` | `StepConfig` | Config for `gen2-migration lock`. |
| `lockRollback` | `StepConfig` | Config for `gen2-migration lock --rollback`. |
| `refactorForward` | `StepConfig` | Config for `gen2-migration refactor`. |
| `refactorRollback` | `StepConfig` | Config for `gen2-migration refactor --rollback`. |
| `generate` | `StepConfig` | Config for `gen2-migration generate`. |

If the file does not exist, defaults are used (no skip-validations).
`StepConfig` fields:

| Field | Type | Description |
| ------------------ | --------- | -------------------------------------------------- |
| `skipValidations` | `boolean` | Pass `--skip-validations` to the step. |
| `skip` | `boolean` | Skip the step entirely. |

If the file does not exist, defaults are used (no skips, no skip-validations).

### `tests/`

Expand Down Expand Up @@ -104,6 +122,18 @@ If a script does not exist for an app, the E2E system silently skips the step.
> Some apps don't have `_snapshot.post.refactor/` because refactor doesn't work
> for them yet.

### `migration/post-rollback.ts`

Optional script that reverses the fixups applied by `post-refactor.ts` after a
`gen2-migration refactor --rollback`. For example, if `post-refactor.ts` uncomments
a function call in `amplify/backend.ts`, `post-rollback.ts` comments it back.

```typescript
export async function postRollback(appPath: string): Promise<void>;
```

If a script does not exist for an app, the E2E system silently skips the step.

### `migration/pre-push.ts` and `migration/post-sandbox.ts`

Optional scripts for additional lifecycle hooks:
Expand Down
33 changes: 33 additions & 0 deletions amplify-migration-apps/backend-only/migration/post-rollback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env npx ts-node
/**
* Post-rollback script for backend-only app.
*
* Reverses the manual edits applied by post-refactor:
* 1. Comment back the postRefactor() call in amplify/backend.ts
*/

import fs from 'fs/promises';
import path from 'path';

async function commentPostRefactorCall(appPath: string): Promise<void> {
const backendPath = path.join(appPath, 'amplify', 'backend.ts');
let content = await fs.readFile(backendPath, 'utf-8');

content = content.replace(/^(\s*)(postRefactor\(\);?)$/m, '$1// $2');

await fs.writeFile(backendPath, content, 'utf-8');
}

export async function postRollback(appPath: string): Promise<void> {
await commentPostRefactorCall(appPath);
}

async function main(): Promise<void> {
const [appPath = process.cwd()] = process.argv.slice(2);
await postRollback(appPath);
}

main().catch((error) => {
console.error('Fatal error:', error.message);
process.exit(1);
});
1 change: 1 addition & 0 deletions amplify-migration-apps/backend-only/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"pre-push": "true",
"post-generate": "npx tsx migration/post-generate.ts",
"post-refactor": "npx tsx migration/post-refactor.ts",
"post-rollback": "npx tsx migration/post-rollback.ts",
"post-sandbox": "true",
"pre-sandbox": "true",
"post-push": "true"
Expand Down
33 changes: 33 additions & 0 deletions amplify-migration-apps/discussions/migration/post-rollback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env npx ts-node
/**
* Post-rollback script for discussions app.
*
* Reverses the manual edits applied by post-refactor:
* 1. Comment back the postRefactor() call in amplify/backend.ts
*/

import fs from 'fs/promises';
import path from 'path';

async function commentPostRefactorCall(appPath: string): Promise<void> {
const backendPath = path.join(appPath, 'amplify', 'backend.ts');
let content = await fs.readFile(backendPath, 'utf-8');

content = content.replace(/^(\s*)(postRefactor\(\);?)$/m, '$1// $2');

await fs.writeFile(backendPath, content, 'utf-8');
}

export async function postRollback(appPath: string): Promise<void> {
await commentPostRefactorCall(appPath);
}

async function main(): Promise<void> {
const [appPath = process.cwd()] = process.argv.slice(2);
await postRollback(appPath);
}

main().catch((error) => {
console.error('Fatal error:', error.message);
process.exit(1);
});
1 change: 1 addition & 0 deletions amplify-migration-apps/discussions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"pre-push": "true",
"post-generate": "npx tsx migration/post-generate.ts",
"post-refactor": "npx tsx migration/post-refactor.ts",
"post-rollback": "npx tsx migration/post-rollback.ts",
"post-sandbox": "true",
"pre-sandbox": "true",
"post-push": "true"
Expand Down
6 changes: 3 additions & 3 deletions amplify-migration-apps/discussions/tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('Topic', () => {
});
const created = (createResult as any).data.createTopic;

const listResult = await client().graphql({ query: listTopics });
const listResult = await client().graphql({ query: listTopics, variables: { limit: 1000 } });
const items = (listResult as any).data.listTopics.items;

expect(Array.isArray(items)).toBe(true);
Expand Down Expand Up @@ -226,7 +226,7 @@ describe('Post', () => {
});
const created = (createResult as any).data.createPost;

const listResult = await client().graphql({ query: listPosts });
const listResult = await client().graphql({ query: listPosts, variables: { limit: 1000 } });
const items = (listResult as any).data.listPosts.items;

expect(Array.isArray(items)).toBe(true);
Expand Down Expand Up @@ -342,7 +342,7 @@ describe('Comment', () => {
});
const created = (createResult as any).data.createComment;

const listResult = await client().graphql({ query: listComments });
const listResult = await client().graphql({ query: listComments, variables: { limit: 1000 } });
const items = (listResult as any).data.listComments.items;

expect(Array.isArray(items)).toBe(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export class Customresolver extends Construct {
":category": $util.dynamodb.toDynamoDBJson($ctx.args.category)
}
},
"limit": $limit
"limit": $limit,
"consistentRead": true
}`;
// Response mapping template
const responseTemplate = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class cdkStack extends cdk.Stack {
":category": $util.dynamodb.toDynamoDBJson($ctx.args.category)
}
},
"limit": $limit
"limit": $limit,
"consistentRead": true
}`;

// Response mapping template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export class cdkStack extends cdk.Stack {
":category": $util.dynamodb.toDynamoDBJson($ctx.args.category)
}
},
"limit": $limit
"limit": $limit,
"consistentRead": true
}`;

// Response mapping template
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"refactor": { "skip": true },
"generate": { "skipValidations": true }
}
3 changes: 2 additions & 1 deletion amplify-migration-apps/finance-tracker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
"pre-push": "npx tsx migration/pre-push.ts",
"post-generate": "npx tsx migration/post-generate.ts",
"post-refactor": "true",
"post-rollback": "true",
"post-sandbox": "true",
"pre-sandbox": "true",
"post-push": "true",
"test:gen1": "APP_CONFIG_PATH=${APP_CONFIG_PATH:-src/amplifyconfiguration.json} NODE_OPTIONS='--experimental-vm-modules' jest --verbose",
"test:gen2": "APP_CONFIG_PATH=${APP_CONFIG_PATH:-amplify_outputs.json} NODE_OPTIONS='--experimental-vm-modules' jest --verbose",
"test:shared-data": "true",
"test:shared": "true",
"test:e2e": "cd ../../packages/amplify-e2e-gen2-migration && npx tsx src/cli.ts --app finance-tracker --profile ${AWS_PROFILE:-default}",
"deploy": "cd ../../packages/amplify-e2e-gen2-migration && npx tsx src/cli.ts --app finance-tracker --step deploy --profile ${AWS_PROFILE:-default}"
},
Expand Down
Loading
Loading