Skip to content

fix(pokestop-events): register the service the controller needs - #825

Merged
hokiepokedad2 merged 1 commit into
developfrom
fix/pokestop-events-di
Aug 24, 2026
Merged

fix(pokestop-events): register the service the controller needs#825
hokiepokedad2 merged 1 commit into
developfrom
fix/pokestop-events-di

Conversation

@hokiepokedad2

Copy link
Copy Markdown
Contributor

Pokéstop Events has been dead since #817 merged. Every endpoint answers 500.

PokestopEventController takes IPokestopEventService by constructor injection. AddPoracleServices registers IPoracleIncidentProxy but never the service, so the controller cannot be resolved and every request — list, add, edit, delete — fails the same way.

Why nothing caught it

  • The service tests construct PokestopEventService directly.
  • The controller tests mock IPokestopEventService.
  • The solution compiles; a missing registration is not a compile error.
  • CI is green, because the full suite and the production Angular build both pass.

A missing registration is invisible until something resolves the controller, which only happens when the application actually runs. This was found by using the dev instance, not by any test — visible in the container log as InvalidOperationException: Unable to resolve service for type … IPokestopEventService, and in the UI as "An unexpected server error occurred" on an empty page.

The guard

ControllerDependencyRegistrationTests builds the real AddPoracleServices container and asserts every controller's required constructor arguments are in it.

The word "required" is the whole test. ScannerController and PokemonAvailabilityController take IScannerService? scannerService = null and IPokemonAvailabilityService? … = null, because the scanner database and the Golbat API are optional and their absence is meant to leave the field null — that is the documented graceful-degradation design and must not be flagged. PokestopEventController has no default, so its dependency is genuinely required.

My first version of the test did not make that distinction and produced three false positives, which is worth knowing if it ever needs extending.

It also carries a case asserting the reflection filter finds more than fifteen controllers, so a filter that silently matched nothing could not make every other case vacuously pass.

Verified red first

Reverting just the registration line turns exactly one case red — naming the controller and the missing service — with the other thirty-three green.

Full suite: 2410 passing.

Worth doing after merge

:beta will redeploy on the dev instance; the Pokéstop Events page should be opened there to confirm it now answers, since that is the only place this class of failure shows.

PokestopEventController takes IPokestopEventService by constructor injection and
AddPoracleServices never registered it, so every endpoint on it threw at resolution
time and answered 500. The feature has been dead since it merged in #817.

Nothing in the pipeline could catch it. The service tests construct
PokestopEventService directly, the controller tests mock the interface, the solution
compiles, and CI is green -- a missing registration is invisible until something
resolves the controller, which only happens when the application runs. It was found
by using the dev instance, not by a test.

ControllerDependencyRegistrationTests closes that gap: it builds the real
AddPoracleServices container and asserts every controller's required constructor
arguments are in it.

Parameters with a default are excluded, and that distinction is the whole test.
ScannerController and PokemonAvailabilityController take `IThing? thing = null`
because the scanner database and the Golbat API are optional and their absence is
meant to leave the field null -- those must NOT be flagged. PokestopEventController
has no default, so its dependency is genuinely required.

Verified by reverting the registration: exactly one case goes red, naming the
controller and the service, with the other thirty-three green.

Refs #806
@hokiepokedad2
hokiepokedad2 merged commit 299a0a7 into develop Aug 24, 2026
7 checks passed
@hokiepokedad2
hokiepokedad2 deleted the fix/pokestop-events-di branch August 24, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant