Skip to content

[O2B-1623] Document the simulation passes endpoints in the HTTP API documentation - #2270

Merged
graduta merged 6 commits into
mainfrom
feature/O2B-1623/docs-simulation-passes-endpoints
Oct 22, 2026
Merged

graduta merged 6 commits into
mainfrom
feature/O2B-1623/docs-simulation-passes-endpoints

Conversation

@graduta

@graduta graduta commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Part of a stack of PRs documenting the HTTP API (O2B-1623). The earlier PRs of the stack are merged: this one is rebased on main and regenerated with the current generator. The following PRs of the stack are rebased one by one, once the previous one is merged.

Notable changes for users:

  • filter[lhcPeriodIds][] and filter[dataPassIds][] of GET /api/simulationPasses now reject (400) a value that is not a number, instead of answering with an empty list (the ids given in the query are converted to numbers).
  • GET /api/simulationPasses/{id} now rejects (400) an id that is not a positive integer (0, negative numbers, decimals), instead of answering with a 404.
  • The simulation passes endpoints are now documented at /api-docs, with parameters, responses and curl examples:
    • GET /api/simulationPasses: paginated list with filters (ids, names, LHC periods, data passes) and sorting
    • GET /api/simulationPasses/{id}: one simulation pass

Notable changes for developers:

  • Checked the chain of the endpoint: all files have their license header, no use case is involved, the entity has no createdAt / updatedAt, and the router references existing handlers.
  • SimulationPassService.getAll queried the repository directly (with two inline sub-queries) while getByIdentifier and getOneOrFail use small functions: it now uses getAllSimulationPasses(qbConfiguration), getSimulationPassIdsByLhcPeriods and getSimulationPassIdsByDataPasses (each id returned once). The behaviour is unchanged and the three functions have tests. The other counted lists (DataPassService, LhcPeriodStatisticsService, LogService, QcFlagTypeService) still query the repository directly and could follow the same pattern.
  • The id of the endpoint is validated with EntityIdDto (it was a plain Joi.number()), with an API test of the four kinds of invalid values.
  • The lhcPeriodIds and dataPassIds filters are validated as numbers (they were strings, whereas the ids are integers in the database and the ids filter of the same endpoint, RunFilterDto and the data passes endpoint use numbers). An API test checks the three id filters.
  • The two handlers disabled the JSDoc rules: they are documented.
  • The pagination components (PageLimit, PageOffset, PageMeta) are added to the spec, as this is the first paginated endpoint documented.
  • lib/server/api-docs/openapi.yaml is updated by hand, API.md and index.html are regenerated with npm run docs:api (separate commit).
  • List filters are documented as repeated filter[x][] parameters, which is what the Joi validation requires (a single value without [] is rejected). Adds the shared SortOrder schema.

Changes made to the database:

  • None

🤖 Generated with Claude Code

@graduta
graduta requested a review from isaachilly as a code owner October 20, 2026 13:02
@graduta
graduta added this pull request to stack #2265 October 20, 2026 13:02
@graduta graduta changed the title feature/O2B 1623/docs simulation passes endpoints [O2B-1623] Document the simulation passes endpoints in the HTTP API documentation Oct 20, 2026
@graduta graduta added documentation Improvements or additions to documentation backend labels Oct 20, 2026
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.45%. Comparing base (63833ec) to head (06fe873).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2270      +/-   ##
==========================================
+ Coverage   46.39%   46.45%   +0.05%     
==========================================
  Files        1051     1054       +3     
  Lines       17363    17379      +16     
  Branches     3161     3165       +4     
==========================================
+ Hits         8056     8073      +17     
+ Misses       9307     9306       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@graduta
graduta removed this pull request from stack #2265 October 22, 2026 09:29
@graduta
graduta added this pull request to stack #2276 October 22, 2026 09:30
Base automatically changed from feature/O2B-1623/docs-shift-data-endpoint to main October 22, 2026 12:05
@graduta
graduta force-pushed the feature/O2B-1623/docs-simulation-passes-endpoints branch from 56653ef to 7ebbb0a Compare October 22, 2026 12:09
`SimulationPassService.getAll` queried the repository directly, including two inline sub-queries to filter on LHC periods and on data passes, while `getByIdentifier`
and `getOneOrFail` already rely on small functions. It now uses `getAllSimulationPasses(qbConfiguration)` and the two functions returning the ids of the
simulation passes linked to LHC periods (`getSimulationPassIdsByLhcPeriods`) and to data passes (`getSimulationPassIdsByDataPasses`, each id is returned once).
The behaviour of the service is unchanged, and the three functions have their own tests.
The two handlers of the simulation passes controller disabled the JSDoc rules instead of describing their parameters and their result.
`GET /api/simulationPasses/:id` accepted any number (`0`, negative numbers, decimals) and answered with a 404. The id is now validated with `EntityIdDto`, so
that invalid values are rejected with a 400, and an API test checks the four kinds of invalid ids.
@graduta
graduta force-pushed the feature/O2B-1623/docs-simulation-passes-endpoints branch from 7ebbb0a to 0fb89cf Compare October 22, 2026 12:20
…ation passes as numbers

`filter[lhcPeriodIds]` and `filter[dataPassIds]` were validated as strings, although the ids of the LHC periods and of the data passes are integers in the database
and the `ids` filter of the same endpoint (and the filters of the runs and of the data passes endpoints) are validated as numbers. A value that is not a number was
accepted and answered with an empty list: it is now rejected with a 400, and the ids given as strings in the query are converted to numbers. An API test checks the
three filters.
@graduta
graduta force-pushed the feature/O2B-1623/docs-simulation-passes-endpoints branch from 0fb89cf to 06fe873 Compare October 22, 2026 12:41
@graduta
graduta merged commit 2249a99 into main Oct 22, 2026
26 checks passed
@graduta
graduta deleted the feature/O2B-1623/docs-simulation-passes-endpoints branch October 22, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend documentation Improvements or additions to documentation

Development

Successfully merging this pull request may close these issues.

2 participants