Skip to content

Commit c7395bd

Browse files
committed
docs(amplify-gen2-migration-e2e-system): improve skill and app workflow docs
Update gen2-migration SKILL.md to clarify snapshot directory inspection and to guide the agent to check for existing test app coverage before fixing a bug. Update amplify-migration-apps README.md to include validation test steps when adding or modifying apps, and note that E2E failures require fixing the bug before snapshots can be captured. --- Prompt: made more changes. commit.
1 parent 62fbb60 commit c7395bd

2 files changed

Lines changed: 32 additions & 15 deletions

File tree

.kiro/skills/gen2-migration/SKILL.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,14 @@ with a specific combination of Amplify categories and configurations. See
3939

4040
### Fix a Bug
4141

42-
The snapshot inputs (`_snapshot.pre.*`) don't change — only the code and possibly the
43-
expected outputs (`_snapshot.post.*`) change.
44-
4542
1. Read the relevant Context above for the area you're touching.
4643

47-
2. Analyze the bug by reading the affected app's snapshot files. Read the
48-
`_snapshot.pre.generate/` and/or `_snapshot.pre.refactor/` files to understand the
49-
input configuration, and the `_snapshot.post.*` files to identify what's wrong in the
50-
current output.
44+
2. Determine whether an existing test app covers the bug's scenario. Read the affected
45+
app's `_snapshot.pre.generate/` and/or `_snapshot.pre.refactor/` files to understand
46+
the input configuration, and the `_snapshot.post.*` files to identify what's wrong in
47+
the current output. If no existing app exercises the affected code path, follow the
48+
"Adding an App" or "Modifying an App" instructions from `amplify-migration-apps/README.md`
49+
to add or update the `_snapshot.pre.*` inputs before proceeding.
5150

5251
3. Reproduce the bug by running the appropriate E2E test:
5352

@@ -56,8 +55,11 @@ expected outputs (`_snapshot.post.*`) change.
5655
npm run test:e2e
5756
```
5857

59-
After the E2E run, inspect the live Gen1 and Gen2 resources and CloudFormation stack
60-
events using the AWS CLI to confirm the root cause.
58+
The E2E tool logs the directory where on-the-fly snapshots are captured for this run
59+
(look for the `Snapshot directory:` line in the output). You can inspect the files in
60+
that directory to see the state of the app at each step. In addition, inspect the live
61+
Gen1 and Gen2 resources and CloudFormation stack events using the AWS CLI to confirm
62+
the root cause.
6163

6264
4. Present the root cause analysis to the user.
6365

@@ -111,6 +113,12 @@ expected outputs (`_snapshot.post.*`) change.
111113
UPDATE_SNAPSHOTS=1 npm run test:e2e
112114
```
113115

116+
The E2E tool logs the directory where on-the-fly snapshots are captured for this run
117+
(look for the `Snapshot directory:` line in the output). You can inspect the files in
118+
that directory to see the state of the app at each step. In addition, inspect the live
119+
Gen1 and Gen2 resources and CloudFormation stack events using the AWS CLI to confirm
120+
correctness.
121+
114122
8. Run `yarn build && yarn test` in `packages/amplify-cli/` to verify nothing else broke.
115123
If tests fail at this point, only test code changes should be needed — the production
116124
code was already validated by the E2E run.

amplify-migration-apps/README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,27 +293,36 @@ Make sure to follow the existing patterns and add tests as well.
293293
2. Run `amplify init`.
294294
3. Configure the backend using Gen1 CLI.
295295
4. Run `amplify push`.
296-
5. Use the [Snapshot Capture Tool](#snapshot-capture-tool) to capture the `pre.generate` snapshot.
296+
5. Add validation tests under `<app-name>/tests/` that exercise the new app's capabilities
297+
(API queries, auth flows, storage operations, etc.). Follow the patterns in existing apps
298+
like `project-boards/tests/` or `fitness-tracker/tests/`.
299+
6. Use the [Snapshot Capture Tool](#snapshot-capture-tool) to capture the `pre.generate` snapshot.
297300

298301
```console
299302
npx tsx snapshot.ts pre.generate <app-name>
300303

301-
6. Run `UPDATE_SNAPSHOTS=1 npm run test:e2e` to execute the full migration flow and capture
302-
the remaining snapshots (`post.generate`, `pre.refactor`, `post.refactor`).
304+
7. Run `UPDATE_SNAPSHOTS=1 npm run test:e2e` to execute the full migration flow and capture
305+
the remaining snapshots (`post.generate`, `pre.refactor`, `post.refactor`). The E2E may
306+
fail if the new app exercises a bug in the migration tooling. In that case the snapshots
307+
will not be updated — fix the bug first, then re-run.
303308

304309
## Modifying an App
305310

306311
1. `cd` into a specific app and run `npm run deploy`.
307312
2. Locate the deployed app directory in output logs and `cd` into it.
308313
3. Update the backend using Gen1 CLI.
309314
4. Run `amplify push`.
310-
5. Use the [Snapshot Capture Tool](#snapshot-capture-tool) to capture the `pre.generate` snapshot.
315+
5. Add or update validation tests under `<app-name>/tests/` to cover the modified
316+
capabilities. Follow the patterns in existing apps like `project-boards/tests/`.
317+
6. Use the [Snapshot Capture Tool](#snapshot-capture-tool) to capture the `pre.generate` snapshot.
311318

312319
```console
313320
npx tsx snapshot.ts pre.generate <app-name>
314321

315-
6. Run `UPDATE_SNAPSHOTS=1 npm run test:e2e` to execute the full migration flow and capture
316-
the remaining snapshots (`post.generate`, `pre.refactor`, `post.refactor`).
322+
7. Run `UPDATE_SNAPSHOTS=1 npm run test:e2e` to execute the full migration flow and capture
323+
the remaining snapshots (`post.generate`, `pre.refactor`, `post.refactor`). The E2E may
324+
fail if the app change exercises a bug in the migration tooling. In that case the
325+
snapshots will not be updated — fix the bug first, then re-run.
317326

318327
## Snapshot Testing
319328

0 commit comments

Comments
 (0)