Skip to content

build: move to FOCA 0.20.0 - #351

Merged
uniqueg merged 3 commits into
devfrom
build/foca-0.20
Nov 4, 2026
Merged

uniqueg merged 3 commits into
devfrom
build/foca-0.20

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Closes #350

Summary

  • foca>=0.20.0,<0.21 and the lock; base image elixircloud/foca:0.20.0-py3.13 by digest. FOCA 0.19.0 has no migration guide, as nothing breaks.
  • The base image has no pip, so the build stage and the final stage install with uv mounted from the pinned stage, as proTES does (build(deps): bump https://github.com/semgrep/pre-commit from v1.184.0 to 1.185.0 in the pre-commit group #407 there), with --compile-bytecode for the read-only root file system. A smoke test step checks that the image has no installer. All pip-vendored entries leave .trivyignore.yaml.
  • Chart on foca-common 0.4.0: Chart.yaml, Chart.lock, charts.sha256, schema and links. New values cloudRegistry.startupProbe, readinessProbe and livenessProbe. requireAudience: true: the library now checks audiences of issuers, so the app's helper goes.
  • pluginStore.existingSecret doesn't apply: the app has no gateway plugins and no plugin store. It stays out of values.yaml and the schema, which test_schema_of_library records.
  • Tests: the custom configuration's error now has a plain ValueError as __cause__, not the ValidationError (tests/test_app.py). tests/test_image_build.py follows proTES's checks of the uv build.
  • Docs: docs/upgrading.md, docs/releases/1.0.0rc2.md, docs/development.md, deployment/README.md.

How it was verified

Locally, with Helm 3.22.1:

  • New tests first, failing on the old state (9 failed), then passing.
  • Full pytest with coverage (mongomock): 2 failed, 2025 passed, 11 skipped, 100%. Both failures were test_issuer_audience_required with the library's new message; the cases moved to test_issuer_audience_invalid, and tests/test_image_build.py, test_config.py and test_chart.py pass (303 passed).
  • tests/test_app.py, test_invitations.py, test_access_control.py and test_upgrade_rc1.py on MongoDB 7.0: 493 passed.
  • docker build of the image: FOCA 0.20.0, no pip or uv in the image, 20 .pyc files for the app.
  • pre-commit run --all-files: passes; gitleaks skipped in the last run, passed in the one before the last two commits.
  • mkdocs build --strict: passes.

Not run locally: the image scan, the smoke test and the chart install on kind. In CI, all checks pass, including Scan image (with the empty .trivyignore.yaml), Smoke test (with the new installer check), Chart and Test on mongomock and MongoDB 7.0.

Declined review findings

  • Test of the audience message is tied to the library's wording (medium): it is the message operators see, and the library is pinned.
  • The installer check could miss copies on other mounts (low): the image has a single layered file system, and tests/test_image_build.py covers the Dockerfile.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Upgrade the application and deployment chart to FOCA 0.20 while producing installer-free runtime images and exposing the updated chart configuration.

New Features:

  • Add configurable startup, readiness, and liveness probe overrides to the deployment chart.

Bug Fixes:

  • Update audience validation handling and related tests for FOCA 0.20 behavior.

Enhancements:

  • Upgrade the application to FOCA 0.20.0 and the deployment chart to foca-common 0.4.0.
  • Build and install image dependencies with mounted uv while keeping pip and uv out of the final image.
  • Compile Python bytecode during image builds and verify the resulting image contains no package installers.
  • Remove obsolete Trivy exceptions for pip-vendored packages.

Build:

  • Align the locked dependencies and Docker image build with the FOCA 0.20.0 base image.

CI:

  • Add a smoke-test check that built images contain neither pip nor uv.

Documentation:

  • Document FOCA 0.20 and foca-common 0.4.0 upgrade requirements, installer changes, audience validation, and probe overrides.

Tests:

  • Extend image-build and chart tests to validate uv-based installation, dependency alignment, installer absence, and probe overrides.

uniqueg and others added 2 commits November 4, 2026 01:06
Base image and lock on FOCA 0.20.0; the image has no pip, so its build
uses uv, and pip-vendored advisories leave .trivyignore.yaml. The chart
moves to foca-common 0.4.0, with values for probes, and leaves checking
audiences to the library.

Closes #350

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also review fixes in comments and docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added this to the v1.0.0-rc2 milestone Nov 4, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR upgrades the application to FOCA 0.20.0 and foca-common 0.4.0, reworks the image build around digest-pinned uv mounts so the final image contains neither installer, adds validation and CI coverage for the new build contract, and updates Helm behavior and documentation for probes and audience enforcement.

Sequence diagram for the hash-checked uv image build

sequenceDiagram
    participant UV as uv stage
    participant Build as Build stage
    participant Base as FOCA base image
    participant Image as Final image

    Build->>UV: uv export --frozen
    Build->>UV: uv venv
    Build->>UV: uv pip install --require-hashes
    Build->>Base: uv build --offline
    Base->>Image: Create final image
    Image->>UV: uv export --frozen
    Image->>UV: uv pip install --system --require-hashes --compile-bytecode
    Image->>UV: uv pip check --system
    Image-->>Image: Remove temporary uv lock
Loading

Flow diagram for Helm audience enforcement and configurable probes

flowchart TD
    Values[Helm values]
    Config[Rendered app configuration]
    Library[foca-common 0.4.0]
    Audience[requireAudience: true]
    Probes[Optional startup readiness liveness probes]
    Deployment[Kubernetes deployment]

    Values --> Config
    Library --> Config
    Config --> Audience
    Config --> Probes
    Audience --> Deployment
    Probes --> Deployment
Loading

File-Level Changes

Change Details Files
Upgrade the application and container build to FOCA 0.20.0 while removing pip and uv from the runtime image.
  • Pin the FOCA 0.20.0 dependency and digest-pinned base image, with corresponding lock updates.
  • Replace pip-based build and runtime installation with uv mounted only during build stages.
  • Build and install wheels offline with hash checks, compiled bytecode, dependency validation, and no Python downloads.
  • Add CI and Dockerfile tests verifying installer absence, pinned exports, offline behavior, and build requirements.
  • Remove obsolete pip-vendored vulnerability suppressions from the Trivy configuration.
Dockerfile
pyproject.toml
uv.lock
.trivyignore.yaml
.github/workflows/ci.yml
tests/test_image_build.py
Adopt foca-common 0.4.0 and update chart configuration for its probe and audience behavior.
  • Update chart dependency locks, checksums, documentation links, and schema for foca-common 0.4.0.
  • Expose startup, readiness, and liveness probe overrides that replace the library defaults.
  • Require audiences globally or per issuer and remove the obsolete chart-side audience helper.
  • Record that pluginStore.existingSecret is unsupported because this application has no gateway plugins or plugin store.
  • Add and update chart tests for probe overrides, issuer audiences, schema differences, and library validation behavior.
deployment/Chart.yaml
deployment/Chart.lock
deployment/charts.sha256
deployment/values.yaml
deployment/values.schema.json
deployment/templates/_helpers.tpl
tests/test_chart.py
tests/test_config.py
Document the FOCA and chart upgrade requirements and resulting operational changes.
  • Add upgrade guidance for derived images, audience validation, plugin store applicability, and probe overrides.
  • Update release, development, and deployment documentation for the new image build and chart version.
  • Reflect the changed FOCA validation exception type in application tests.
docs/upgrading.md
docs/releases/1.0.0rc2.md
docs/development.md
deployment/README.md
tests/test_app.py

Possibly linked issues

  • Move to FOCA 0.20.0 #350: The PR implements the requested FOCA 0.20.0 migration, including dependency and base-image updates, chart changes, tests, and upgrade notes.

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 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4a3b2e4) to head (0e52513).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #351   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines         2625      2625           
=========================================
  Hits          2625      2625           

☔ 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 4, 2026 00:26

@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 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="deployment/values.yaml" line_range="91-93" />
<code_context>
   probePath: /ga4gh/registry/v1/ui/
+  # Probes of the app's container (Kubernetes probe specs); if set, one
+  # replaces the default on `probePath` entirely
+  startupProbe: {}
+  readinessProbe: {}
+  livenessProbe: {}
   # Number of the app's pods; with more than one, the app stays available
   # while a pod is restarted or evicted (e.g., on node drains, crashes and
</code_context>
<issue_to_address>
**Invalid probe overrides reach deployment**

When a user supplies a malformed probe override, the chart schema accepts any object for these overrides, so a probe missing its required handler or containing invalid fields passes Helm validation and is rejected only by the Kubernetes API, failing the release or upgrade.

Validate probe overrides against Kubernetes probe-spec structure in the chart schema, including a required handler and supported fields.
</issue_to_address>

### Comment 2
<location path="docs/upgrading.md" line_range="100" />
<code_context>

+**FOCA 0.20:** the app now builds on FOCA 0.20 (see [FOCA's migration
+guide](https://foca.readthedocs.io/en/v0.20.0/migration-0.20/)), whose image has
+no pip. Images derived from the app's image that run `pip install` must use uv
+instead. The app has no gateway plugins, so the plugin store and its secret
+don't apply. The Helm chart is now on foca-common 0.4.0, which checks audiences:
</code_context>
<issue_to_address>
**Derived image builds lack uv**

When a derived-image build uses `uv` without adding the uv binary or mounting it from a separate stage, a downstream Dockerfile that follows this instruction by replacing `pip install` with `uv pip install` fails with `uv: not found`: the final app image contains neither installer, and the note does not say to add or mount uv for the build.

Explain that derived-image builds must source uv separately, for example by mounting it from a pinned uv image in the relevant build step.
</issue_to_address>

### Comment 3
<location path="deployment/templates/_helpers.tpl" line_range="22" />
<code_context>
 valuesKey: cloudRegistry
 maxContentLength: 1048576
-requireAudience: {{ include "cloud-registry.requireAudience" . }}
+requireAudience: true
 mongodb:
   databases: [serviceStore]
</code_context>
<issue_to_address>
**Audience guidance contradicts chart behavior**

When an operator consults the chart's default values comments while configuring audiences per issuer, deployments with an audience on each issuer do not need a global audience, but `deployment/values.yaml` still says they must set `security.auth.audience` unless audience verification is disabled, misleading operators about valid configuration.

Update the audience guidance in `deployment/values.yaml` to mention that every issuer can provide its own audience instead of setting a global one.
</issue_to_address>

Linked issues

#350 Move to FOCA 0.20.0 · 6 of 6 met

# Requirement Status Notes
1 Move Cloud Registry to FOCA 0.20.0 before 1.0.0rc2, following the migration guide. ✅ Met The dependency and base image use FOCA 0.20.0, and the 1.0.0rc2 release notes and upgrade guide document the move.
2 Set foca>=0.20.0,<0.21 in pyproject.toml and update uv.lock. ✅ Met pyproject.toml and the lock contain the requested FOCA constraint and 0.20.0 release.
3 Use the pinned FOCA 0.20.0 base image, install in the final stage with mounted uv, and remove the pip-vendored entries from .trivyignore.yaml. ✅ Met The Dockerfile pins the 0.20.0 image by digest and mounts uv for installation; the ignore file is cleared, and CI checks that the image has no installer.
4 Move the chart to foca-common 0.4.0, apply its relevant new values, and omit pluginStore.existingSecret when the chart does not need to carry it. ✅ Met The chart pins 0.4.0, adds the three app probe values, and excludes pluginStore from its values schema.
5 Update the custom-configuration validation test for a plain ValueError as the cause. ✅ Met test_create_app_service_info_in_custom asserts that the cause is exactly ValueError.
6 Update the upgrade notes, 1.0.0rc2 release notes, and development documentation. ✅ Met All three documents include the FOCA 0.20.0 migration information.

Sourcery assessment

Approval pending. 1 finding to address first, and the security scan did not finish.

Blocking findings: deployment/values.yaml:93


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

Comment thread deployment/values.yaml Resolved
Comment thread docs/upgrading.md Resolved
Comment thread deployment/templates/_helpers.tpl Resolved
@uniqueg
uniqueg merged commit 558a912 into dev Nov 4, 2026
32 checks passed
@uniqueg
uniqueg deleted the build/foca-0.20 branch November 4, 2026 00:44
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.

Move to FOCA 0.20.0

1 participant