Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API E2E Coverage Master Plan (Extensive)
Date: 2026-04-29
Scope:
apps/api/src/**/*controller.ts1. Objective
This plan upgrades E2E from mostly route/guard verification to deep behavioral verification.
Target outcomes:
2. Current Snapshot
Controller inventory:
Static route-hit baseline from current E2E literals (approximate floor, not full semantic coverage):
course.controller.ts: 32 missing (static)settings.controller.ts: 24 missing (static)lesson.controller.ts: 16 missing (static)articles.controller.ts: 14 missing (static)news.controller.ts: 11 missing (static)auth.controller.ts: 10 missing (static)Important: this metric is intentionally conservative and does not measure depth; many currently matched routes still need business assertions.
3. Definition of Done
A controller is considered complete only if all are true:
4. Test Design Rules (Applies to All Controllers)
For every endpoint family, include:
5. Shared Test Infrastructure Upgrades
Before broad rollout:
expectForbiddenCrossTenant()with seeded second tenant.expectValidationError(field, code?)for consistent schema failures.expectOutboxEvent(type, predicate)for event-producing endpoints.runConcurrently(requestFactory, count)for race scenarios.6. Controller-by-Controller Coverage Plan
6.1
AuthController(/auth, 20 endpoints)Coverage goals:
Weird cases:
6.2
UserController(/user, 17 endpoints)Coverage goals:
Weird cases:
6.3
SettingsController(/settings, 38 endpoints)Coverage goals:
Weird cases:
6.4
CourseController(/course, 41 endpoints)Coverage goals:
Weird cases:
6.5
LessonController(/lesson, 19 endpoints)Coverage goals:
delete-student-quiz-answers).Weird cases:
6.6
ChapterController(/chapter, 6 endpoints)Coverage goals:
Weird cases:
6.7
CategoryController(/category, 6 endpoints)Coverage goals:
Weird cases:
6.8
GroupController(/group, 9 endpoints)Coverage goals:
Weird cases:
6.9
IntegrationAdminController(/integration/key, 2 endpoints)Coverage goals:
Weird cases:
6.10
IntegrationController(/integration, 12 endpoints)Coverage goals:
X-API-Key,X-Tenant-Id).Weird cases:
6.11
AnnouncementsController(/announcements, 6 endpoints)Coverage goals:
Weird cases:
6.12
NewsController(/news, 11 endpoints)Coverage goals:
Weird cases:
6.13
ArticlesController(/articles, 18 endpoints)Coverage goals:
Weird cases:
6.14
QAController(/qa, 7 endpoints)Coverage goals:
QAEnabled, guest accessibility).Weird cases:
6.15
CertificatesController(/certificates, 6 endpoints)Coverage goals:
Weird cases:
6.16
StatisticsController(/statistics, 2 endpoints)Coverage goals:
user-statsandstatsdata integrity against seeded telemetry.Weird cases:
6.17
ReportController(/report, 1 endpoint)Coverage goals:
Weird cases:
6.18
StudentLessonProgressController(/studentLessonProgress, 1 endpoint)Coverage goals:
Weird cases:
6.19
AIController(/ai, 5 endpoints)Coverage goals:
Weird cases:
6.20
LumaController(/luma, 6 endpoints)Coverage goals:
Weird cases:
6.21
IngestionController(/ingestion, 3 endpoints)Coverage goals:
Weird cases:
6.22
FileController(/file, 11 endpoints)Coverage goals:
Weird cases:
6.23
SCORMController(/scorm, 3 endpoints)Coverage goals:
Weird cases:
6.24
StripeController(/stripe, 7 endpoints)Coverage goals:
Weird cases:
6.25
EnvController(/env, 8 endpoints)Coverage goals:
Weird cases:
6.26
SuperAdmin TenantsController(/super-admin/tenants, 5 endpoints)Coverage goals:
Weird cases:
6.27
AnalyticsController(/analytics, 1 endpoint)Coverage goals:
Weird cases:
6.28
HealthController(/healthcheck, 1 endpoint)Coverage goals:
Weird cases:
6.29
TestConfigController(/test-config, 2 endpoints)Coverage goals:
OnlyStaging) for setup/teardown.Weird cases:
7. Phase Plan (Execution Order)
Phase 0: Harness Hardening
Phase 1: Route and Contract Closure
course,settings,lesson,articles,news,auth,integration.Phase 2: Business Invariant Depth
Phase 3: Weird/Fault Cases
Phase 4: Stability and CI
8. Coverage Matrix Requirements Per Endpoint
Minimum scenario matrix per endpoint class:
9. Tracking Checklist (Controller Completion)
10. Execution Log
AuthControllerE2E deepening (MFA setup/verify edge cases, support-mode edge paths, stronger cookie assertions).NewsControllerE2E module (all routes with draft/public visibility, localization lifecycle, soft-delete assertions, preview/upload auth).AnnouncementsControllerE2E to DB-backed assertions (ordering/limit/read-state transitions, recipient fan-out, idempotent mark-as-read).QAControllerE2E with search behavior, localization edge behavior, and stronger DB assertions.QAService.deleteQAfor non-existent IDs (now returns domainqaView.toast.notFoundinstead of 500).ArticlesControllerE2E with full route-family coverage (sections/articles/languages/toc/resource/preview/upload) and DB-backed assertions.ArticlesService.getArticlewhereisDraftModewas ignored in visibility filtering.ArticlesControllerquery validation forisDraftModeto accept boolean query-string values consistently.MagicFileTypeValidator) to gracefully handle file-type detection failures and return validation errors.11. Success Exit Criteria
This plan is complete when: