Skip to content

fix(api): the container could not start, and nothing tested that it could - #25

Merged
isaacismaelx14 merged 1 commit into
mainfrom
fix/a04-module-wiring
Aug 22, 2026
Merged

fix(api): the container could not start, and nothing tested that it could#25
isaacismaelx14 merged 1 commit into
mainfrom
fix/a04-module-wiring

Conversation

@isaacismaelx14

Copy link
Copy Markdown
Member

A04 merged green and the deploy failed at boot. Production stayed on the previous build, so nothing went down, but A04 is not live.

What broke

AccessModule injected IngestionService, which GitHubModule did not export, and a RateBudget, which is an interface and has no runtime token for Nest to resolve.

Nest can't resolve dependencies of the DelegatedQueryService (Authorizations, ?, Object).

Why it reached production

Every suite in this app constructs classes directly with fakes. That is the right way to test behaviour and it says nothing about whether the container can build them. The dependency graph is a real artifact and had no test.

app.module.test.ts compiles the actual graph, in both shapes an operator can deploy: with and without a delegated-query key, which are genuinely different graphs because Authorizations is null in one of them. It also pins the route list, because a module that fails to register takes its controllers with it silently while /health keeps answering, so a smoke test on one route proves nothing.

Why the test did not exist

Vitest transpiles with esbuild, which does not emit decorator metadata, so Nest resolved every constructor parameter as undefined and the failure looked like a bug inside the service. The API's vitest config now uses SWC with decoratorMetadata. This class of test was unavailable rather than merely forgotten.

Verified

Reverting each half of the original break turns the new test red: dropping the export, dropping the @Inject, and unregistering AccessModule.

…ould

A04 merged with green CI and the deploy failed at boot. AccessModule
injected IngestionService, which GitHubModule did not export, and a
RateBudget, which is an interface and therefore has no runtime token for
Nest to resolve. Production stayed on the previous build, so the site
never went down, but A04 was not deployed.

The wiring is a one-line export and an @Inject. The reason it reached
production is the part worth fixing: every suite in this app constructs
classes directly with fakes, which is the right way to test behaviour
and says nothing about whether the container can build them. The
dependency graph is a real artifact and had no test at all.

app.module.test.ts compiles the actual graph, in both shapes an operator
can deploy: with and without a delegated-query key, which are different
graphs because Authorizations is null in one of them. It also pins the
route list, since a module that fails to register takes its controllers
with it silently while /health keeps answering.

That test could not have been written before this commit. Vitest
transpiles with esbuild, which does not emit decorator metadata, so Nest
resolved every constructor parameter as undefined and the failure looked
like a bug inside the service. The API's vitest config now uses SWC with
decoratorMetadata, which is why this class of test was missing rather
than merely forgotten.

Verified by reverting each half of the original break: dropping the
export, dropping the @Inject, and unregistering AccessModule each turn
the new test red.

Also removed a DatabaseModule import added while diagnosing, along with
the comment claiming it was required. DatabaseModule is @global, so the
comment was false, and a false reason in a comment is worse than none.
@isaacismaelx14
isaacismaelx14 merged commit 1b12985 into main Aug 22, 2026
1 check passed
@isaacismaelx14
isaacismaelx14 deleted the fix/a04-module-wiring branch August 22, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant