Skip to content

build: require FOCA 0.17.0 and foca-common 0.2.0 - #210

Merged
uniqueg merged 5 commits into
devfrom
build/foca-0.17
Oct 23, 2026
Merged

uniqueg merged 5 commits into
devfrom
build/foca-0.17

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves Cloud Registry from the temporary FOCA dev pin (#178) to the releases FOCA 0.17.0 and foca-common 0.2.0, so that scripts/check_release_pins.py passes and 0.3.0 can be tagged.

  • FOCA: foca>=0.17.0,<0.18, and elixircloud/foca:0.17.0-py3.13 as the base image, pinned by digest (sha256:9790ac2c…7291, the multi-arch index). The TEMPORARY comments, the ## FOCA commit: line and Dependabot's ignore of the base image are gone. FOCA 0.17.0 stores a granted role before it removes the subject's other roles (FOCA fix: catch disabled TLS checks in session calls #413/#443), so a failed grant now keeps the old roles. test_failed_grant_keeps_rights covers that now; the old test expected the 0.16 behaviour.
  • Chart: foca-common 0.2.0 from oci://ghcr.io/elixir-cloud-aai/charts, with Chart.lock and charts.sha256 updated. I checked the pulled archive against the chart-v0.2.0 tag: the content is the same, only Chart.yaml is reformatted by Helm and the tests are left out. Following FOCA's docs/migration-0.17.md ("Helm chart 0.2.0"):
    • deployment/values.schema.json is the library's app-values.schema.json, without the worker and broker, with cloudRegistry and with the MongoDB image description. Its $comment names foca-common 0.2.0. The library now allows an empty ingressFrom itself, so the earlier minItems and description change is no longer needed, and test_schema_of_library is simpler.
    • New values cloudRegistry.httpRoute (disabled, no controller-specific parentRefs) and cloudRegistry.route (enabled, annotations), plus the httproute.yaml and httproute-https-redirect.yaml templates. NOTES.txt now covers the HTTPRoute and a disabled Route.
    • mongodb.persistence replaces mongodb.volumeSize. The claim is kept on uninstall (resourcePolicy: keep).
    • The chart no longer sets the ingress-nginx body-size annotation. The app's default limit is 1 MiB, which is also ingress-nginx's default, so the annotation is only needed for higher limits. The README shows it together with config.server.max_content_length.
  • Docs: deployment/README.md gains "Gateway API" and MongoDB "Persistence" sections. The OpenShift Route, Ingress and body-size text is updated. It now links FOCA's guides at chart-v0.2.0 ("Exposing the app", "NetworkPolicy peers", "MongoDB persistence") instead of repeating them; the NetworkPolicy example is shorter. docs/development.md links chart-v0.2.0. docs/upgrading.md and docs/configuration.md are updated, and so are the comments in cloud_registry/config.yaml.
  • Release notes: the TODO(#179) markers in docs/releases/0.3.0.md are resolved: mongodb.persistence and the kept claim, no body-size annotation, and the Gateway API/Route features. The ingress-nginx statements about the size limit are fixed. I rechecked the FOCA 0.17 statements in the intro, "Configuration", "Python" and "New features", and the README "Configuration" section: they still match.

Verification

  • python scripts/check_release_pins.py: exit 0. docs/releases/0.3.0.md has no TODO, and scripts/release_notes.py check passes.
  • helm dependency update deployment, then sha256sum -c charts.sha256: OK.
  • coverage run --source cloud_registry,scripts -m pytest: 1230 passed. Coverage is 100%.
  • pre-commit run --all-files: passed (ruff, mypy, semgrep, ast-grep, gitleaks, actionlint).
  • helm lint deployment --strict -f deployment/ci/test-values.yaml, also with auth disabled: passed.
  • mkdocs build --strict: passed.
  • docker build .: passed. The image build checks that the base image has the required FOCA.
  • CI: all checks passed (tests with mongomock and MongoDB 7.0, static analysis, Helm chart, docs, Docker Compose, image scan, release readiness, CodeQL, Codecov).

Review

Reviewed in two rounds by the adversarial and quality reviewer subagents. Fixed:

  • mongodb.volumeSize: the chart's values set persistence.size, so volumeSize fails to render. The docs said it still works.
  • Kept claim: the claim is kept on mongodb.enabled: false only once a deployed revision has annotated it. The docs now give the kubectl annotate workaround and say that it protects on upgrades only, not on uninstall. They also mention the rollback caveat.
  • Permissions API: the HTTPRoute exposes it, too.
  • Dependabot: the docs now say to add its temporary ignore by hand.
  • Tests and wrapping: added tests for persistence without a claim, for storage classes, for HTTPRoute annotations and filters, and for the redirect without parentRefs; renamed the body-size tests; rewrapped lines.

Sourcery: its three findings are handled by FOCA 0.17.0 and foca-common 0.2.0. A failed role cleanup removes the new rule again, concurrent grants keep the latest role, and a redirect on the app route's listener fails to render. Added tests for the first and the third, and replied in each thread.

Declined review findings

  • Commit trailer model name: the reviewer questioned it, but it is correct as given.

Open questions

None.

Lane: full (Helm chart, dependency pins). The issue's fast-track note is overridden by the coordinator's instruction to use the full lane.

Closes #179

🤖 Generated with Claude Code

uniqueg and others added 4 commits October 23, 2026 21:49
Replace the temporary pin of a FOCA dev commit (#178) with the release:
`foca>=0.17.0,<0.18` and the base image
`elixircloud/foca:0.17.0-py3.13`, pinned by digest. Dependabot no
longer ignores the base image (minor and major updates stay manual).

FOCA 0.17.0 stores a granted role before it removes the subject's
other roles, so a failed grant now keeps them: adapt the test that
simulated the failure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pin the released library chart foca-common 0.2.0 (lock file and
archive digest) and take over its changes, following FOCA's migration
guide ("Helm chart 0.2.0"):

- values schema: the library's new app-values.schema.json, with the
  app's changes in its $comment (which names foca-common 0.2.0, as the
  release pin check requires); ingressFrom may be empty in the library
  itself now
- Gateway API: cloudRegistry.httpRoute (disabled, no parentRefs), with
  the HTTPS redirect route, templates and notes; cloudRegistry.route
  with enabled and annotations
- MongoDB: mongodb.persistence instead of mongodb.volumeSize
  (deprecated), with the claim kept on uninstall
- no ingress-nginx body-size annotation: the app's default limit, 1 MiB,
  is that of ingress-nginx; the docs show the annotation for higher
  limits
- docs: link FOCA's guides at chart-v0.2.0 (Exposing the app,
  NetworkPolicy peers, MongoDB persistence) instead of duplicating them;
  resolve the TODO(#179) markers of the 0.3.0 release notes

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings: `mongodb.volumeSize` fails to render (the
chart's values set `mongodb.persistence.size`), so the docs say to
rename it; the claim is kept on disabling MongoDB only once a deployed
revision has annotated it, with the `kubectl annotate` workaround and
the rollback caveat; the HTTPRoute also exposes the permissions API;
the temporary Dependabot ignore of FOCA pins is added by hand. Add
tests of persistence without a claim, storage classes, HTTPRoute
annotations and filters and the redirect without parentRefs, and
rename the body-size tests after what they check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On uninstall, Helm reads `helm.sh/resource-policy` from the release's
manifests, on upgrades from the cluster, so a hand-made annotation
protects the claim on upgrades only; rewrap paragraphs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR moves Cloud Registry from the temporary FOCA development commit to synchronized FOCA 0.17.0 and foca-common 0.2.0 release pins, then adapts application tests, Helm values/templates/schema, persistence and exposure behavior, documentation, and release notes to the released interfaces.

Flow diagram for Helm application exposure choices

flowchart TD
    Start[Cloud Registry Helm release]
    Ingress[Ingress]
    HTTPRoute[Gateway API HTTPRoute]
    Route[OpenShift Route]
    Service[Cloud Registry Service]
    Start -->|cloudRegistry.ingress.enabled| Ingress
    Start -->|ingress disabled and httpRoute.enabled| HTTPRoute
    Start -->|Ingress and HTTPRoute disabled| Route
    Ingress --> Service
    HTTPRoute --> Service
    Route --> Service
Loading

Flow diagram for MongoDB persistence lifecycle

flowchart TD
    Values[mongodb.persistence]
    PVC[PersistentVolumeClaim]
    MongoDB[MongoDB data]
    Keep[helm.sh/resource-policy: keep]
    Reinstall[Reinstall same release]
    Delete[Manual PVC deletion]
    Values -->|enabled and size| PVC
    PVC --> MongoDB
    Values -->|resourcePolicy: keep| Keep
    Keep -->|survives uninstall or removal from release| PVC
    PVC --> Reinstall
    PVC --> Delete
Loading

File-Level Changes

Change Details Files
Replace temporary FOCA development pinning with released, synchronized Python and container image dependencies.
  • Require FOCA 0.17.x in the Python dependency configuration.
  • Use the FOCA 0.17.0 Python 3.13 base image pinned by digest.
  • Remove temporary pin comments, commit metadata, and Dependabot exceptions.
  • Update access-control failure behavior tests for FOCA 0.17 role replacement semantics.
pyproject.toml
Dockerfile
.github/dependabot.yml
tests/test_access_control.py
Upgrade the Helm library dependency to foca-common 0.2.0 and adopt its chart interfaces.
  • Update Chart.yaml, Chart.lock, and the dependency checksum.
  • Replace the copied values schema with the foca-common 0.2.0 schema adapted for Cloud Registry.
  • Migrate MongoDB storage from volumeSize to configurable persistence, including storage classes, existing claims, emptyDir fallback, and keep policy.
  • Add configurable Gateway API HTTPRoutes, HTTPS redirects, OpenShift Route controls, annotations, and filters.
  • Remove the chart-managed ingress-nginx body-size annotation and add rendering coverage for the new chart behavior.
deployment/Chart.yaml
deployment/Chart.lock
deployment/charts.sha256
deployment/values.schema.json
deployment/values.yaml
deployment/templates/httproute.yaml
deployment/templates/httproute-https-redirect.yaml
deployment/templates/NOTES.txt
tests/test_chart.py
Align operational documentation, migration guidance, and release notes with the new FOCA and chart releases.
  • Document Gateway API exposure, Route configuration, persistence behavior, upgrade hazards, and proxy-specific body-size limits.
  • Link documentation to the foca-common chart-v0.2.0 guides and update development pinning instructions.
  • Resolve the 0.3.0 release-note TODOs and correct statements about persistence, ingress limits, and exposure options.
  • Update configuration comments to describe proxy limits rather than chart-managed ingress-nginx settings.
deployment/README.md
docs/configuration.md
docs/development.md
docs/upgrading.md
docs/releases/0.3.0.md
cloud_registry/config.yaml

Assessment against linked issues

Issue Objective Addressed Explanation
#179 Replace the temporary FOCA development pin with FOCA 0.17.0 and use the matching FOCA base image pinned by digest, removing the temporary comments and Dependabot base-image ignore. ✅
#179 Upgrade the deployment chart to foca-common 0.2.0 and migrate its values, schema, templates, lock/checksum, chart tests, and documentation to the new library-chart version. ✅
#179 Complete the controller-neutral Gateway API/chart changes and update release notes and release-readiness documentation so the 0.3.0 notes have no TODOs and the pin checks pass. ✅

Possibly linked issues


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 Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1290276) to head (d71e2f6).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #210   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines         1185      1185           
=========================================
  Hits          1185      1185           

☔ 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 October 23, 2026 20:32

@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="tests/test_access_control.py" line_range="565" />
<code_context>

     with monkeypatch.context() as patch:
-        patch.setattr(ownership_module, "add_resource_role", fail)
+        patch.setattr(ownership_module, "_replace_resource_role", fail)
         assert grant(client, service_id, BOB, "maintainer") == 500
-    assert permissions(client, service_id) == [(ALICE, "owner")]
</code_context>
<issue_to_address>
**Failed grants leave elevated access**

When the new role is stored but removing the subject’s previous roles fails, fOCA’s `grant_role` stores the requested role before removing the subject’s other roles, so an exception during cleanup leaves both roles persisted. A request to promote a maintainer to owner can therefore return 500 while the subject has owner access.

Make the role replacement atomic or roll back the newly stored role when cleanup fails, and test an exception after the new role is persisted.
</issue_to_address>

### Comment 2
<location path="pyproject.toml" line_range="110" />
<code_context>
-    # of FOCA 0.17 (#178); replaced by the release (#179) before the next
-    # release, which `scripts/check_release_pins.py` enforces
-    "foca @ git+https://github.com/elixir-cloud-aai/foca@db6998cae4e1f1fbbbaafd7a26795f3bbfa4511a",
+    "foca>=0.17.0,<0.18",
     "gunicorn>=26.2.0,<27",
 ]
</code_context>
<issue_to_address>
**Concurrent grants erase permissions**

When two requests concurrently change roles for the same subject on the same service, the two `grant_role` calls can each store a new role, then remove the other call’s role; both requests return success while the subject has no role on the service.

Make role replacement atomic or serialize replacements per subject and resource, and test concurrent grants.
</issue_to_address>

### Comment 3
<location path="deployment/values.yaml" line_range="124" />
<code_context>
+    # required if enabled, e.g., the HTTPS listener of a shared Gateway:
+    # `[{name: gateway, namespace: gateway-system, sectionName: https}]`.
+    # The Gateway's listener must allow routes from the release's namespace
+    parentRefs: []
+    # Filters of the route's rule (`HTTPRouteFilter`s), e.g., an
+    # `ExtensionRef` to a resource of the Gateway implementation that limits
</code_context>
<issue_to_address>
**HTTPS requests enter redirect loop**

When `httpRoute.httpsRedirect.enabled` is true and its `parentRefs` name the same Gateway listener as `httpRoute.parentRefs`, the chart renders the app route and redirect route on the same Gateway listener, so HTTPS requests match a route that redirects them back to HTTPS (or conflict with the app route), and callers cannot reliably reach the app.

Validate that the redirect and app routes cannot target the same listener, or fail rendering with an explicit error.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 3 findings to address first, and with the default resourcePolicy: keep, uninstalling a release leaves MongoDB’s PVC and its data behind; reverting the chart does not remove that retained data, which must be deleted manually. FOCA 0.17 also leaves a user’s existing role in place when replacing it fails, so a failed role change can preserve stronger access than intended.

Blocking findings: tests/test_access_control.py:565, pyproject.toml:110, deployment/values.yaml:124


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

Comment thread tests/test_access_control.py Resolved
Comment thread pyproject.toml Resolved
Comment thread deployment/values.yaml Resolved
Address Sourcery's review: a grant whose removal of the other roles
fails leaves the previous role only (FOCA's adapter removes the new
rule again), and rendering fails if the HTTPS redirect may attach to
the app route's listener.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit d47e1ab into dev Oct 23, 2026
19 checks passed
@uniqueg
uniqueg deleted the build/foca-0.17 branch October 23, 2026 20:43
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: require FOCA 0.17.0 and foca-common 0.2.0

1 participant