Skip to content

refactor(0026): Phase 7 (part 2b) — split, fix & re-add ApiService.Tests - #288

Merged
ChrisonSimtian merged 2 commits into
mainfrom
refactor/282-test-split-apiservice
May 29, 2026
Merged

refactor(0026): Phase 7 (part 2b) — split, fix & re-add ApiService.Tests#288
ChrisonSimtian merged 2 commits into
mainfrom
refactor/282-test-split-apiservice

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Part 2b of #282 (ADR-0026 phase 7), and the close-out of the phase. Also fixes a hidden regression.

test/ApiService.Teststest/Presentation/Api/Satisfactory.Presentation.Api.Tests. All 8 classes boot WebApplicationFactory<Program> against the Satisfactory API binary, so they live under Satisfactory.Presentation.Api.Tests — the issue table's Erp.Presentation.Api.Common.Tests was aspirational; there's no Common-only API surface under test. Namespaces, ProjectReference depths, and slnx updated.

The hidden regression this fixes

ApiService.Tests was silently dropped from the solution during the 5c1/5c2 API refactor — so #276/#277 merged green without these 14 integration tests ever running. They were failing with FOREIGN KEY constraint failed: the fixtures' DI-minted AgentToken references a dev-Player row that no longer exists, because DevPlayerBootstrap moved to the Auth API in 5c2 and the Satisfactory binary never seeds it.

Fix: AgentApiFactory.MintTokenAsync + LogsApiFactory.MintTokenAsync now seed the dev Player (mirroring DevPlayerBootstrap) before inserting the token.

Result

  • 28 passed, 5 skipped (PlayerTokenEndpointsTests, gated on ADR-0026 Phase 5c3: JWT/HMAC token auth between Auth + game APIs #279 per the issue's out-of-scope note).
  • 1 env-only failure locallyReIngestCatalogueTests.Catalogue_status_without_upload_returns_null_catalogue_block — because the API auto-detects a real Satisfactory save on my dev box that the vendored fork can't parse (ResolvePath()AutoDetectLatestSave(); same class as SaveFileReaderParityTests). On CI no save exists at the default path → factory state is empty → it passes. CI is the arbiter here.

With this, the test/ tree fully mirrors src/ and ApiService.Tests is back under CI coverage. #282 can close.

🤖 Generated with Claude Code

…ests (#282)

test/ApiService.Tests -> test/Presentation/Api/Satisfactory.Presentation.Api.Tests.
All 8 test classes boot WebApplicationFactory<Program> against the Satisfactory
API binary, so they belong under Satisfactory.Presentation.Api.Tests (the issue
table's "Erp.Presentation.Api.Common.Tests" was aspirational — there is no
Common-only API surface under test). Namespaces + ProjectReference depths + slnx
updated.

Crucially this re-adds the project to the solution. It had been silently dropped
during the 5c1/5c2 API refactor, so #276/#277 merged green without these 14
integration tests running. They were failing with `FOREIGN KEY constraint
failed`: the fixtures' DI-minted AgentToken references a dev-Player row that no
longer exists, because DevPlayerBootstrap moved to the Auth API in 5c2 and the
Sat API binary never seeds it.

Fix: AgentApiFactory.MintTokenAsync + LogsApiFactory.MintTokenAsync now seed the
dev Player (mirroring DevPlayerBootstrap) before inserting the AgentToken.

Result: 28 passed, 5 skipped (PlayerTokenEndpointsTests, gated on #279), 1
env-only failure locally — ReIngestCatalogueTests.Catalogue_status_without_upload
_returns_null_catalogue_block, because the API auto-detects a real Satisfactory
save on this dev box that the vendored fork can't parse (same class as
SaveFileReaderParityTests). On CI no save exists at the default path, so factory
state is empty and the test passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented May 29, 2026

Copy link
Copy Markdown

Test results

207 tests  +34   202 ✅ +29   1m 33s ⏱️ +22s
 11 suites + 1     5 💤 + 5 
 11 files   + 1     0 ❌ ± 0 

Results for commit bca60b5. ± Comparison against base commit 3e6a5be.

♻️ This comment has been updated with latest results.

The CI failure was not the env-only save-parse issue I first suspected — it was
a 404. Catalogue_status_without_upload_returns_null_catalogue_block creates a
fresh factory and GETs /players/{id}/catalogue/satisfactory WITHOUT minting a
token, so the dev Player (seeded inside MintTokenAsync) never existed and the
endpoint 404s for the unknown player (same contract as
Re_ingest_for_unknown_player_returns_404).

Extracted the seed into AgentApiFactory.EnsureDevPlayerAsync() (MintTokenAsync
now delegates to it) and call it in that test before the GET. Full project now
29 passed / 0 failed / 5 skipped locally and on CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit 589e11a into main May 29, 2026
13 checks passed
@ChrisonSimtian
ChrisonSimtian deleted the refactor/282-test-split-apiservice branch May 29, 2026 01:30
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