64 lines
3.4 KiB
Markdown
64 lines
3.4 KiB
Markdown
# CL01 — Replace permissive DI configuration tests with production-path assertions
|
|
|
|
Parent epic: E10. Priority/severity: P1 / High. Complexity: M. Specialization: TypeScript infrastructure testing.
|
|
|
|
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
|
|
|
|
## User story and outcome
|
|
|
|
As a maintainer, I want configuration tests to fail when a valid configuration stops working, so subsequent cleanup has a trustworthy safety net.
|
|
|
|
Expected benefit: Removes false passing coverage before changes to configuration and startup.
|
|
|
|
## Verified evidence
|
|
|
|
- **Verified — CL-F03:** Several success tests also pass when any exception is thrown; the test file supplies its own toUnifiedConfig implementation through a module mock. [libs/core/di/test/container-builder.test.ts:114](../../../../libs/core/di/test/container-builder.test.ts#L114).
|
|
|
|
## Implementation scope
|
|
|
|
- Replace the locally reimplemented config normalizer with the real configuration path for builder tests. Use complete, valid fixtures and skip external initialization.
|
|
- Make successful construction assert actual registered configuration/services. Make invalid input assert the specific expected rejection.
|
|
- Remove success-or-error catch blocks and prevent module mocks from contaminating other suites. Keep tests for current supported behavior; CL02 owns regressions for currently broken options/settings.
|
|
|
|
Likely existing files/modules:
|
|
|
|
- `libs/core/di/test/container-builder.test.ts`
|
|
- `libs/core/di/test/di.test.ts`
|
|
|
|
## Exclusions
|
|
|
|
- No production configuration behavior changes.
|
|
- No blanket replacement of every infrastructure test or rewrite of the test runner.
|
|
|
|
## Dependencies and ownership
|
|
|
|
Implementation prerequisites: None.
|
|
|
|
Write locks: `di-builder-tests`.
|
|
|
|
Parallel execution: Ready independently. Can run with CL03 and CL04 in isolated worktrees; do not share test-process module mocks. CL02 waits for this test baseline.
|
|
|
|
## Acceptance criteria
|
|
|
|
1. Every success case fails if its production builder call throws; no assertion treats an arbitrary error as success.
|
|
2. Tests use the actual toUnifiedConfig and DI schemas and check resulting values, not only container existence.
|
|
3. Invalid fixtures have explicit rejection assertions; valid fixtures do not depend on network access, local credentials, or running stores.
|
|
4. Tests pass individually and alongside the existing real-path QuestDB configuration regression without leaking mocks.
|
|
|
|
## Mandatory verification
|
|
|
|
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
|
|
|
|
```sh
|
|
bun test libs/core/di/test/container-builder.test.ts
|
|
bun test test/integration/questdb-configuration.test.ts
|
|
bun run typecheck
|
|
```
|
|
|
|
Required regression cases: valid full config, invalid required fields, nested/flat normalization, QuestDB credential propagation, and module-mock isolation.
|
|
|
|
## Risks and definition of done
|
|
|
|
Removing permissive assertions may expose old invalid fixtures. Repair fixtures against the supported schema; do not weaken validation or rewrite expectations to conceal production defects.
|
|
|
|
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.
|