Skip to content

feat(service-registry): add service info view - #597

Open
uniqueg wants to merge 23 commits into
devfrom
feat/451-service-info
Open

uniqueg wants to merge 23 commits into
devfrom
feat/451-service-info

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

Stacked on #596 (#452): the branch builds on feat/452-service-types, and the PR targets dev so that CI runs (CI runs only for PRs into dev). 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-info to @elixir-cloud/service-registry. It shows the registry's own service info (GET /service-info) through the provider's existing getServiceInfo(): name, version and type badges, description, and detail rows for ID, version, type, organization and the optional fields.

  • Optional fields only when set: environment, description, contactUrl (link for http:, https: and mailto:, showing the address), documentationUrl and organization.url (links for http: and https: only), createdAt and updatedAt (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.
  • Robust against registries that don't follow the specification: blank or non-string fields, a partial type, or a missing id are left out instead of showing "undefined" or breaking the render; a response that isn't an object shows an error.
  • States: placeholders while loading, the error of a failed request, and the usual missing base URL or provider error.
  • Provider lifecycle as in the sibling components (fix: react to provider set after the first update #577, feat(service-registry): add service types list #596): set or replaced after the first update, only the latest load applies, removal clears the data.
  • Event ecc-service-info-changed with { serviceInfo: Service | null } (typed EccServiceInfoChangedEvent); React wrapper onEccServiceInfoChanged is generated.
  • Docs: new page service-registry/components/service-info with a live preview (the public registry serves its service info with CORS), entries in _meta.json, the introduction and the getServiceInfo() provider docs; demo page demo/service-info; changeset (minor).

Verification

  • npx web-test-runner --group default in the package (Chromium and Firefox): 159 passed; the new file has 57 tests, with 100 % line coverage of service-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 the no-console on the error log, as in the siblings.
  • npx turbo run build incl. next build of the docs: pass; /docs/service-registry/components/service-info is generated.
  • CI: pending for a8341ab (567eec3 all green; before that all green for ebcc4e4: Lint, Test on Node 22 and 24 incl. WebKit, Codecov patch and project, Read the Docs preview).

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; an Error with 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 to baseUrl when the provider is removed; the type row test asserts the exact text.

Declined review findings

  • Quality (medium): "/docs/providers is a dead link". It isn't: apps/documentation/pages/docs/providers.mdx exists and describes the provider lifecycle for all packages, as linked from the service types page too.
  • Quality (low): the cloud-registry 0.4.0 note in the docs. It comes from the issue and explains why the timestamps are optional in practice.
  • Quality (low): version and environment appear both as badges and as detail rows. The service component does the same; the docs now say so for the environment.
  • The provider lifecycle duplication, reflect: true on provider, any in the preview handler and the 2.0.0-alpha.52 version badge: as in feat(service-registry): add service types list #596 (consistency with the siblings; the version that will first ship the component).
  • Sourcery (medium): a load that settles between a property change and Lit's next update still applies. Declined as on feat(service-registry): add service types list #596: services and service have the same one-microtask window; the fix belongs in the shared provider controller of fix: react to provider changes in all components #519.
  • Sourcery (medium): no request deadline, so a request that never settles keeps the placeholders. A timeout is the provider's concern and would apply to every component of every package; to be proposed for the REST providers separately.
  • Adversarial (low): the 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.
  • Adversarial (low): letters that render blank (e.g. U+3164) still pass the address check, which rejects control, format, private-use and unassigned characters; the docs state exactly that.
  • Sourcery (medium, second review): malformed but harmless syntax such as [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.
  • Adversarial (low): leap seconds (: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:

  • Add a service-info web component that displays a GA4GH Service Registry’s own metadata, including optional details, badges, links, and localized timestamps.
  • Expose service-info change events with typed event support and a generated React callback wrapper.

Bug Fixes:

  • Handle missing, malformed, or unsupported service-info fields and responses without rendering invalid values or unsafe links.
  • Provide loading, failure, missing-provider, provider replacement, and stale-request states consistently.

Enhancements:

  • Support loading service information through either a custom provider or a base URL with provider lifecycle updates and fallback behavior.

Documentation:

  • Document the new component, usage, properties, events, provider integration, and live preview.
  • Add a package demo for the service-info component and link it from the demo index.

Tests:

  • Add comprehensive component tests covering rendering, validation, links, dates, events, provider changes, loading, errors, and stale requests.

Chores:

  • Add a minor changeset for the new service-info component and event.

uniqueg and others added 7 commits November 17, 2026 19:48
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]>
@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

API

Expose the service-info custom element and its typed change event, and register the element for package consumers.

  • packages/ecc-client-ga4gh-service-registry/src/components/service-info/index.ts L1-15
  • packages/ecc-client-ga4gh-service-registry/src/events/ecc-service-info-changed.ts L1-11
  • packages/ecc-client-ga4gh-service-registry/src/events/index.ts L2

Implementation

Implement provider selection, loading and stale-request handling, service-info validation, event dispatch, safe optional-field rendering, and loading and error states.

  • packages/ecc-client-ga4gh-service-registry/src/components/service-info/service-info.ts L1-389

Register the new service-info component in the package-wide component entry point.

  • packages/ecc-client-ga4gh-service-registry/src/components/index.ts L4

UI

Add the service-info demo page and link it from the package demo index.

  • packages/ecc-client-ga4gh-service-registry/demo/index.html L26-29
  • packages/ecc-client-ga4gh-service-registry/demo/service-info/index.html L1-33

Add the documentation live-preview component for the service-info view.

  • apps/documentation/components/packages/service-registry/ServiceInfoPreview.tsx L1-19

Configuration

Record the package minor release and feature in a changeset.

  • .changeset/service-registry-service-info.md L1-5

Documentation

Document service-info usage, properties, events, optional-field behavior, and provider integration, and link the component from the registry overview and provider guide.

  • apps/documentation/pages/docs/service-registry/components/_meta.json L4-5
  • apps/documentation/pages/docs/service-registry/components/service-info.mdx L1-139
  • apps/documentation/pages/docs/service-registry/introduction.mdx L18, L26
  • apps/documentation/pages/docs/service-registry/providers.mdx L136

Tests

Add coverage for service-info rendering, validation, provider lifecycle, loading and errors, and emitted events.

  • packages/ecc-client-ga4gh-service-registry/src/components/service-info/tests/service-info.test.ts L1-622

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

@uniqueg
uniqueg changed the base branch from feat/452-service-types to dev November 17, 2026 22:49
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.75248% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.79%. Comparing base (16164ee) to head (8573641).

Files with missing lines Patch % Lines
...gistry/src/components/service-info/service-info.ts 99.74% 1 Missing ⚠️
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.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@uniqueg
uniqueg requested a review from anuragxxd November 17, 2026 23:39
@uniqueg
uniqueg marked this pull request as ready for review November 17, 2026 23:39
@sourcery-ai

sourcery-ai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit 8573641

#451 feat(service-registry): add service-info component · 4 of 4 met

# Requirement Status Notes
1 Add a component that uses the provider’s existing getServiceInfo(). ✅ Met The new service-info component loads data through provider.getServiceInfo().
2 Show environment, contactUrl, documentationUrl, createdAt and updatedAt only if set. ✅ Met Unset or unusable values are omitted; dates are formatted only when Date.parse() accepts them, and links are rendered only for allowed protocols.
3 Add loading and error states. ✅ Met The component renders placeholders while loading and an error message when a request fails.
4 Render service info without invalid values or dead links when optional fields are missing. ✅ Met Missing, blank or wrongly typed fields are omitted, and missing or unsupported URLs do not render as links.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


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

@uniqueg
uniqueg marked this pull request as draft November 17, 2026 23:47
uniqueg and others added 7 commits November 18, 2026 01:23
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]>
@uniqueg
uniqueg marked this pull request as ready for review November 18, 2026 02:03
@uniqueg

uniqueg commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


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

uniqueg and others added 3 commits November 18, 2026 03:40
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]>
uniqueg and others added 3 commits November 21, 2026 01:15
# 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
@anuragxxd

Copy link
Copy Markdown
Member

Thanks @uniqueg, tested locally: 167/167 in all three browsers, plus a run against elixir-on.cloud. I merged dev in and trimmed the docs and changeset. Hope that's fine.

Three things to address, here or in follow-up issues:

  1. Links must look like links. The organisation, contact and documentation links render black with no underline. service.ts has the same problem with text-primary. Please open an issue to fix link styling across the package.
  2. Remove the duplicate version and environment. Each one shows as a badge and again as a row. Keep one of the two.
  3. Simplify the date and email checks. About 90 lines (a custom RFC 3339 regex, a days-per-month table, a Unicode email pattern) is too much for deciding whether to show a date or a mailto: link. !isNaN(Date.parse(x)) plus a protocol allowlist is enough. Please simplify it in a follow-up.

uniqueg and others added 3 commits November 25, 2026 16:22
- 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
@uniqueg

uniqueg commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Thanks @anuragxxd! All three are addressed here, in c3865a7 and 8573641 (plus a merge of dev):

  1. Links look like links. The organization, contact and documentation links in the service info are now always underlined (underline underline-offset-2, slightly lighter on hover), so they stand out with the near-black primary color too. A test checks the computed text-decoration-line of every link. service.ts and the rest of the package will get a separate issue, as you suggested.
  2. No duplicate version and environment. They show only as badges now (version next to the name, environment next to the type); the Version and Environment rows are gone. The docs page says so.
  3. Simpler checks. The RFC 3339 regex, the days-per-month table and the email pattern are gone (about 70 lines). A timestamp shows if Date.parse() accepts it; a link needs only an allowed protocol (http:/https:, plus mailto: for the contact) and a non-empty label, so javascript: and relative URLs still never become links. A mailto: link shows its decoded recipients rather than the raw URL with ?subject=, with invisible characters stripped so that a link can't render blank. The browser-specific date tests (30 February, lowercase t, space separator) are gone.

Could you take another look?

This branch has not been deployed

No deployments
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.

feat(service-registry): add service-info component

2 participants