Skip to content

build: bump FOCA to 0.22.0 - #382

Merged
uniqueg merged 4 commits into
devfrom
build/foca-0.22.0
Nov 9, 2026
Merged

uniqueg merged 4 commits into
devfrom
build/foca-0.22.0

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Closes #381

Summary

  • FOCA 0.22.0: foca>=0.22.0,<0.23 in pyproject.toml, uv.lock (only FOCA changes), and the base image elixircloud/foca:0.22.0-py3.13, pinned by digest, in the Dockerfile. 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: True in cloud_registry/config.yaml keeps the validator's reason as detail of 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's type, code (invalid-request) and errors. 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).
  • New test tests/test_validation_reasons.py: the reason stays in detail, and the invalid fields are listed.
  • Docs:
    • docs/upgrading.md (From 1.0.0rc1): a FOCA 0.22 paragraph on response members, log changes (routes instead of paths, no rejected values at INFO) 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.yaml and the tests. It asked for the FOCA bump in a separate PR first, so it needs dev merged in after this one.

Deprecations left for follow-ups

FOCA 0.22 warns of these. Fixing them now isn't small or compatible:

  • The exception map (cloud_registry/exceptions.py) uses werkzeug classes, and FOCA logs a warning per class at startup. Switching to foca.errors would stop matching raw werkzeug exceptions (e.g., Flask's 404). TooManyRequests and BadGateway have no counterpart in foca.errors.
  • cloud_registry/namespace_subjects.py (--dry-run) uses set_app_config(). It should use Foca.use_config(), which needs a restructure of main().
  • Preparing for the ASGI release: Flask and Werkzeug imports and Flask test clients throughout (FOCA's ast-grep rule 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, with helm dependency build deployment and the charts.sha256 check passing.
  • pre-commit run --all-files: all hooks pass.
  • Not run locally: the Docker build, smoke test and image scan, 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

  • "The reason is still logged by default, as the root logger is at DEBUG": the console handler in config.yaml is at INFO (level: 20), so DEBUG records aren't emitted by default.
  • Move the response and log changes from Maintenance to Features or Fixes in the release notes: they come with the dependency bump and are described in the upgrade notes, which the entry links.
  • Squash or retitle the WIP commit: the PR is squash-merged under its own title.
  • Declare type, code and errors in 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 of values.schema.json names FOCA 0.22; new test tests/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:

  • Upgrade the application to FOCA 0.22.0, including its validation error details and updated request logging behavior.
  • Preserve validator reasons in validation error details while exposing FOCA’s invalid-request metadata and invalid-field errors where available.

Build:

  • Update the pinned FOCA base image and Python dependency to version 0.22.0.

Documentation:

  • Document FOCA 0.22 validation responses, logging changes, deprecations, and the release upgrade.

Tests:

  • Add coverage for preserved validation reasons and reported invalid fields.

uniqueg and others added 2 commits November 9, 2026 10:52
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]>
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Upgrade the FOCA dependency and pinned base image to 0.22.0, and update deployment configuration for the new version.

  • Dockerfile L13
  • deployment/values.schema.json L3
  • pyproject.toml L121

Keep validator reasons in error details while enabling FOCA 0.22's invalid-field response metadata.

  • cloud_registry/config.yaml L401-405

Documentation

Document the validation response fields introduced by FOCA 0.22.

  • docs/api.md L378-382

Explain FOCA 0.22's response and logging changes, deprecation warnings, and upgrade considerations.

  • docs/upgrading.md L63-65, L72-92

Record the FOCA 0.22.0 upgrade and its notable effects in the release notes.

  • docs/releases/1.0.0rc2.md L111-115

Clarify that FOCA logs request routes at the usual level and paths at DEBUG.

  • docs/operations.md L31-33

Tests

Verify that rejected requests preserve validator reasons and include FOCA 0.22 invalid-request metadata and invalid fields.

  • tests/test_validation_reasons.py L1-28

Lock files and vendored code

Update the dependency lock file for FOCA 0.22.0.

  • uv.lock L680, L958, L981-983

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (31c7b8f) to head (4eb6f02).

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.
📢 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.

@uniqueg
uniqueg marked this pull request as ready for review November 9, 2026 12:41

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread Dockerfile Resolved
Refs #381

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 7513683 into dev Nov 9, 2026
32 checks passed
@uniqueg
uniqueg deleted the build/foca-0.22.0 branch November 9, 2026 13:20
uniqueg added a commit that referenced this pull request Nov 9, 2026
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]>
uniqueg added a commit that referenced this pull request Nov 9, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: bump FOCA to 0.22.0

1 participant