Repository navigation
Conversation
Add ecc-client-ga4gh-service-registry-service-types, which lists the service types of a registry (GET /services/types) through the provider's getServiceTypes(), with loading, empty and error states. It follows the provider lifecycle of the other components (provider set or replaced after the first update, only the latest load applies) and fires ecc-service-types-changed with the loaded types. Add its documentation page, live preview, demo page and changeset. Closes #452 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Test that clearing the base URL of the service types list clears the types, fires ecc-service-types-changed with none and asks for a provider. Correct the docs, which said that removing the provider loads the types again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Show an error, instead of breaking the table, when the registry sends valid JSON for /services/types that is not a list. Check in the base URL test that the types of the new URL are shown, not only fetched. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add ecc-client-ga4gh-service-registry-service-info, which shows the registry's own service info (GET /service-info) through the provider's getServiceInfo(), with loading and error states. Optional fields show only if set: links only for web URLs (and mailto: for the contact), timestamps only if valid, so a fresh cloud-registry 0.4.0 deployment without timestamps shows no invalid values or dead links. It follows the provider lifecycle of the other components and fires ecc-service-info-changed. Add its documentation page, live preview, demo page and changeset. Closes #451 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Show an error, instead of placeholders or empty values, when the registry sends valid JSON for /service-info that is not an object (e.g. null, a list or a string), as the service types list does for data that is not a list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Show only fields of the service info that are strings with text, so that a registry that doesn't follow the specification (missing type parts, blank or non-string values, an empty ID) shows no "undefined", empty rows or broken renders. The type badge needs an artifact, the heading falls back to "Service Registry". Test the fallback to the base URL once the provider is removed, and drop assertions that only checked the test fixture. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Leave out a contact URL like "mailto:" or "mailto:?subject=x", which would render a link without an address, and document the fallbacks of the heading and the type badge. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAPIExpose the service-info custom element and its typed change event, and register the element for package consumers.
ImplementationImplement provider selection, loading and stale-request handling, service-info validation, event dispatch, safe optional-field rendering, and loading and error states.
Register the new service-info component in the package-wide component entry point.
UIAdd the service-info demo page and link it from the package demo index.
Add the documentation live-preview component for the service-info view.
ConfigurationRecord the package minor release and feature in a changeset.
DocumentationDocument service-info usage, properties, events, optional-field behavior, and provider integration, and link the component from the registry overview and provider guide.
TestsAdd coverage for service-info rendering, validation, provider lifecycle, loading and errors, and emitted events.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Documentation build overview
55 files changed ·
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #597 +/- ##
==========================================
+ Coverage 78.32% 78.79% +0.46%
==========================================
Files 78 80 +2
Lines 19928 20332 +404
Branches 1352 1412 +60
==========================================
+ Hits 15609 16021 +412
+ Misses 4298 4291 -7
+ Partials 21 20 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit 8573641 #451 feat(service-registry): add service-info component · 4 of 4 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-ga4gh-service-registry/src/components/service-types/service-types.ts" line_range="123" />
<code_context>
+ const serviceTypes = await provider.getServiceTypes();
+ if (stale()) return;
+ // valid JSON of another shape would break the table
+ if (!Array.isArray(serviceTypes)) {
+ throw new Error("Invalid service types: the registry sent no list");
+ }
</code_context>
<issue_to_address>
**Malformed types break the list**
When the registry returns an array containing `null` or an entry with a missing or non-string `group`, `loadData()` accepts and emits the malformed array, then `renderRows()` passes entries to `renderRow()`, which reads `type.group` and calls `.includes()` through `getGroupVariant()`; rendering throws and the types view breaks instead of showing an error.
Validate every entry and its `group` before assigning or dispatching the array, and report invalid data through the error state.
Also at `packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:185-191`, `packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:223`.
</issue_to_address>
### Comment 2
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="147" />
<code_context>
+ const load = this.dataLoads;
+ // a load from a provider that was replaced in the meantime, or that a
+ // newer load replaced, is dropped
+ const stale = () => provider !== this._provider || load !== this.dataLoads;
+
+ this.loading = true;
</code_context>
<issue_to_address>
**Old registry data is applied**
When an old request’s continuation is queued before the caller changes the provider or base URL and Lit processes the update, `stale()` checks `_provider`, which still reflects the old configuration until the scheduled update runs, so the old request commits its service info and emits it; consumers briefly receive data from the old registry.
Make staleness checks compare against the current provider and base URL, or synchronously invalidate pending loads when either input changes.
Also at `packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:114`, `packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:97-100`.
</issue_to_address>
### Comment 3
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="152" />
<code_context>
+ */
+const linkable = (url: unknown, protocols: string[]): string | null => {
+ if (typeof url !== "string" || !url) return null;
+ try {
+ const { protocol, pathname } = new URL(url);
+ if (protocol === "mailto:" && !pathname.trim()) return null;
</code_context>
<issue_to_address>
**Requests can leave loading stuck**
When the provider request never settles, `loadData()` awaits the provider promise without a deadline, so a request that never settles leaves the component showing loading placeholders indefinitely and never emits an error or completion event.
Apply a configurable request deadline and treat its expiry as a load failure.
Also at `packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:119`.
</issue_to_address>
### Comment 4
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="46" />
<code_context>
+/** A timestamp in the reader's locale, or `null` if it isn't a valid date. */
+const formatDate = (value: unknown): string | null => {
+ if (!text(value)) return null;
+ const date = new Date(value as string);
+ return Number.isNaN(date.getTime()) ? null : date.toLocaleString();
+};
</code_context>
<issue_to_address>
**Invalid timestamps become dates**
When the registry supplies an impossible calendar date or a non-RFC3339 string that JavaScript’s parser accepts, `formatDate()` relies on `new Date()` and checks only for `NaN`, so normalized or legacy-parsed values pass and the component displays a fabricated date instead of omitting the timestamp.
Validate the timestamp format and calendar date before formatting it.
Also at `packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:47`.
</issue_to_address>
### Comment 5
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="265" />
<code_context>
+ contactUrl
+ ? ECCClientGa4ghServiceRegistryServiceInfo.renderLink(
+ contactUrl,
+ contactUrl.replace(/^mailto:/, "")
+ )
+ : null
</code_context>
<issue_to_address>
**Mailto labels include URL options**
When a valid mailto contact URL has query parameters or an uppercase scheme, `renderServiceInfo()` removes only the lowercase `mailto:` prefix, so the Contact label retains query parameters or the uppercase scheme and users see URL text instead of just the email address.
Parse the mailto URL and render only its recipient address, regardless of scheme casing.
</issue_to_address>
### Comment 6
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="27" />
<code_context>
+ try {
+ const { protocol, pathname } = new URL(url);
+ if (protocol === "mailto:" && !pathname.trim()) return null;
+ return protocols.includes(protocol) ? url : null;
+ } catch {
+ return null;
</code_context>
<issue_to_address>
**Invalid mailto recipients become links**
When A registry supplies a `mailto:` contact with a nonempty path that is not a valid address, `linkable` treats any nonempty `mailto:` path as an address, so values such as `mailto:invalid` render as clickable contacts even though they contain no valid recipient address; users get a broken contact link.
Validate the parsed mailto recipient as an address before rendering the link.
</issue_to_address>
### Comment 7
<location path="apps/documentation/pages/docs/service-registry/components/service-info.mdx" line_range="94" />
<code_context>
+---
+"@elixir-cloud/service-registry": minor
+---
</code_context>
<issue_to_address>
**Provider fallback is misdocumented**
When a caller supplies both a custom provider and a base URL, then removes the custom provider, the docs say removing a provider clears the data and shows an error, but `useProvider()` switches to the configured `baseUrl` when the custom provider is removed; callers see data reload from that URL instead.
Clarify that removing a custom provider falls back to the configured base URL, and that data is cleared with an error only when neither source remains.
Also at `apps/documentation/pages/docs/service-registry/components/service-types.mdx:84`.
</issue_to_address>
### Comment 8
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/tests/service-info.test.ts" line_range="198-200" />
<code_context>
+ );
+ await waitUntil(() => fields(el).length > 0);
+
+ expect(field(el, "type")?.textContent?.trim()).to.contain(
+ "service-registry · 1.0.0"
+ );
+ expect(el.shadowRoot?.textContent).not.to.contain("undefined");
+ });
</code_context>
<issue_to_address>
**Extra type parts pass test**
When the renderer adds a type part that is absent from the response, the `shows only the parts of a type that are set` test uses `contain` for the expected value, so it still passes if the rendered type includes an invented group alongside the artifact and version.
Assert that the trimmed type-row text equals `service-registry · 1.0.0`.
</issue_to_address>Sourcery assessment
Approval pending. 7 findings to address first.
Blocking findings: packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:123, packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:147, packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:152, packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:46, packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:265, and 2 more
A list with null or a type without string group, artifact and version broke the table render (getGroupVariant called includes on undefined). Such a response now shows an error, like a response that is no list. The docs say so, and that removing a custom provider falls back to the base URL; only removing both clears the types and shows the error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A mailto: contact becomes a link only if all its recipients are email addresses, and its label shows only the decoded recipients (no MAILTO: scheme in other casing, no ?subject= options). - createdAt and updatedAt show only for RFC 3339 date-times of a real calendar date; the browsers' lenient parsing turned 30 February or "January 2, 2026" into dates before. - The type row test asserts the exact text, so an invented part fails. - The docs describe both rules and the fallback to the base URL when the custom provider is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-ups for the service info links and dates: - toLink() validates a URL and returns its target and label in one place, instead of parsing mailto: URLs twice. - mailto: recipients with control, format or other invisible characters (NUL, zero-width space, bidi overrides) are rejected, so the label shows the address the link goes to; the label joins the trimmed recipients. - The timestamp tests compare with fixed instants, cover non-leap 29 February (2025, 1900) and updatedAt, and the docs say which RFC 3339 deviations are tolerated and that recipients must be in the path, not only in ?to=. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The error for a malformed type says the parts must be strings, as a numeric artifact is present but wrong; the docs say so too, and the tests check the full message with a typed case table. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The address check rejects control and format characters, not every invisible one; the docs say so and name ?bcc= among the hidden options. Timestamp test titles quote their value, so the string and the number case differ. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="220" />
<code_context>
+ // the app drops the data of the previous provider too
+ this.dispatchChanged(null);
+ this.error =
+ err instanceof Error ? err.message : "Failed to load service info";
+ console.error({
+ error: this.error,
</code_context>
<issue_to_address>
**Empty errors leave components in the wrong state**
When a provider rejects with an `Error` whose message is empty, `loadData()` stores an empty error string, so `render()` treats it as no error: the service-info component keeps showing its loading placeholder while the service-types component shows an empty state. Callers see neither component’s failure state.
Store a nonempty fallback message when the caught error’s message is empty.
Also at `packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:147`, `packages/ecc-client-ga4gh-service-registry/src/components/service-types/service-types.ts:241`, `packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:410`.
</issue_to_address>
### Comment 2
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="44-47" />
<code_context>
+ const { protocol, pathname } = new URL(url);
+ if (!protocols.includes(protocol)) return null;
+ if (protocol !== "mailto:") return { href: url, label: url };
+ const recipients = decodeURIComponent(pathname)
+ .split(",")
+ .map((address) => address.trim());
+ const valid = recipients.every((address) => ADDRESS.test(address));
+ return valid ? { href: url, label: recipients.join(", ") } : null;
+ } catch {
</code_context>
<issue_to_address>
**Hidden contact characters bypass validation**
When a `mailto:` path recipient has a leading or trailing character removed by `trim()`, such as an encoded line feed, `trim()` removes leading or trailing control/format whitespace before `ADDRESS.test`, so a `mailto:` recipient containing such characters passes validation while the original URL retains them and the displayed label hides them. The contact link therefore does not meet the documented validation guarantee.
Reject control and format characters in each decoded recipient before trimming, or trim only explicitly allowed ordinary whitespace and validate the original recipient for those characters.
</issue_to_address>
### Comment 3
<location path="packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts" line_range="47" />
<code_context>
+ const recipients = decodeURIComponent(pathname)
+ .split(",")
+ .map((address) => address.trim());
+ const valid = recipients.every((address) => ADDRESS.test(address));
+ return valid ? { href: url, label: recipients.join(", ") } : null;
+ } catch {
</code_context>
<issue_to_address>
**Malformed mail recipients become links**
When a registry returns a `mailto:` contact whose recipient has invalid email syntax, such as consecutive dots in its local part, `ADDRESS` only excludes whitespace, `@` and Unicode category `C`, so malformed addresses such as `[email protected]` pass validation and `toLink` renders them as contact links; users see a link labeled as a valid recipient that is not a valid email address.
Validate recipients against the supported email-address syntax before creating a `mailto:` link, and test malformed addresses.
</issue_to_address>
### Comment 4
<location path="apps/documentation/pages/docs/service-registry/introduction.mdx" line_range="18" />
<code_context>
- **Service Discovery**: Browse and search registered services.
- **Detailed Views**: Display comprehensive information for each service, including metadata, organization details, and API specifications.
+- **Service Types**: List the types of the services that a registry holds.
+- **Registry Info**: Display the service info of the registry itself.
- **Standard Compliance**: Works with any GA4GH Service Registry v1.0.0 compliant API.
</code_context>
<issue_to_address>
**Service info is missing from component list**
When readers use the introduction’s Available Components list to find registry components, the introduction adds Registry Info to the overview but omits the service-info component from Available Components, so readers using that list cannot discover the new component.
Add an Available Components link for `<ecc-client-ga4gh-service-registry-service-info>` pointing to `./components/service-info`.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:220, packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:47, packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts:47
An Error with an empty message left the error state empty, so the component showed "No service types found" instead of a failure. It now falls back to the generic message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- trim() removed a line feed or tab at the ends of a mailto: recipient before the check, so the link kept a character its label hid. Only plain spaces around an address are allowed now, as part of the address pattern (no extra trimming regex). - An Error with an empty message left the error state empty and the placeholders on screen; it now shows the generic message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # .changeset/service-registry-service-types.md # apps/documentation/pages/docs/service-registry/components/_meta.json # apps/documentation/pages/docs/service-registry/components/service-types.mdx # apps/documentation/pages/docs/service-registry/introduction.mdx # packages/ecc-client-ga4gh-service-registry/demo/index.html # packages/ecc-client-ga4gh-service-registry/src/components/index.ts
|
Thanks @uniqueg, tested locally: 167/167 in all three browsers, plus a run against elixir-on.cloud. I merged Three things to address, here or in follow-up issues:
|
- Links are underlined (offset 2), so organization, contact and documentation links look like links with the near-black primary color. - Version and environment show only as badges next to the name; the duplicate detail rows are gone. - Timestamps show if Date.parse() accepts them; links need only an allowed protocol and a non-empty label (a mailto: link shows its decoded recipients). The RFC 3339 regex, the days-per-month table and the email pattern are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
A mailto: label without its control and format characters, so that a zero-width space or NUL doesn't render as a blank, clickable link. Tests cover them, an empty URL and a trimmed label. The docs place the environment badge next to the type and name Date.parse(). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
|
Thanks @anuragxxd! All three are addressed here, in c3865a7 and 8573641 (plus a merge of
Could you take another look? |
Summary
Stacked on #596 (#452): the branch builds on
feat/452-service-types, and the PR targetsdevso that CI runs (CI runs only for PRs intodev). Until #596 is merged, the diff also shows its commits; review only the commits from c0e411e on, and merge this PR after #596.Adds
ecc-client-ga4gh-service-registry-service-infoto@elixir-cloud/service-registry. It shows the registry's own service info (GET /service-info) through the provider's existinggetServiceInfo(): name, version and type badges, description, and detail rows for ID, version, type, organization and the optional fields.environment,description,contactUrl(link forhttp:,https:andmailto:, showing the address),documentationUrlandorganization.url(links forhttp:andhttps:only),createdAtandupdatedAt(only valid timestamps, in the reader's locale). A fresh cloud-registry 0.4.0 deployment, which sets no timestamps, shows no invalid values or dead links;javascript:or relative URLs never become links.type, or a missingidare left out instead of showing "undefined" or breaking the render; a response that isn't an object shows an error.ecc-service-info-changedwith{ serviceInfo: Service | null }(typedEccServiceInfoChangedEvent); React wrapperonEccServiceInfoChangedis generated.service-registry/components/service-infowith a live preview (the public registry serves its service info with CORS), entries in_meta.json, the introduction and thegetServiceInfo()provider docs; demo pagedemo/service-info; changeset (minor).Verification
npx web-test-runner --group defaultin the package (Chromium and Firefox): 159 passed; the new file has 57 tests, with 100 % line coverage ofservice-info.ts. WebKit doesn't run locally (missing Playwright build and system packages); CI runs it.npm run lint(husky pre-commit, all packages): no errors; the only new warning is theno-consoleon the error log, as in the siblings.npx turbo run buildincl.next buildof the docs: pass;/docs/service-registry/components/service-infois generated.Fixed after Sourcery's review (46a9df9, 94f9875, 567eec3, a8341ab, plus 8e578f4, 6bb0ca2 and f8a7a63 from #596 merged in):
mailto:contacts become links only if every recipient in the path is an email address without control or format characters, (only plain spaces around an address are allowed), and their label shows only the decoded recipients; anErrorwith an empty message shows the generic error; timestamps show only if they are RFC 3339 date-times of a real calendar date; the docs describe the fallback tobaseUrlwhen the provider is removed; the type row test asserts the exact text.Declined review findings
/docs/providersis a dead link". It isn't:apps/documentation/pages/docs/providers.mdxexists and describes the provider lifecycle for all packages, as linked from the service types page too.servicecomponent does the same; the docs now say so for the environment.reflect: trueonprovider,anyin the preview handler and the2.0.0-alpha.52version badge: as in feat(service-registry): add service types list #596 (consistency with the siblings; the version that will first ship the component).servicesandservicehave the same one-microtask window; the fix belongs in the shared provider controller of fix: react to provider changes in all components #519.mailto:label doesn't show?cc=or?bcc=recipients. The registry operator controls the URL, the mail client shows all recipients before sending, and the docs say so.[email protected]still becomes a link. The check prevents dead or misleading links, not invalid syntax; even the HTML standard's email syntax accepts that address.:60) are rejected; browsers can't parse them, and the docs say so.Open questions
None.
Closes #451
🤖 Generated with Claude Code
Summary by Sourcery
Add a service-info component that presents registry metadata with robust state handling and typed change events.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: