Repository navigation
[O2B-1623] Document the ctp-trigger-counters endpoint in the HTTP API documentation - #2268
Merged
graduta merged 7 commits intoOct 22, 2026
Merged
Conversation
graduta
added this pull request to stack #2265
October 20, 2026 12:59
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2268 +/- ##
==========================================
+ Coverage 46.36% 46.40% +0.04%
==========================================
Files 1049 1051 +2
Lines 17351 17363 +12
Branches 3160 3161 +1
==========================================
+ Hits 8044 8057 +13
+ Misses 9307 9306 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
graduta
removed this pull request from stack #2265
October 22, 2026 09:29
graduta
added this pull request to stack #2276
October 22, 2026 09:30
Base automatically changed from
feature/O2B-1623/docs-run-types-endpoints
to
main
October 22, 2026 10:08
graduta
force-pushed
the
feature/O2B-1623/docs-ctp-trigger-counters-endpoint
branch
2 times, most recently
from
October 22, 2026 10:52
0b6a793 to
4c7e365
Compare
…TP trigger counters files The router, the controller, the service, the model, the migration renaming the table and the three tests of the CTP trigger counters had no license header, unlike nearly all the other files of their layers. The HTTP and gRPC controllers handlers are now documented instead of disabling the JSDoc rules, and the service documentation of `className` is fixed (it described the run number).
`CtpTriggerCountersService` used the repository directly. It now relies on two small functions, `getAllCtpTriggerCounters(qbConfiguration)` returning models and `createOrUpdateCtpTriggerCounters(criteria, counters)`, and keeps the adapter, the run existence check and the public API (`getPerRun`, `createOrUpdatePerRun`), as it is done for run types, detectors and tags. Both small functions have their own tests.
…he other run endpoints `GET /api/ctp-trigger-counters/:runNumber` accepted any number (`0`, negative numbers, decimals) and answered with an empty list. The run number is now validated with `EntityIdDto` like in `GetRunDto`, so that invalid values are rejected with a 400. An API test checks the four kinds of invalid run numbers.
graduta
force-pushed
the
feature/O2B-1623/docs-ctp-trigger-counters-endpoint
branch
from
October 22, 2026 11:40
4c7e365 to
1e10853
Compare
… not exist `GET /api/ctp-trigger-counters/:runNumber` answered `200` with an empty list for a run that does not exist, unlike the other endpoints reading data of a run (`/api/runs/:runNumber/logs`, `/api/runs/:runNumber/flps`), which hides a wrong run number. The counters are fetched first and the run is only checked when none is found, to tell a run without counters (empty list) from a missing run (`NotFoundError`, so a 404): counters can only exist for an existing run, as `ctp_trigger_counters.run_number` is a foreign key, so the common case still costs a single query.
Nothing uses the creation and update dates of the CTP trigger counters: the run details page only reads the class name and the counters (`lmb`, `lma`, `l0b`, `l0a`, `l1b`, `l1a`), the service test already removes the dates before comparing, and `CtpTriggerCountersAdapter.toEntity` is only used by `CtpTriggerCountersService.getPerRun`. The adapter now stops returning them, the `CtpTriggerCounters` typedef is updated and the API test checks the returned keys.
…-counters endpoint
graduta
force-pushed
the
feature/O2B-1623/docs-ctp-trigger-counters-endpoint
branch
from
October 22, 2026 11:51
1e10853 to
260724d
Compare
graduta
deleted the
feature/O2B-1623/docs-ctp-trigger-counters-endpoint
branch
October 22, 2026 11:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have a JIRA ticket
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
mainand 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:
GET /api/ctp-trigger-counters/{runNumber}now answers404for a run that does not exist, instead of200with an empty list (like/api/runs/{runNumber}/logsand/flps). A run that exists but has no counters still gives an empty list.GET /api/ctp-trigger-counters/{runNumber}now rejects (400) a run number that is not a positive integer (0, negative numbers, decimals), instead of answering with an empty list.createdAtandupdatedAtare no longer sent for CTP trigger counters (breaking for any external client reading them).ctp-trigger-countersendpoints are now documented at/api-docs, with parameters, responses andcurlexamples:GET /api/ctp-trigger-counters/{runNumber}: trigger counters of a run, per trigger class (a run without counters gives an empty list, a run that does not exist gives a 404)Notable changes for developers:
CtpTriggerCountersService.getPerRunfetches the counters first and only checks the run (getRunOrFail) when none is found, so the common case is a single query. This is sound because counters can only exist for an existing run:ctp_trigger_counters.run_numberis a foreign key torunsand the only writer (createOrUpdatePerRun) checks the run.EntityIdDto, like inGetRunDto, instead of a plainJoi.number(). An API test checks the four kinds of invalid values.CtpTriggerCountersServiceis built on two small functions,getAllCtpTriggerCounters(qbConfiguration)(returns models) andcreateOrUpdateCtpTriggerCounters(criteria, counters), instead of using the repository directly, like run types, detectors and tags. The public API of the service (getPerRun,createOrUpdatePerRun), the adapter and the run existence check are unchanged. Both functions have tests.classNameparameter of the service was documented as a run number.CtpTriggerCountersAdapter.toEntity(only used byCtpTriggerCountersService.getPerRun) no longer returnscreatedAtandupdatedAt: nothing uses them (the run details page only reads the class name and the counters, and the service test already removed the dates before comparing). TheCtpTriggerCounterstypedef is updated and the API test checks the returned keys.lib/server/api-docs/openapi.yamlis updated by hand,API.mdandindex.htmlare regenerated withnpm run docs:api(separate commit).Changes made to the database:
🤖 Generated with Claude Code