Repository navigation
build: require FOCA 0.17.0 and foca-common 0.2.0 - #210
Conversation
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]>
Reviewer's GuideThe 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 choicesflowchart 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
Flow diagram for MongoDB persistence lifecycleflowchart 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
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 #210 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 1185 1185
=========================================
Hits 1185 1185 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
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]>
Summary
Moves Cloud Registry from the temporary FOCA
devpin (#178) to the releases FOCA 0.17.0 andfoca-common0.2.0, so thatscripts/check_release_pins.pypasses and 0.3.0 can be tagged.foca>=0.17.0,<0.18, andelixircloud/foca:0.17.0-py3.13as 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_rightscovers that now; the old test expected the 0.16 behaviour.foca-common0.2.0 fromoci://ghcr.io/elixir-cloud-aai/charts, withChart.lockandcharts.sha256updated. I checked the pulled archive against thechart-v0.2.0tag: the content is the same, onlyChart.yamlis reformatted by Helm and the tests are left out. Following FOCA'sdocs/migration-0.17.md("Helm chart 0.2.0"):deployment/values.schema.jsonis the library'sapp-values.schema.json, without the worker and broker, withcloudRegistryand with the MongoDB image description. Its$commentnamesfoca-common 0.2.0. The library now allows an emptyingressFromitself, so the earlierminItemsand description change is no longer needed, andtest_schema_of_libraryis simpler.cloudRegistry.httpRoute(disabled, no controller-specificparentRefs) andcloudRegistry.route(enabled,annotations), plus thehttproute.yamlandhttproute-https-redirect.yamltemplates.NOTES.txtnow covers the HTTPRoute and a disabled Route.mongodb.persistencereplacesmongodb.volumeSize. The claim is kept on uninstall (resourcePolicy: keep).config.server.max_content_length.deployment/README.mdgains "Gateway API" and MongoDB "Persistence" sections. The OpenShift Route, Ingress and body-size text is updated. It now links FOCA's guides atchart-v0.2.0("Exposing the app", "NetworkPolicy peers", "MongoDB persistence") instead of repeating them; the NetworkPolicy example is shorter.docs/development.mdlinkschart-v0.2.0.docs/upgrading.mdanddocs/configuration.mdare updated, and so are the comments incloud_registry/config.yaml.TODO(#179)markers indocs/releases/0.3.0.mdare resolved:mongodb.persistenceand 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.mdhas noTODO, andscripts/release_notes.py checkpasses.helm dependency update deployment, thensha256sum -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.Review
Reviewed in two rounds by the adversarial and quality reviewer subagents. Fixed:
mongodb.volumeSize: the chart's values setpersistence.size, sovolumeSizefails to render. The docs said it still works.mongodb.enabled: falseonly once a deployed revision has annotated it. The docs now give thekubectl annotateworkaround and say that it protects on upgrades only, not on uninstall. They also mention the rollback caveat.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
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