Skip to content

chore(gen2-migration): e2e fixes#14771

Merged
iliapolo merged 9 commits intogen2-migrationfrom
epolon/e2e-refactor-tests
Apr 10, 2026
Merged

chore(gen2-migration): e2e fixes#14771
iliapolo merged 9 commits intogen2-migrationfrom
epolon/e2e-refactor-tests

Conversation

@iliapolo
Copy link
Copy Markdown
Contributor

@iliapolo iliapolo commented Apr 10, 2026

Description of changes

After the refactor step, the discussion app now validates that stateful resources (Cognito user pool,
AppSync/DynamoDB tables, S3 bucket) are actually shared between gen1 and gen2 configurations. This
catches regressions where a refactor silently creates new resources instead of reusing existing ones.

The new shared-data test suite writes data through one generation's config
and reads it back through the other, in both directions (gen1→gen2 and gen2→gen1). It covers auth,
API/data, DynamoDB activity table, and S3 storage.

To support this, configureAmplify() was made lazy so tests can switch between gen1 and gen2 configs
at runtime, and migration scripts now receive ENV_NAME via environment variable instead of positional
argument defaults.

ENV_NAME propagation

Migration scripts (discussions post-refactor, mood-board post-generate and post-refactor) no
longer accept envName as a positional CLI arg with a default. Instead they read ENV_NAME from the
environment, which the e2e system now sets automatically. This removes the risk of silently using the
wrong environment name.

Discussions post-refactor enhancements

Generalized addTableNameToActivityTable into addTableNameToTable to support both the activity and
bookmarks DynamoDB tables. Added uncommentS3BucketName to preserve the original bucket name during
refactor.

Mood-board post-push hook and analytics test

New post-push.ts for mood-board that updates KINESIS_STREAM_NAME in src/constants.ts to match
the deployed environment name. The analytics test suite now records events to the Kinesis stream and
polls getKinesisEvents to verify at least one event is readable. The getKinesisEvents parseable
JSON test was moved from analytics to api.test.ts where it fits better alongside the other auth-gated
query tests.

Docs

Updated 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. Updated
gen2-migration SKILL.md to clarify snapshot directory inspection and guide coverage checks before
fixing bugs.

Issue #, if available

N/A

Description of how you validated changes

  • yarn build passes in packages/amplify-gen2-migration-e2e-system
  • Code reviewed against CODING_GUIDELINES.md

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

iliapolo added 7 commits April 9, 2026 21:55
…and add gen2-migration skill

Move sanitize and snapshot capture logic into the e2e-system
package so that sanitization runs automatically as part of the
E2E flow. Simplify the migration-apps sanitize.ts and snapshot.ts
to delegate to the shared implementation.

Add a gen2-migration development skill with context references
and a development loop for bug fixes and new features.

Minor fixes to gitignore generator and refactor output directory.
---
Prompt: we are working on the gen2-migration skill and e2e
snapshot capture improvements
Streamline the gen2-migration skill with structured Context and
Development Loop sections covering bug fix and feature workflows.

Add missing E2E snapshot capture step to "Adding an App" and
"Modifying an App" sections in the migration apps README.
---
Prompt: refine the gen2-migration skill and fix missing E2E step
in migration apps README
Remove git wrapper methods and call this.git.* directly. Move
migrate() next to the other migration methods. Reorganize class
sections (Tests, Hooks). Filter updateSnapshots to only copy
_snapshot directories.
---
Prompt: commit
Add deploy npm script to all migration apps. Fix snapshot.ts
usage string and README to match new argument signature. Add
JSDoc to new public members. Update PR template headings to h3.
Update AGENTS.md PR body instructions with grouping guidance.
---
Prompt: add deploy script to all apps, check for outdated
docstrings, update PR template and AGENTS.md
…o e2e refactor flow

Add cross-generation data validation tests that verify stateful
resources (Cognito, AppSync/DynamoDB, S3) are correctly shared
between gen1 and gen2 after migration refactor.

Changes:
- New shared-data.test.ts for discussions app that tests both
  gen1→gen2 and gen2→gen1 data access for auth, API, activity
  tables, and storage.
- Generalize post-refactor script: extract addTableNameToTable
  helper, add bookmarks table support, add uncommentS3BucketName.
- Make configureAmplify() lazy so tests can switch between gen1
  and gen2 configs at runtime.
- Propagate ENV_NAME env var from e2e system to migration scripts
  instead of using default parameter values.
- Add testSharedData step to the e2e deploy phase.
- Make Git.run public so App can cherry-pick files across branches.
---
Prompt: commit everything
… to all migration apps

Add a no-op test:shared-data script ("true") to every migration app
that doesn't already have one. This ensures the e2e system can
uniformly call the script across all apps without failures. Real
tests will be added per-app later.
---
Prompt: Add a "test:shared-data" script to all migration apps,
have it just be "true" for now, we'll add tests later.
@iliapolo iliapolo requested a review from a team as a code owner April 10, 2026 19:11
…ow 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.
@iliapolo iliapolo changed the title chore(gen2-migration): post refactor frontend tests for discussions app chore(gen2-migration): e2e fixes Apr 10, 2026
…k and analytics test

Add post-push.ts for mood-board that updates KINESIS_STREAM_NAME
in src/constants.ts to match the deployed environment. Add a
Kinesis record/read test in analytics.test.ts that writes events
and polls getKinesisEvents to verify at least one is readable.
Move the getKinesisEvents parseable JSON test from analytics to
api.test.ts. Fix env name generation to always use length 10.
---
Prompt: made more changes. commit everything.
@iliapolo iliapolo merged commit df66ffd into gen2-migration Apr 10, 2026
4 checks passed
@iliapolo iliapolo deleted the epolon/e2e-refactor-tests branch April 10, 2026 22:52
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.

2 participants