fix(api): TimelineQueryService Spring constructor ambiguity broke deployed API startup #1140

Merged
chris merged 2 commits from fix/on-this-day-api-context into main 2026-10-12 12:06:16 +02:00
Owner

Problem

Post-merge run 4284 (Deploy API) failed after #1137: the API container crashed on startup with NoSuchMethodException: TimelineQueryService.<init>(). Two public constructors (2-arg convenience + 3-arg with Clock) without an annotation made Spring's constructor resolution ambiguous; it fell back to a no-arg default that does not exist.

Neither tests (construct the service directly) nor the smoke job (compile-only) could catch this class of failure.

Fix

  • @Autowired on the 3-arg constructor (established pattern in the codebase); 2-arg constructor unchanged for tests.
  • TimelineQueryServiceWiringTest: ApplicationContextRunner wiring guard, verified red without the annotation / green with it.
  • KNOWN_ISSUES.md: ISSUE-138 documenting the deploy failure and the smoke-job gap.

Tests

:apps:api:test --tests dev.memories.api.timeline.* green incl. new wiring test; red/green proof of the regression guard in the PR branch history.

## Problem Post-merge run 4284 (`Deploy API`) failed after #1137: the API container crashed on startup with `NoSuchMethodException: TimelineQueryService.<init>()`. Two public constructors (2-arg convenience + 3-arg with Clock) without an annotation made Spring's constructor resolution ambiguous; it fell back to a no-arg default that does not exist. Neither tests (construct the service directly) nor the smoke job (compile-only) could catch this class of failure. ## Fix - `@Autowired` on the 3-arg constructor (established pattern in the codebase); 2-arg constructor unchanged for tests. - `TimelineQueryServiceWiringTest`: ApplicationContextRunner wiring guard, verified red without the annotation / green with it. - KNOWN_ISSUES.md: ISSUE-138 documenting the deploy failure and the smoke-job gap. ## Tests `:apps:api:test --tests dev.memories.api.timeline.*` green incl. new wiring test; red/green proof of the regression guard in the PR branch history.
Two public constructors without an annotation made Spring's constructor
resolution ambiguous; it fell back to a no-arg default that does not
exist, so the application context failed to start in the deployed image
(post-merge run 4284, Deploy API). Tests construct the service directly,
and the smoke job only compiles, so neither caught it. The @Autowired
annotation pins the 3-arg constructor for Spring while keeping the 2-arg
convenience constructor for tests.
test(api): Spring wiring regression guard for TimelineQueryService constructor
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 5m41s
1ca203c0b1
ApplicationContextRunner-based test that fails exactly when the 3-arg
constructor loses its @Autowired annotation (verified red/green). Adds
ISSUE-138 for the failed post-merge deploy and the smoke-job compile-only
gap that let it through.
chris merged commit 1a9acab772 into main 2026-10-12 12:06:16 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1140
No description provided.