Skip to content

ci: dynamic E2E test selection based on changed files#985

Open
lane711 wants to merge 10 commits into
mainfrom
lane711/sonicjs-ci-cd-status-check
Open

ci: dynamic E2E test selection based on changed files#985
lane711 wants to merge 10 commits into
mainfrom
lane711/sonicjs-ci-cd-status-check

Conversation

@lane711

@lane711 lane711 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Tags all 120 E2E specs with feature tags (@smoke, @media, @content, @auth, @api, @api-keys, @database, @collections, @plugins)
  • CI now diffs changed files on each PR, maps paths to feature tags, and runs only smoke tests + relevant tagged tests via --grep
  • Replaces full suite run (npm run e2e) with targeted selection — cuts E2E wall-clock time significantly on focused PRs

How it works

  1. New CI step detects changed files vs base branch using git diff --name-only
  2. Maps path patterns to tags (e.g. src/routes/admin-media*@smoke|@media)
  3. Playwright runs with --grep "@smoke|@<detected-tags>" instead of all tests
  4. @smoke always runs — critical path tests always covered
  5. Tag mapping documented in CLAUDE.md for future spec authors

Changes

  • .github/workflows/pr-tests.yml — new "Detect changed areas" step before Playwright
  • CLAUDE.md — updated E2E testing section with tag strategy and mapping table
  • tests/e2e/*.spec.ts — all 120 specs tagged on outermost test.describe

Test plan

  • Merge a PR touching only media files → only @smoke|@media tests run
  • Merge a PR touching migration files → @smoke|@content|@media|@api run
  • Untagged area change → only @smoke runs

🤖 Generated with Claude Code

lane711 added a commit that referenced this pull request Jul 1, 2026
- Fix email plugin on-cron-tick.test.ts: swap (ctx, event) → (event, ctx) in all 7 hook calls
- Fix email plugin import path: email-service-singleton → email/email-service-singleton in 5 files
- Quarantine 5 email plugin tests that test unimplemented v2 API (factory pattern)
- Fix media_asset double-registration: add internal: true to second seed entry
- Fix document versioning: add versioning: true to blog_post document type seed (maxVersionsPerRoot was already 50, intent was clear)
- Fix admin-content test: use correct CollectionConfig.versioning field (not settings.versioning)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lane711 and others added 10 commits July 1, 2026 12:22
Tags all 120 E2E specs with feature tags (@smoke, @media, @content,
@auth, @api, @api-keys, @database, @collections, @plugins). CI now
diffs changed files on each PR, maps paths to tags, and runs only
smoke tests + relevant feature tests via --grep instead of the full
suite. Cuts E2E wall-clock time significantly on focused PRs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Node 20 npm fails to resolve nested optional deps (@emnapi/runtime,
esbuild@0.28.1 under wrangler) even though they exist in the lock
file. Node 22 resolves correctly. Packages (wrangler, miniflare)
also require Node >=22.0.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lock file generated on macOS arm64 omits Linux-specific optional
packages (@emnapi/runtime@1.11.1, esbuild@0.28.1 under wrangler).
npm ci strict mode fails. npm install resolves missing platform
packages while still respecting existing lock file versions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previous lock file generated on macOS arm64 omitted platform-specific
entries: @emnapi/runtime@1.11.1, @emnapi/core@1.11.1, and
wrangler/node_modules/esbuild@0.28.1. Linux CI npm ci failed with
"Missing from lock file". Fresh generation includes all platforms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix email plugin on-cron-tick.test.ts: swap (ctx, event) → (event, ctx) in all 7 hook calls
- Fix email plugin import path: email-service-singleton → email/email-service-singleton in 5 files
- Quarantine 5 email plugin tests that test unimplemented v2 API (factory pattern)
- Fix media_asset double-registration: add internal: true to second seed entry
- Fix document versioning: add versioning: true to blog_post document type seed (maxVersionsPerRoot was already 50, intent was clear)
- Fix admin-content test: use correct CollectionConfig.versioning field (not settings.versioning)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
better-auth-cloudflare requires @better-auth/drizzle-adapter as a peer dep.
Locally it resolved via Node's parent-dir traversal from the main checkout.
CI only has the conductor worktree so the dep was missing, failing 8 test files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
npm install --workspace regenerated the lock file on macOS and dropped
Linux optional packages (@emnapi/runtime, @emnapi/core, esbuild@0.28.1).
Full delete + reinstall regenerates a cross-platform lock file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
better-auth imports @better-auth/telemetry at runtime but npm skips
installing it (likely dedup with @better-auth/core). Locally it resolves
via parent-dir traversal; CI fails because it only has the conductor tree.
Adding explicitly like @better-auth/drizzle-adapter. Full reinstall to
restore cross-platform lock file (Linux optional packages).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lane711 lane711 force-pushed the lane711/sonicjs-ci-cd-status-check branch from 29a0415 to e595fab Compare July 1, 2026 19:31
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.

1 participant