Repository navigation
Conversation
FOCA 0.15.0 is not released yet, so its release candidate, commit 5f07646 on FOCA's `dev` branch, is installed from Git. The image installs Git for the build and removes it again, and checks that FOCA 0.15 is installed, so that the app runs on FOCA 0.15 code although the base image is still FOCA 0.14.0 (no 0.15.0 image exists yet). `TODO(#104)` comments say how to switch to the release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA 0.15 provides `foca.utils.logging.escape_log_value()`, which the app copied in `cloud_registry.utils` until then. Use FOCA's and remove the copy and its tests (FOCA tests it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA 0.15 serves GA4GH service info from its config section `service_info`, validates it against the GA4GH `Service` schema on startup and serves the version of an installed package, as the app did itself (#100). Use FOCA's instead: - Move the service info from `custom.endpoints.service_info` to `service_info.service`, with `service_info.package: cloud-registry` for the version. - Route `GET /service-info` to FOCA's controller (`foca.api.service_info`) in `additions.openapi.yaml`. - Remove the app's controller, its service info module and the startup check, and their tests; FOCA covers them. App tests check that FOCA serves the configured service info with the package version, removes `null` fields, and that invalid service info, or service info still in the custom config, fails startup. `GET /service-info` is unchanged for clients. BREAKING CHANGE: the service info is configured in `service_info.service` instead of `custom.endpoints.service_info` (Helm chart: `config.service_info.service`); configs still setting the latter are rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Errors were sent as `application/problem+json`, FOCA's default, while the GA4GH specifications declare `application/json` for error responses; #96 therefore declared `application/problem+json` in addition. FOCA 0.15 makes the media type configurable: - Set `exceptions.media_type: application/json`, which applies to all errors handled by FOCA (app exceptions, request validation, security errors, unknown routes and methods, FOCA's permissions API). - Send the app's own problem details (`problem()`, `validation_problem()`) with the configured media type, too. - Remove the `application/problem+json` declarations from `additions.openapi.yaml`, so that error responses are declared as in the GA4GH specification only. Tests check the media type of each kind of error response and that the specification declares only `application/json` for error responses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the changes of the FOCA 0.15 upgrade for users in the 0.3.0 release notes: errors are sent as `application/json`, the service info is served by FOCA from `service_info.service`, and configs must apply FOCA 0.15's config changes. Resolve the #104 part of the TODO note. The note still blocks the release, for roles granted to groups (#105) and for requiring the FOCA 0.15.0 release instead of its release candidate. Closes #104 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Install FOCA from commit 43d9526 on its `dev` branch, which adds configurable traffic logging (FOCA #328) and limits request bodies without `Content-Length` via `server.max_content_length` (FOCA #329). FOCA's service info controller is now itself decorated (traffic logging), so the test that `GET /service-info` is routed to it compares the unwrapped functions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA 0.15 limits request bodies itself (`server.max_content_length`): bodies with a larger `Content-Length` are rejected (`413`) without reading them, and bodies without one (e.g., chunked) are read up to one byte over the limit, before authentication and validation, as the app did itself (#119). Use FOCA's instead: - Set `server.max_content_length: 1048576` in the base config and remove `custom.max_content_length` from the custom config model; configs still setting it are rejected on startup. - Remove the app's before-request check (`check_streamed_size()`) and its setting of Flask's `MAX_CONTENT_LENGTH`. FOCA also rejects invalid `Content-Length` headers (`400`). - The app's tests of the behaviour now run against FOCA's check; drop the tests of the removed config field. - Chart: take the ingress-nginx body size limit, and its render-time validation, from `config.server.max_content_length`. - Image: fail the build unless FOCA limits bodies without `Content-Length` (FOCA #329). BREAKING CHANGE: the size limit of request bodies is configured in `server.max_content_length` instead of `custom.max_content_length` (Helm chart: `config.server.max_content_length`); configs still setting the latter are rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since FOCA #328, FOCA's service info controller logs requests and responses unless `service_info.log_traffic` is disabled, so `GET /service-info` is logged again, as when the app served it with its own controller. Check that it is. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Describe the size limit of request bodies as FOCA's `server.max_content_length` (also for chunked bodies, and `400` for invalid `Content-Length` headers), configs still setting `custom.max_content_length` being rejected, and that requests for the service info are logged as before. The TODO note for #105 stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA 0.15.0 is released: require foca>=0.15.0,<0.16 from PyPI instead of the release candidate from Git, and build the image on FOCA's 0.15.0 image (pinned by digest). Git is no longer installed for the build, and the checks that the installed FOCA has the 0.15 features are dropped, as the requirement ensures it. The release notes drop the TODO item about the pin. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The app no longer validates with jsonschema or reads YAML itself (the service info is served by FOCA), so neither is a direct requirement. The tests' YAML parser is a dependency of FOCA. Drop the jsonschema type stubs too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rendering fails if values still set config.custom.max_content_length or config.custom.endpoints.service_info, which the app rejects since the FOCA 0.15 upgrade, naming their replacements (config.server.max_content_length, config.service_info.service), like the chart's other checks for removed settings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since the service info is served by FOCA, the app no longer validates with jsonschema itself; date-times aren't checked by Connexion's request validation (without rfc3339-validator). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA's `server.max_content_length` takes `null` as no limit, while the removed `custom.max_content_length` rejected it, so an overlay could silently lift the limit, allowing bodies of any size (also chunked ones) before authentication. The app now logs a warning on startup, and the README says what `null` means. The Helm chart still refuses `null`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The values schema allows `config.server: null`, and the size limit of ingress-nginx treated it as the default, but the overlay passed it on, so FOCA replaced the base config's `server` with `null` and refused to start. Like `custom: null`, it is now left out of the overlay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThis breaking release upgrades the registry to pinned FOCA 0.15.0, delegates service-info, request-size enforcement, error formatting, and logging utilities to FOCA, migrates Helm and application configuration to the new FOCA-owned keys with explicit rejection of removed settings, and updates API documentation, tests, and release guidance. Sequence diagram for FOCA-served service infosequenceDiagram
participant Client
participant FOCA
participant Config
Client->>FOCA: GET /service-info
FOCA->>Config: Read service_info.service
Config-->>FOCA: GA4GH Service info
FOCA-->>Client: 200 Service info
Sequence diagram for FOCA request body limitsequenceDiagram
participant Client
participant FOCA
participant Registry
Client->>FOCA: Request with body
FOCA->>FOCA: Check server.max_content_length
alt body exceeds limit
FOCA-->>Client: 413 Content Too Large
else body within limit
FOCA->>Registry: Validate and dispatch request
Registry-->>Client: Registry response
end
Flow diagram for migrated configuration validationflowchart TD
Values[Helm values or application config] --> Legacy{Removed FOCA keys present?}
Legacy -->|Yes: custom.max_content_length or custom.endpoints.service_info| Reject[Reject configuration with migration error]
Legacy -->|No| NewKeys[Use server.max_content_length and service_info.service]
NewKeys --> Render[Render Helm chart or start application]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #127 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 9 -1
Lines 775 704 -71
=========================================
- Hits 775 704 -71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. Setting server.max_content_length to null now lets the app accept request bodies without a size limit; a large or sustained request could exhaust resources and cause an outage before reverting takes effect. The default remains 1 MiB, but this changes a protective boundary for deployments that disable the limit.
A warning on startup still let `server.max_content_length: null`
remove the size limit of request bodies, so that bodies of any size
(also chunked ones) were read before the access token was checked.
As the removed `custom.max_content_length` and the Helm chart did, the
app now refuses it: `create_app()` raises a RuntimeError. Raised by
Sourcery ("needs a human reviewer").
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Upgrades the registry to FOCA 0.15.0 (released on PyPI and Docker Hub).
foca>=0.15.0,<0.16; the image is built onelixircloud/foca:0.15.0-py3.12, pinned by digest.jsonschemaandPyYAMLare no longer direct requirements (both come with FOCA).service_info.service(Helm:config.service_info.service) instead ofcustom.endpoints.service_info; the app's own service info module isremoved.
POST /service-infostays removed.server.max_content_length(Helm:config.server.max_content_length,which also sets the ingress-nginx limit) instead of
custom.max_content_length; FOCA also limits chunked bodies.chart fails rendering, naming the new keys).
application/jsonvia FOCA's configurable error mediatype; FOCA's
escape_log_value()replaces the local copy; traffic loggingof
GET /service-infois kept and tested.docs/releases/0.3.0.md) and READMEs updated. The feat: grant roles on services to groups #105TODO stays in the release notes on purpose (the release workflow fails on
TODO until feat: grant roles on services to groups #105 is done).
Closes #104.
Verification
Local, on the final tree:
coverage run --source=cloud_registry -m pytest(Python 3.10, FOCA 0.15.0from PyPI): 683 passed;
coverage report: 100 %.pyteston Python 3.12: 683 passed.ruff check .,ruff format --check .: passed.mypy cloud_registry tests: no issues.ast-grep scan,ast-grep test --skip-snapshot-tests: passed;semgrep --config .semgrep --error: no findings.helm lint deployment --strict -f deployment/ci/test-values.yaml(with andwithout MongoDB auth, as in CI) and
helm template: passed.unexpected files.
docker compose up -d --build --waitwith the CI smoke checks (probe,9 API checks against MongoDB, app version, license text): passed. The image
is built from the pinned 0.15.0 digest, has no git and reports FOCA 0.15.0
(run before the round-2 and Sourcery fixes, a startup check and a chart template
change; CI ran it on the final tree: passed).
Not run locally: the full
pre-commit run --all-filesand gitleaks (hookenvironments can't be fetched behind the sandbox proxy); the hooks above were
run directly. CI runs them.
CI (run 39593511239, final head f071ccb): all checks passed (static analysis incl. full pre-commit and gitleaks, tests on Python 3.10 and 3.12, Helm chart, Docker Compose smoke test, Read the Docs).
Review
Two local review rounds (adversarial and quality, then adversarial).
Fixed: unused requirements, chart checks for the removed keys, stale docs;
round 2:
config.server: nullpassed on to FOCA (which refuses it) andserver.max_content_length: nullsilently lifting the body limit. Sourceryflagged the latter (first a startup warning) as needing a human reviewer, so
the app now refuses to start with
null, as the removedcustom.max_content_lengthand the chart do.Declined review findings
None.
Open questions
None.
🤖 Generated with Claude Code