Skip to content

Ensure every mocks payload folder has a 404 case - #340

Open
Samuelfaure wants to merge 3 commits into
developfrom
worktree-mocks-payloads-404
Open

Ensure every mocks payload folder has a 404 case#340
Samuelfaure wants to merge 3 commits into
developfrom
worktree-mocks-payloads-404

Conversation

@Samuelfaure

Copy link
Copy Markdown
Contributor

Summary

  • 21 of 107 mocks/payloads/ endpoint folders had no not-found test case. Investigated each: for 14 of them the OpenAPI spec already documented a 404 (payload written straight from the spec's example); for the remaining 7 (api_entreprise_v3_dgfip_tva and all 6 cnous_etudiant_boursier v4/v5 variants) the spec simply never documented one, even though the underlying siade interactors already produce a NotFoundError in that case.
  • Fixed the 7 undocumented cases at the source: added the missing response '404' rswag blocks to the siade request specs (mirroring sibling/prior-version endpoints), added a WebMock "not found" stub for DGFIP TVA, and regenerated commons/swagger/*.yaml so the public OpenAPI docs now match actual behavior.
  • Added the corresponding 404.yaml to all 21 folders and regenerated their READMEs.
  • Updated the siade-sync-openapi-payloads skill so future syncs always check 404 coverage (not just missing folders) and know to fix an undocumented-but-real 404 at the siade/rswag level instead of skipping it.

Test plan

  • bundle exec rspec on the 7 touched siade request spec files — 19 examples, 0 failures
  • bash siade/bin/generate_swagger.sh (full request-spec suite) — 826 examples, 0 failures
  • LOCAL=1 bundle exec rspec in mocks/ — 6775 examples, 0 failures
  • Verified every payloads/ folder except france_connect/ (not an endpoint, always 200 by design) now has a 404 case

DGFIP::TVA::ValidateResponse and both CNOUS student-scholarship
interactors already return a NotFoundError on an empty provider
response, but the rswag request specs never documented a 404 case
for these endpoints (the v4/v5 CNOUS specs were cloned from v3 with
only the 200 path). Add the missing response blocks and regenerate
the OpenAPI docs so the public spec matches actual behavior.
21 of 107 endpoint folders had no not-found test case. Add a
404.yaml to each, matching the (now complete, see previous commit)
OpenAPI documentation for that operation, and regenerate the
per-folder READMEs.
The skill only checked for missing payload folders, not for folders
that exist but lack a 404 case, and it told agents to skip 404
whenever the OpenAPI spec didn't document it. Since NotFoundError is
a universal error every SIADE interactor can emit, an undocumented
404 is almost always a spec gap, not a real absence of the case.

Add a step to check 404 coverage on existing folders, and replace
the skip-if-undocumented rule with instructions to check the
interactor code and, if it does call resource_not_found!, fix the
rswag spec and regenerate the OpenAPI docs before writing the mock.
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