Comprehensive testing strategy for functional correctness, privacy safety, and AI quality.
Goals
- Functional correctness across ingestion, parsing, and public APIs.
- Privacy and safety (no PII leaks, guardrails enforced).
- Reliability and idempotency for replays and retries.
- AI quality and schema consistency.
Sources: beacon-platform/docs/testing.md, beacon-platform/apps/pulse-public/src/index.ts
Test levels
Unit tests
- WhatsApp parsing formats and multi-line handling.
- System event filtering and media placeholder handling.
- Dedup normalization and hashing.
- Privacy utilities (PII redaction, theme sanitization).
- AI guardrails (schema validation, score clamping).
- Sentiment trend math and thresholds.
Integration tests (mocked services / Miniflare)
- Ingest worker:
/presign,/upload, queue processing, daily and weekly generation, quota enforcement. - Public worker:
/pulse.json,/pulse/history.json,/pulse/daily.json,/pulse/trends.json. - HTML rendering and embed responses.
End-to-end
- Local or staging runs: upload → process → D1 → public endpoints.
- Regeneration and cleanup paths.
Sources: beacon-platform/docs/testing.md, beacon-platform/apps/pulse-public/src/index.ts
AI testing
- Golden outputs for fixed inputs with tolerance checks.
- Failure scenarios: malformed output, privacy violations, quota exhaustion.
Privacy testing
- Inject phones/emails/URLs and verify redaction.
- Verify public endpoints never return raw messages or identifiers.
- Validate theme sanitization and summary content.
Idempotency testing
- Re-upload same export → no duplicates.
- Replays and regenerations → consistent results.
- Multiple queue deliveries → deduplicated output.
Sources: beacon-platform/apps/pulse-public/src/index.ts, beacon-platform/docs/testing.md
Sentiment trend computation
flowchart LR Weekly[Weekly summaries] --> Filter[Min weeks + confidence filter] Filter -->|sufficient| Regr[Confidence-weighted regression] Regr --> Classify{Slope + change thresholds} Classify --> Improving[Improving] Classify --> Declining[Declining] Classify --> Stable[Stable] Filter -->|insufficient| Insufficient[Insufficient data]
Sources: beacon-platform/apps/pulse-public/src/index.ts
CI pipeline
- Pull request: lint, typecheck, unit, integration, privacy validation.
- Nightly: full integration, golden-output checks, performance, idempotency.
- Pre-release: staging smoke tests and public endpoint health.
Release requirements:
- PR tests green.
- Nightly tests green (last 24h).
- Staging smoke tests pass.
- No privacy regressions.
- AI outputs within tolerance.
- Documentation updated.
Sources: beacon-platform/docs/testing.md, beacon-platform/apps/pulse-public/src/index.ts