Skip to content

[O2B-1623] Document the EOS report endpoint in the HTTP API documentation - #2280

Open
graduta wants to merge 4 commits into
feature/O2B-1623/docs-gaq-detectors-endpointsfrom
feature/O2B-1623/docs-eos-report-endpoint
Open

graduta wants to merge 4 commits into
feature/O2B-1623/docs-gaq-detectors-endpointsfrom
feature/O2B-1623/docs-eos-report-endpoint

Conversation

@graduta

@graduta graduta commented Oct 22, 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). This PR is stacked on the previous one of the stack (its base is the branch of that PR): GitHub retargets it to main once the PRs below are merged.

Notable changes for users:

  • The POST /api/eos-report endpoint is now documented at /api-docs (flagged x-llm-exclude, as it creates a log entry).
  • When the creation of a report fails because of a service error, the endpoint now answers with the matching error (for example a 404 if the calling user is unknown) instead of a generic server error.

Notable changes for developers:

  • Checked the chain of the endpoint: all files have their license header, no use case is involved, the service already composes small functions (and logService), and the endpoint returns the log it creates, so there is no entity of its own to remove createdAt / updatedAt from.
  • The handler had no error handling: errors of the services were not converted to responses (unlike the other controllers) and ended as a generic server error. It now uses updateExpressResponseFromNativeError (separate commit, easy to drop if not wanted), with API tests for the validation errors (unknown report type, missing type specific part, start of shift given in the body).
  • The handler disabled a JSDoc rule: it is documented. The API test was titled GET /api/eos-report whereas the endpoint is a POST: fixed.

Changes made to the database:

  • None

🤖 Generated with Claude Code

The handler disabled a JSDoc rule instead of describing its parameters and its result, and the API test of the endpoint was titled `GET /api/eos-report` whereas
the endpoint is a `POST`.
… report fails

The handler of `POST /api/eos-report` had no error handling, unlike the other controllers: an error of the services (for example the current user not being found) was not
sent as such and ended as a generic server error. Errors are now converted with `updateExpressResponseFromNativeError` (a missing user gives a 404 for example). API tests check
the validation errors of an unknown report type, of a missing type specific part and of a start of shift given in the body.
@graduta graduta added documentation Improvements or additions to documentation backend labels Oct 22, 2026
@graduta
graduta requested a review from isaachilly as a code owner October 22, 2026 13:46
@codecov

codecov Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 46.65%. Comparing base (2f0bc63) to head (9730487).

Files with missing lines Patch % Lines
lib/server/controllers/eosReport.controller.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@                                Coverage Diff                                @@
##           feature/O2B-1623/docs-gaq-detectors-endpoints    #2280      +/-   ##
=================================================================================
+ Coverage                                          46.61%   46.65%   +0.04%     
=================================================================================
  Files                                               1063     1063              
  Lines                                              17435    17439       +4     
  Branches                                            3176     3176              
=================================================================================
+ Hits                                                8127     8136       +9     
+ Misses                                              9308     9303       -5     

☔ 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 added this pull request to stack #2276 October 22, 2026 14:02

This branch has not been deployed

No deployments
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