Repository navigation
build: bump FOCA to 0.22.0 - #382
Conversation
Work in progress; local checks not finished yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test that rejected requests keep the validator's reason as detail (exceptions.validation_reasons) and list the invalid fields of FOCA 0.22. Document the new members in the API reference and correct the upgrade note on logged URI values. Refs #381 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideConfigurationUpgrade the FOCA dependency and pinned base image to 0.22.0, and update deployment configuration for the new version.
Keep validator reasons in error details while enabling FOCA 0.22's invalid-field response metadata.
DocumentationDocument the validation response fields introduced by FOCA 0.22.
Explain FOCA 0.22's response and logging changes, deprecation warnings, and upgrade considerations.
Record the FOCA 0.22.0 upgrade and its notable effects in the release notes.
Clarify that FOCA logs request routes at the usual level and paths at DEBUG.
TestsVerify that rejected requests preserve validator reasons and include FOCA 0.22 invalid-request metadata and invalid fields.
Lock files and vendored codeUpdate the dependency lock file for FOCA 0.22.0.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Refs #381 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #382 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 27 27
Lines 3265 3265
=========================================
Hits 3265 3265 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="Dockerfile" line_range="13" />
<code_context>
## image; Dependabot updates the tag and digest together
## (`.github/dependabot.yml`)
-FROM elixircloud/foca:0.21.0-py3.13@sha256:ba79033cab60dd79419c2c44f90000f4fb9aa8d495ea09c2798a7348516bd84f AS base
+FROM elixircloud/foca:0.22.0-py3.13@sha256:bf02db1195d60940dd3b29e53ce4757854155e258f35199e28d778cbf6128f9a AS base
##### BUILD #####
</code_context>
<issue_to_address>
**Operations docs name the old log fields**
`docs/operations.md` still says FOCA logs requests with their “method, path and client address,” but FOCA 0.22 logs the route instead of the path at normal log levels and logs the path at `DEBUG`. Operators following that description can look for the wrong request field in their logs.
Update the operations documentation to describe FOCA 0.22’s route logging and the path’s `DEBUG` level.
</issue_to_address>Linked issues
#381 build: bump FOCA to 0.22.0 · 4 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Bump foca in pyproject.toml and uv.lock, and use the pinned FOCA 0.22.0 base image. | ✅ Met | The dependency constraint and Docker image tag and digest are updated; the PR description says the lockfile changes only FOCA. |
| 2 | Follow the migration guide by covering validation details and invalid fields, and adjusting tests for validation details or INFO logs as needed. | ✅ Met | The config preserves validator reasons as detail, and the new test checks that behavior and FOCA 0.22's invalid-field response members; existing detail and logging tests remain compatible. |
| 3 | Fix new deprecation warnings where doing so is small and compatible, and list the rest as follow-ups. | ✅ Met | The PR description lists the exception-map, set_app_config, and Flask/Werkzeug deprecations as follow-ups and explains why their fixes are not small or compatible. |
| 4 | Update the upgrade notes and release notes to name the FOCA version. | ✅ Met | The upgrade notes describe FOCA 0.22 behavior, and the 1.0.0rc2 release notes include the bump. |
Sourcery assessment
Approved.
Refs #381 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Takes dev's FOCA 0.22.0 pins (#382): `foca>=0.22.0,<0.23` in `pyproject.toml`, the release image `elixircloud/foca:0.22.0-py3.13` by digest in the `Dockerfile` and its `uv.lock`, replacing the temporary pins of FOCA's dev head. The 0.22.0 image has no zlib1g findings. Keeps dev's `exceptions.validation_reasons: true`: `detail` stays the reason of the rejection, i.e., the validator's message for the schema validation and the locations and messages of the invalid fields for the registry's own checks. The docs (Errors in `api.md`, `upgrading.md`, the 1.0.0rc2 notes) and the comment in `config.yaml` say so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
With `exceptions.validation_reasons` (set by #382), `detail` is the reason of the rejection: the validator's message, which may quote the value, for the schema validation, and the locations and messages of the invalid fields for the registry's own checks. The tests assumed FOCA 0.22's default instead. - `invalid_fields()` checks that `errors` doesn't quote the values, and no longer what `detail` says. - Tests of the own checks check that no part of the response quotes the values, and the `detail` of all fields of a registration. - Tests of non-JSON bodies, unpaired surrogates and large values keep dev's checks of the reason. - `tests/test_validation_reasons.py` covers both settings, also `validation_reasons: false`, for the schema validation and the own checks. - The spec (`InvalidRequestError`) and `reject()` describe both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #381
Summary
foca>=0.22.0,<0.23inpyproject.toml,uv.lock(only FOCA changes), and the base imageelixircloud/foca:0.22.0-py3.13, pinned by digest, in theDockerfile. That base image no longer has the zlib1g findings that fail the image scan with the 0.21.0 base. There were no Trivy ignores for them to remove.exceptions.validation_reasons: Trueincloud_registry/config.yamlkeeps the validator's reason asdetailof requests rejected by the validation of the spec, as up to FOCA 0.21. Clients rely on it, and FOCA 0.22's default would change it. Responses still gain FOCA 0.22'stype,code(invalid-request) anderrors. feat: report invalid fields of write requests #378 drops this setting later, when the registry names invalid fields itself (feat: report invalid fields of registrations #317).tests/test_validation_reasons.py: the reason stays indetail, and the invalid fields are listed.docs/upgrading.md(From 1.0.0rc1): a FOCA 0.22 paragraph on response members, log changes (routes instead of paths, no rejected values atINFO) and deprecation warnings.docs/api.md(Errors): the new members.docs/releases/1.0.0rc2.md(Maintenance): an entry for the bump.Overlap with #378: that PR also changes the pins,
config.yamland the tests. It asked for the FOCA bump in a separate PR first, so it needsdevmerged in after this one.Deprecations left for follow-ups
FOCA 0.22 warns of these. Fixing them now isn't small or compatible:
cloud_registry/exceptions.py) uses werkzeug classes, and FOCA logs a warning per class at startup. Switching tofoca.errorswould stop matching raw werkzeug exceptions (e.g., Flask's 404).TooManyRequestsandBadGatewayhave no counterpart infoca.errors.cloud_registry/namespace_subjects.py(--dry-run) usesset_app_config(). It should useFoca.use_config(), which needs a restructure ofmain().flask-import).How it was verified
coverage run --source cloud_registry,scripts -m pytest -W ignore::DeprecationWarning: 2338 passed, 11 skipped, 100% coverage. That run was before the review fix; afterwards, the touched modules passed (tests/test_app.py,tests/test_config.py,tests/test_docs_hooks.py,tests/test_validation_reasons.py: 358 passed). Helm 3.22.1, withhelm dependency build deploymentand thecharts.sha256check passing.pre-commit run --all-files: all hooks pass.mkdocs build --strict, and the tests against a real MongoDB. CI runs them.Review
Full lane (it changes config), one round: adversarial and quality reviewers.
Declined review findings
DEBUG": the console handler inconfig.yamlis atINFO(level: 20), soDEBUGrecords aren't emitted by default.type,codeanderrorsin the API spec's error schema: feat: report invalid fields of write requests #378 adds that schema (InvalidRequestError,FieldError). Responses aren't affected, as the schema allows extra members.Fixed after review: the API reference documents the new members; the upgrade and release notes say they come only where the invalid fields are known, and that the logs then show the mapped
detail; the note on logged URI values for FOCA 0.21 is corrected; the comment ofvalues.schema.jsonnames FOCA 0.22; new testtests/test_validation_reasons.py.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Upgrade FOCA to 0.22.0 while preserving compatible validation details and documenting the resulting API and logging changes.
Enhancements:
Build:
Documentation:
Tests: