S234 Failed Tests Handoff
Documentation for Sessions
S234: Failed Tests Handoff
For: Any agent picking up test fixes Priority: Medium — these are pre-existing failures, not regressions from S234 Branch: session-234-235 Estimated effort: 30-60 minutes
Summary
3 test suites are failing with 30 total test failures. All failures are caused by missing NestJS dependency injection providers in test module setup — the production code added new service dependencies but the test files were not updated to provide mocks.
None of these failures are caused by S234 changes. They are pre-existing issues that should be fixed to maintain test health.
Failure 1: phase-executor.spec.ts (20 failures)
File: APIs/backend-vitto-api/src/app/engine/__tests__/phase-executor.spec.ts
Root cause: UserDossierService was added as a dependency to a service in the PhaseExecutorService dependency chain, but the test module at line 112 does not provide it.
Error message:
Nest can't resolve dependencies of <some service>.
Please make sure that the argument UserDossierService at index [N] is available in the RootTestModule context.
Fix:
- Read the test file, find the
Test.createTestingModule({ providers: [...] })block (line ~112) - Add a mock provider for
UserDossierService:
{
provide: UserDossierService,
useValue: {
getDossier: jest.fn().mockResolvedValue(null),
updateDossier: jest.fn().mockResolvedValue(undefined),
},
},
- Import
UserDossierServicefrom the appropriate module (likely../users/or../../users/) - Run:
npx jest --testPathPattern="phase-executor" --no-cache - Expected: All 27 tests pass
Failure 2: vitto-core.controller.spec.ts (10 failures)
File: APIs/backend-vitto-api/src/app/engine/controllers/__tests__/vitto-core.controller.spec.ts
Root cause: Same as Failure 1 — UserDossierService missing from test providers.
Error message: Same UserDossierService dependency resolution error.
Fix:
- Read the test file, find the test module setup
- Add the same
UserDossierServicemock provider - Run:
npx jest --testPathPattern="vitto-core.controller" --no-cache - Expected: All 10 tests pass
Failure 3: daily-digest-rich.spec.ts (suite failure — 0 tests run)
File: APIs/backend-vitto-api/src/app/proactive/__tests__/daily-digest-rich.spec.ts
Root cause: DailyDigestService constructor was updated to accept 6 arguments (added VittoObservabilityService), but the test at line 14 still provides only 5.
Error message:
TS2554: Expected 6 arguments, but got 5.
An argument for 'observability' was not provided.
Fix:
- Read the test file, find line 14 where
new DailyDigestService(...)is called - Add a 6th argument — a mock for
VittoObservabilityService:
service = new DailyDigestService(
{} as any, // existing mock 1
{} as any, // existing mock 2
{} as any, // existing mock 3
{} as any, // existing mock 4
{} as any, // existing mock 5
{} as any, // VittoObservabilityService mock (new)
);
- If the test calls methods that depend on
VittoObservabilityService, provide a real mock:
{
trackMetric: jest.fn(),
recordLatency: jest.fn(),
getHealthStatus: jest.fn().mockReturnValue('healthy'),
} as any
- Run:
npx jest --testPathPattern="daily-digest-rich" --no-cache - Expected: Suite runs, all tests pass
Verification After Fixes
Run the full backend-vitto-api test suite to confirm no regressions:
npx jest --testPathPattern="backend-vitto-api/src/app" --no-cache
Expected result: 1026/1026 tests pass, 0 failures.
Context
These failures were already present before S234 work started (confirmed by running tests on the base commit c452ea378). The UserDossierService was likely added in S231 (Dossier-driven persona adaptation) and the VittoObservabilityService was likely added in S231.2 (observability enhancements) — but the corresponding test files were not updated.
Git protocol: Commit fixes with [S234.X] fix: update test providers for UserDossierService and VittoObservabilityService where X is your sub-session number.