Repository navigation
feat(cloud-registry): verifications - #578
Conversation
Add provider methods and types for the verification endpoints of
Cloud Registry 0.4.0 and later (GET /verifications, GET, PUT and
DELETE /services/{id}/verification), optional in the interface so
that custom providers still conform, and helpers that tell whether a
verification still matches its service, as the registry compares
them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add ecc-client-elixir-cloud-registry-service-verification: a badge for verified services, and "Verify" and "Remove verification" for admins. It sends the URL and API type of the service shown as the ones checked, takes a verification the app has loaded already (e.g. for a list, from getVerifications()), reacts to a provider set after the first update, and fires change and failure events with the status and conflict code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add code to CloudRegistryError, so that apps and the verification component read the conflict code of a 409 without digging into the problem. Test the component's busy state, races and failures of verify and remove, and link it from the package introduction. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A reload while a verify or remove ran (e.g. a new provider after a token refresh) dropped the result: no change event, the old state shown, and the button enabled again. Track loads apart from verify and remove, always report a result the registry has applied, and show it until the app sets verification again. Fold capital sharp s and dotless i as Python does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Track running verify and remove requests by service ID, so that one for a previous service doesn't block the service shown, and show a result (also one kept over the app's verification) only while the component shows the same service of the same registry (base URL). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideData structuresDefine the verification payload types and expose the conflict code on the public registry error.
APIExtend the provider contract and package exports with verification operations, types, and matching helpers.
Expose the verification component events and add the services-list row-badge renderer property.
ImplementationImplement the REST verification endpoints and exact-match helpers used to determine which services remain verified.
UIAdd the presentational verification badge and admin actions component, including their element registrations and styles.
Render row badges in the services list beside the version badge.
ConfigurationRecord the minor releases for the Cloud Registry verification feature and service-list row-badge hook.
DocumentationDocument the verification badge and admin actions, provider methods and types, and their integration with the services list.
Link the new verification components from the Cloud Registry introduction and update the component navigation metadata.
TestsTest the verification badge, admin actions, provider endpoints and matching helpers, plus services-list row-badge rendering.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
51 files changed ·
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #578 +/- ##
==========================================
+ Coverage 74.40% 75.53% +1.12%
==========================================
Files 63 68 +5
Lines 16815 17576 +761
Branches 925 1016 +91
==========================================
+ Hits 12512 13276 +764
+ Misses 4287 4283 -4
- Partials 16 17 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit e6b0ed6 #459 feat(cloud-registry): verifications · 3 of 3 met
|
There was a problem hiding this comment.
Hey - I've found 8 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="301" />
<code_context>
+ this.own = { id, verification, provider };
+ }
+ }
+ this.changed(id, verification);
+ }
+
</code_context>
<issue_to_address>
**Old registry results corrupt new registry state**
When a mutation is pending while the app switches registries with an overlapping service ID, and the old response arrives afterward, `changed()` emits only the service ID and verification, so a list handler cannot distinguish the old registry’s result from the new registry’s. It can store or delete verification state in the new registry’s map, leaving the list with incorrect verification state.
Include registry identity in the event detail and have list handlers apply results only to the matching registry.
Also at `packages/ecc-client-elixir-cloud-registry/src/events/ecc-service-verification-changed.ts:5-7`, `packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:386`.
</issue_to_address>
### Comment 2
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="224-229" />
<code_context>
+ this.loadRequest += 1;
+ const request = this.loadRequest;
+ const id = this.targetId;
+ if (this.verification !== undefined) {
+ const { own } = this;
+ this.current =
+ own && this.showsSame(own.id, own.provider)
+ ? own.verification
+ : this.verification;
+ return;
+ }
</code_context>
<issue_to_address>
**Old registry badge appears on new registry**
When the provider changes to a different registry while `verification` still contains a value loaded from the previous registry, `load()` treats any defined `verification` as authoritative without associating it with a registry. If the provider switches from registry A to registry B before the app replaces that property, the component skips B's GET and shows A's matching verification as B's, so users see a false Verified badge.
Scope supplied verifications to their registry and discard or reload them when the component switches to a different registry.
</issue_to_address>
### Comment 3
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="186" />
<code_context>
+ changedProperties.has("baseUrl") ||
+ changedProperties.has("serviceId") ||
+ changedProperties.has("verification") ||
+ (changedProperties.has("service") && previous?.id !== this.service?.id)
+ ) {
+ this.load();
</code_context>
<issue_to_address>
**Stale verification reappears as verified**
When the service’s URL or API type changes and later returns to its previously verified values without changing its ID, `updated()` skips `load()` when the service changes but keeps the same ID, leaving `current` unchanged. When the service returns to its old values, `matchesVerification()` matches that stale result and the component shows “Verified” even though the registry removed the verification.
Reload or clear `current` whenever the service changes, including changes to its URL or API type.
Also at `packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:227-229`.
</issue_to_address>
### Comment 4
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="340" />
<code_context>
+ this.applied(id, verification, provider);
+ } catch (err) {
+ this.setPending(id, false);
+ this.fail(failureDetail(id, "verify", err, "Failed to verify service"));
+ if (
+ statusOf(err) === 409 &&
</code_context>
<issue_to_address>
**Mutation failures leave stale state**
When a verify or remove is applied by the registry but the client receives a timeout, connection failure, or error response, `verifyService()` and `removeVerification()` treat every non-conflict/non-404 rejection as a failed mutation without reconciling state. If the registry applied the change but the response was lost or errored, the component and any event-driven app map keep showing the old verification state.
Reconcile the verification after ambiguous mutation failures, while still reporting the failed request.
Also at `packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:373`.
</issue_to_address>
### Comment 5
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="301" />
<code_context>
+ this.own = { id, verification, provider };
+ }
+ }
+ this.changed(id, verification);
+ }
+
</code_context>
<issue_to_address>
**Older mutation overwrites newer state**
When separate component instances or tabs mutate the same service and responses arrive in a different order from the registry’s applied changes, `applied()` emits each mutation result as it arrives, with no ordering or version check. If two instances mutate the same service and the registry applies PUT then DELETE but the responses arrive in reverse order, an event-driven consumer can apply the old PUT result last and show the service as verified when it is not.
Reconcile state after mutation events or include and compare a server ordering/version value before applying results.
</issue_to_address>
### Comment 6
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="298-299" />
<code_context>
+ this.loadRequest += 1;
+ this.current = verification;
+ if (this.verification !== undefined) {
+ this.own = { id, verification, provider };
+ }
+ }
+ this.changed(id, verification);
</code_context>
<issue_to_address>
**Successful mutation result disappears**
When a verify or remove succeeds with `verification` undefined, then the provider is replaced for the same registry, `applied()` does not save the result in `own`, and `load()` clears `current` before refetching. A 404, failed, or stale refetch then hides the result of the successful mutation.
Save successful mutation results in `own` even when `verification` is undefined, so `load()` can reuse them after a provider change.
</issue_to_address>
### Comment 7
<location path="packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts" line_range="163" />
<code_context>
+
+ /** Whether a verify or remove of the service shown is running. */
+ private get busy(): boolean {
+ return this.pending.has(this.targetId);
+ }
+
</code_context>
<issue_to_address>
**Old registry request disables new actions**
When a request is pending while the provider switches to another registry with the same service ID, `pending` and `busy` use only the service ID, so the old registry’s request keeps Verify or Remove disabled for the new registry until it settles. A hung request leaves the new registry’s actions disabled indefinitely.
Key pending work by both registry and service ID, and have `busy` check the current registry’s key.
Also at `packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:164`, `packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:277-280`.
</issue_to_address>
### Comment 8
<location path="apps/documentation/pages/docs/cloud-registry/components/service-verification.mdx" line_range="120" />
<code_context>
+After a verify or remove, the component shows the result for that service until the app sets `verification` again, also if the provider is replaced meanwhile by one for the same registry (the same base URL, e.g. with a new token); update your verifications from `ecc-service-verification-changed`, as above. Pass a stable value (e.g. the object from the map, not one built on each render): every new value counts as set again.
+
+<Callout type='info'>
+ The services list of the GA4GH Service Registry package (`ecc-client-ga4gh-service-registry-services`) doesn't show verifications itself; place the component in a row's `actions-<id>` slot or in your own list.
+</Callout>
+
</code_context>
<issue_to_address>
**Badge missing from list**
The issue asks for a verified badge in the services list, but this change adds only a standalone component and says the list does not show verifications itself. Apps must wire the component into a row manually, so the list requirement remains partly met.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 8 findings to address first, and an admin can create a persistent verification record that the component displays as a badge, so a wrong verification could mislead users even after this code is reverted. The record is bounded and can be removed through the registry, but reverting the component alone does not remove it.
Blocking findings: packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:301, packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:229, packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:186, packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:340, packages/ecc-client-elixir-cloud-registry/src/components/service-verification/service-verification.ts:301, and 3 more
Address automated review: load the verification again when the URL or API type of the service changes and after a verify or remove fails without a clear outcome (no status or a server error), and key running requests by registry and service, so that a request to one registry doesn't block another. Co-Authored-By: Claude Opus 5.5 <[email protected]>
anuragxxd
left a comment
There was a problem hiding this comment.
Thanks! Two changes, please:
- Placement: the Verified / Not verified tag should sit with the version tag in the name line, so a row's tags stay in one place; in the actions column it reads as an action and splits the row's tags. Could the component expose the tag and the admin actions (Verify / Remove) separately, so apps can place them apart? The SR list would then need a hook next to the version tag (e.g.
rowBadges, likerowActions); #581 can use it. - Matching: the registry returns each verification with the URL and type read from the service itself (
verification.py), and removes it when either changes. SoverifiedServices()can compare exactly, and thestrip()/casefold()copy can go. Please also drop "(or form values)" inproviders.mdx.
The registry stores each verification with the URL and API type read from the service itself and removes it when either changes, so the client compares them exactly. Drops the strip()/casefold() emulation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The services list renders badges of each row from rowBadges in the name line, next to the version badge, so that apps can add tags such as "Verified" where the row's other tags are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The display property of the verification component shows the badge and admin actions together (all, the default), only the badge, or only the actions, so that lists can put the badge next to the version and keep Verify and Remove in the actions column. Adds the changeset for the verifications and moves the docs to the next release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes: document that split instances need the app's verification, with an example for the SR list's rowBadges and rowActions hooks (incl. its own View Details button); that rowBadges content is part of the clickable row; and how the registry serves and removes verifications. Adds tests for the default and reflected display, two instances of one row, and rowBadges strings, nodes and clicks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round-2 review fixes: the Lit example defines its map and change handler, the docs name every case in which the registry removes a verification, and the display tests check the actions disappear and that non-admins see nothing also for verified services. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the review! Both points are done: Placement
Matching
Also
CI is green on 9c594e3 (Lint, Test on Node 22 and 24, CodeQL, Codecov, Read the Docs preview, Sourcery). Both reviewer agents ran two rounds; their fixes are in the docs and tests. One open point for you: I chose the name #581 builds on this branch and has been updated too. |
anuragxxd
left a comment
There was a problem hiding this comment.
Thanks, exact matching and rowBadges look good. On display: I'd prefer two elements: a presentational …-service-verification-badge (takes verification, no provider or loading) plus the existing one for the actions. With display, split use without a list loads twice per row, and the badge doesn't update after Verify unless the parent passes verification.
Replace the `display` property with two elements, as asked in review: - `ecc-client-elixir-cloud-registry-service-verification-badge` is presentational: it shows "Verified" (with the date as tooltip) for the `verification` that the app passes, and "Not verified" with `show-unverified`. It has no provider and sends no requests. - `ecc-client-elixir-cloud-registry-service-verification` now offers only the admin actions (Verify / Remove verification). For other users it shows nothing and no longer loads the verification. Exact matching and the SR list's `rowBadges` hook are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add a page for the badge element, and update the verification page, the services list's `rowBadges` section, the package introduction, the providers page and the changeset for the split into badge and actions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check that the actions hide when `admin` turns off, that a load answering after that is dropped, and that the actions element renders no badge of its own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wrap the list example in a component, treat only 404 as not verified, drop late answers for a previous service, add attribute names to the properties table, and say that the badge does not match services. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks! Done:
So a row loads nothing of its own: the app passes the same Tests: new badge tests (tooltip, no requests, Both reviewer agents found no high findings; their medium findings were in the docs examples and are fixed. CI is green on f243573. #581 is updated to use the two elements. |
The services list renders the new badge element through `rowBadges` and the verification element, now actions only, in the actions column, as #578 splits them. Adds a test that clicks Verify in the actions and checks that the badge updates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
anuragxxd
left a comment
There was a problem hiding this comment.
Thanks, the two elements look good. LGTM.
Brings in #578 (squash-merged as 6114b9c). The branch already held #578's commits up to f243573; its final head only added a merge of dev. Conflicts were resolved by merging #578's final head (merge base f243573, no conflicts), which gives the same tree as dev for all #578 files, with #581's changes on top. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Apps can show and manage Cloud Registry verifications (cloud-registry 0.4.0 and later) without their own copy of the provider.
Provider (
@elixir-cloud/cloud-registry/providers)getVerifications(),getServiceVerification(id),verifyService(id, verification?)anddeleteServiceVerification(id)forGET /verificationsandGET/PUT/DELETE /services/{id}/verification, matching the registry's OpenAPI (additions.openapi.yaml). They are optional inCloudRegistryProvider, so custom providers without them still conform.Verification,ServiceVerificationandVerificationRegister.matchesVerification()andverifiedServices(): a verification only counts while the service still has the verified URL (as written) and API type (group and artifact), compared exactly: the registry serves each verification with the service's current values and removes it when they change (review by anuragxxd).CloudRegistryError.code: the problemcodeof a conflict, e.g.verification-mismatchorpending-service.Components (split into two elements after review by anuragxxd)
ecc-client-elixir-cloud-registry-service-verification-badge: presentational. Shows "Verified" (the tooltip gives the date) for theverificationthat the app passes, and "Not verified" withshow-unverified(e.g. for admins); nothing otherwise. No provider, no requests.ecc-client-elixir-cloud-registry-service-verification: the admin actions. Admins see "Verify" or "Remove verification"; other users see nothing, and the component sends no requests for them. "Verify" sends the URL and API type ofserviceas the checked values, so a service that changed in the meantime isn't verified (409).verificationproperty for lists: the app loads all verifications with one request and passes each row's verification (to the badge and the actions), so the rows make no requests of their own. Without it, the element loads the verification itself (admins only).providerorbaseUrlset after the first update, the behaviour fix: react to provider set after the first update #565 asks for in other components. It ignores stale answers, tracks running verify and remove requests per service, and still reports a result that arrives after a reload, but shows it only for the same service of the same registry.ecc-service-verification-changedandecc-service-verification-failed. The failure event carries the action, status, problem details and conflict code, the same way the service-create events carry them. Apps update the badge'sverificationfrom the changed event.Docs: a page for each component, a Verifications section and types in the providers page, the
codeproperty in the Errors table, and a link in the package introduction.Placement (review by anuragxxd):
rowBadgeshook in the SR services list (ecc-client-ga4gh-service-registry-services), named as suggested: it renders badges in the name line, next to the version badge. feat(cloud-registry): verified badge in list #581 uses it. Badges are part of the clickable row (documented).Closes #459
Verification
All commands were run in
packages/ecc-client-elixir-cloud-registryunless noted.npm run test -- --coverage: 95 tests passed in Chromium and Firefox. WebKit can't run on this machine: Playwright doesn't support its OS (Ubuntu 26.04), so CI covers WebKit. Line coverage of the new code:verifications.ts100%,service-verification.ts450/454.npm run build: passes, and generates the component, its React wrapper and the custom elements manifest.npm run lintat the repo root (husky pre-commit, all packages): 0 errors.npx tsc -p tsconfig.prod.json: no errors.npm run buildinapps/documentation: passes, and the new page renders as/docs/cloud-registry/components/service-verification.npx cspellon the cloud-registry docs pages: 0 issues.adversarial-reviewerandquality-reviewer, in two rounds. Fixed in round 1:verificationcame back after a reload;codewas missing onCloudRegistryError;verification). It also adds tests for removing a verification of a previous service, and docs notes on reloading and on passing stable values.verification, the badge in the services list). CI was green again after the fixes.Review round for anuragxxd's changes
dev(2.0.0-alpha.51) into the branch; the docs version is now2.0.0-alpha.52.verifications.test.ts),displaymodes incl. default, reflection, two instances in one row (service-verification.test.ts),rowBadgestemplates, strings, nodes, re-rendering and row clicks (SRservices.test.ts).tsc -p tsconfig.prod.jsonclean in both packages, rootnpm run lint(incl. the docs build) passes, package builds pass.adversarial-reviewerandquality-reviewer, two rounds. Fixed: docs for split instances (they need the app'sverification) with a Lit example forrowBadgesandrowActionsincl. a View Details button; thatrowBadgescontent selects the row; precise wording of when the registry removes a verification (checked against cloud-registry'sservice.py); moredisplayandrowBadgestests.Review round 2 by anuragxxd (two elements instead of
display)displayis gone; the badge is a new presentational element, and the existing element offers only the actions (admins). Exact matching androwBadgesare unchanged.show-unverified, updates); the actions tests now assert the buttons, and new tests cover non-admins (nothing shown, no request),adminturned on and off, a load answering afteradminturned off, and a badge plus actions pair updated by the app from the changed event.tsc -p tsconfig.prod.jsonclean; rootnpm run lint(incl. the docs build, which renders the new page) passes; the build generates the React wrapperreact/service-verification-badge.adversarial-reviewerandquality-reviewer: no high findings. Fixed: the React list example is now a valid component; the examples treat only404as not verified and drop late answers; the properties table has an attribute column; the badge page says that the badge doesn't match services; tests foradmintoggles and that the actions render no badge.Declined review findings
Trailing newline added to
tailwind.css(quality, low, round 2). Prettier's formatting; harmless.Duplicated
failureDetail(quality, medium). It is similar to the one in service-create. Sharing it means refactoring service-create, which is outside this issue, and other open work touches the package's components. A shared helper inproviders/errors.tswould fit a follow-up.Use
trim().toLowerCase()instead of emulatingcasefold()(quality, low). The client should agree with the registry, which compares withstrip().casefold(), and the Cloud Registry UI already uses this approach. The reviewer's brute-force check found only the two exceptions that this PR now handles.Docs version
2.0.0-alpha.51(quality, low). This is the next release, the first one that contains the component. Other pages give the version that introduced their component.Test for a load that is still running when a verify or remove finishes (quality, round 2). The UI can't reach this: while a load runs, the component renders no buttons. The
loadRequestbump inapplied()stays as a safeguard, with a comment.Docs version
2.0.0-alpha.52(quality, low). The next release after the published alpha.51.A case-only rename of the API type keeps the verification on the registry (adversarial, low). The registry then serves it with the new spelling, so a services list and a verifications list loaded together still match exactly; only lists loaded at different times can disagree, which the docs say.
Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Enable Cloud Registry service verification management and status display across provider APIs and service registry components.
New Features:
Enhancements:
Documentation:
Tests: