Fix CI D1 migration timing issues for Email and OTP Login E2E tests

Aperta
#607 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
github-actions, sql, typescript

Direzione di ricerca

Start with the CI workflow that creates the D1 database, runs 020_add_email_plugin.sql and 026_add_otp_login.sql, and deploys the preview, then compare it with the plugin-card lookup the tests depend on. Next, look at tests/e2e/29-email-plugin-settings.spec.ts and tests/e2e/44-otp-login-admin.spec.ts for the test.describe.skip markers. Done means the root cause is recorded, both suites run without the skip, and they pass across repeated CI runs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: quality bug priority: P2 testing

Summary

Two E2E test suites are currently skipped due to D1 migration timing/propagation issues in CI:

  • tests/e2e/29-email-plugin-settings.spec.ts
  • tests/e2e/44-otp-login-admin.spec.ts

These tests pass locally but fail in CI even after migrations execute successfully.

Background

These tests were skipped in PR #581 to unblock the merge of the component-based plugin settings architecture feature. The tests verify:

  1. Email Plugin Settings (29-email-plugin-settings.spec.ts)

    • Navigation to email plugin settings from plugins page
    • Display of email settings form with all fields (API key, from email, from name, etc.)
    • Save settings functionality
    • Required field validation
    • Test email section display
  2. OTP Login Admin (44-otp-login-admin.spec.ts)

    • OTP Login plugin settings page loading
    • Test email form display
    • Email preview section display
    • Code settings form display
    • Quick links to related settings
    • Email configuration status
    • Features list display
    • Save settings button
    • Send test code functionality

Root Cause Investigation

The CI workflow:

  1. Creates a fresh D1 database for each PR
  2. Runs migrations (020_add_email_plugin.sql, 026_add_otp_login.sql)
  3. Deploys to Cloudflare Workers preview
  4. Runs E2E tests

Migrations execute successfully (confirmed by ✅ markers in CI logs), but the Email plugin card is not visible when tests run. This suggests a timing/propagation delay between:

  • D1 migration completion
  • Data being available to the Worker

Potential Solutions to Investigate

  1. Add delay after migrations - Wait for D1 propagation before running tests
  2. Verify data availability - Add a health check endpoint that confirms plugin data exists
  3. D1 eventual consistency - Research if D1 has eventual consistency behavior and workarounds
  4. Worker restart - Check if Worker needs restart/redeploy after migrations
  5. Database binding timing - Investigate if database bindings need time to propagate

Acceptance Criteria

  • Identify root cause of D1 propagation delay
  • Implement fix in CI workflow or application code
  • Re-enable skipped tests by removing test.describe.skip
  • Verify tests pass consistently in CI (run multiple times)

Related

  • PR #581 - Original PR where tests were skipped
  • Migrations: 020_add_email_plugin.sql, 026_add_otp_login.sql

🤖 Generated with Claude Code

Lingua principale
TypeScript
Stelle
1.8k
Fork
219
Merge medio
2g 21h
PR unite (30g)
67

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SonicJs-Org/sonicjs

Tutte le issue di SonicJs-Org/sonicjs

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.