Skip to content

docs: fix the endpoints of the live previews - #564

Merged
uniqueg merged 3 commits into
devfrom
docs/445-preview-endpoints
Nov 5, 2026
Merged

uniqueg merged 3 commits into
devfrom
docs/445-preview-endpoints

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Summary

The live previews of the documentation called demo deployments that are gone. This PR:

  • Sets all preview endpoints, and the IDs that the single-object previews show, in one place: apps/documentation/utils/endpoints.ts. Each value can be overridden at build time with a NEXT_PUBLIC_* variable (NEXT_PUBLIC_SERVICE_REGISTRY_URL, NEXT_PUBLIC_CLOUD_REGISTRY_URL, NEXT_PUBLIC_TRS_URL, NEXT_PUBLIC_TRS_FILER_URL, NEXT_PUBLIC_WES_URL, NEXT_PUBLIC_SERVICE_ID, NEXT_PUBLIC_TRS_TOOL_ID, NEXT_PUBLIC_WES_RUN_ID).
  • Defaults: Service Registry and Cloud Registry: https://elixir-on.cloud/ga4gh/registry/v1; TRS: https://workflowhub.eu/ga4gh/trs/v2 (sample tool 2); WES and TRS-Filer: none.
  • WES and TRS-Filer previews show a notice (new components/common/MissingEndpoint.tsx) unless an endpoint is set, instead of calling a broken URL.
  • The Services, Service, Tools and TRS-Filer form previews pass baseUrl instead of provider. These components read provider only in firstUpdated, which runs before React sets the property on the server-rendered element, so they showed "Please provide either a base URL ... or a custom provider" and never fetched. They do reload on baseUrl changes. The component bug itself is not fixed here (see "Follow-ups").
  • New section "Live previews" on the page "Contributing": where the endpoints are set, how to override them, what works with the defaults, and the CORS caveat. Callouts on the preview pages say what each preview needs.
  • Code samples use example.com placeholders instead of the old hosts. The TRS-Filer samples now pass the base URL as a string (the provider's constructor takes baseUrl: string, not { url }).
  • The "Live Demo" links in the introduction table now point to the preview pages (Service Registry, Cloud Registry, TRS). WES and TRS-Filer have no link, as there is nothing public to show.

Only apps/documentation/ is touched; no component package changes.

Closes #445

Decisions

  • WES / TRS-Filer: no public WES or TRS-Filer is known that works without a login, so no endpoint was invented. Their previews read the endpoint from the same config (empty by default) and show a notice that explains how to point them at your own instance (NEXT_PUBLIC_WES_URL=... npm run dev).
  • Sample IDs live next to the endpoints, as changing an endpoint usually means changing the IDs too.
  • Code samples use placeholders rather than the live endpoints, so the endpoints stay in one file and the samples don't suggest a particular deployment.

Acceptance criteria, honestly

  • Endpoints are defined in one place (apps/documentation/utils/endpoints.ts; the only other mentions are example.com placeholders in code samples).
  • All previews and "Live Demo" links work without authentication: partly.
    • Work: TRS Tools and Tool (WorkflowHub data), Service Registry Services (renders; the public registry currently lists 0 services), Cloud Registry form (loads service types and service info).
    • Don't work with the defaults: Service Registry "Service" (placeholder ID: the public registry has no services yet, so it shows an error until NEXT_PUBLIC_SERVICE_ID is set); Cloud Registry form submission (needs a login); WES (3 previews) and TRS-Filer form (no public instance: notice instead).
    • The removed "Live Demo" links for WES and TRS-Filer are gone rather than fixed.
  • CORS: the registry allows only known origins (it allows https://elixir-cloud-components.vercel.app, https://cloud-components.readthedocs.io and http://localhost:3000). On other origins, e.g. Vercel or Read the Docs preview builds of this PR, the registry previews are blocked by CORS. WorkflowHub sends Access-Control-Allow-Origin: *.

Verification

  • npm run lint (repo root; includes the build of all packages and the docs app): passes.
  • npx tsc --noEmit -p . and npx eslint . in apps/documentation/: pass.
  • Static build checked in headless Chromium (Playwright, pages served from out/):
    • /docs/trs/components/tools: lists WorkflowHub workflows (requests to /toolClasses and /tools?limit=5 return 200). Before the baseUrl change, no request was made and the "Please provide ..." error showed.
    • /docs/trs/components/tool: shows tool 2 with versions and files (200s).
    • /docs/service-registry/components/services: requests /services and /services/types (200), shows "No services found".
    • /docs/cloud-registry/components/service-create: requests /services/types and /service-info (200).
    • /docs/wes/components/runs, /docs/trs-filer/components/tool-create: show the notice.
    • Build with NEXT_PUBLIC_WES_URL and NEXT_PUBLIC_TRS_FILER_URL set to dummy hosts: the WES and TRS-Filer previews render and call the configured hosts.
  • CI (run 42082483277): all checks passed (CI passed, Lint, Test on Node 22 and 24, CodeQL, Codecov, Read the Docs build).
  • curl of the default endpoints: registry /services, /services/types, /service-info 200 without login; WorkflowHub /tools, /tools/2, /toolClasses 200 (one transient 503 seen once).

Light lane: changes only the documentation app (pages, preview wrappers, one config file); no component package, CI, release or security-relevant code. Diff reviewed by the author instead of reviewer subagents.

Declined review findings

  • Sourcery: "Previews fetch initial data twice": the two fetch paths are inside the components (packages are out of scope here). On the server-rendered docs pages, firstUpdated() returns early and each request was observed once. Covered by the component follow-up below.
  • Sourcery: "Cloud Registry submission" fails without a login: intended. No public registry accepts writes without a login; documented in the callout and under "Acceptance criteria".
  • Sourcery (2nd round): "No live WES or TRS-Filer": intended; no public instance without a login exists (see "Decisions").
  • Sourcery (2nd round): "Service preview has no sample": the default registry has no services yet; follow-up below.

Fixed: Sourcery "Trailing slashes break previews" (86291ac).

Open questions

None blocking this PR.

Follow-ups

  • The Services, Service, Tools and TRS-Filer tool-create components ignore a provider set after their first update (they only react to baseUrl), unlike the Cloud Registry form (fixed in fix(cloud-registry): react to provider changes #502) and the WES components. This PR works around it in the docs; a fix belongs in the packages (needs code owner review). Should an issue be opened?
  • The public registry lists no services yet, so the Service Registry previews show an empty list and the single-service preview an error. Once a service is registered there, sampleIds.service can name it.
  • The issue thread mentions a lightweight mock service for all APIs; this PR doesn't depend on it. Once it exists, only endpoints.ts needs to change.

🤖 Generated with Claude Code

uniqueg and others added 2 commits November 5, 2026 19:13
The live previews called demo deployments that are gone. They now take
their endpoints, and the IDs of single-object samples, from
apps/documentation/utils/endpoints.ts, each overridable at build time
with a NEXT_PUBLIC_* variable. The Service Registry and Cloud Registry
previews use a public registry, the TRS previews WorkflowHub. There is
no public WES or TRS-Filer without a login, so their previews show a
notice unless an endpoint is set.

The Services, Service, Tools and TRS-Filer form previews pass baseUrl
instead of provider: these components read provider only on their first
update, which runs before React sets it on the server-rendered element.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add "Live previews" to the page "Contributing": where the endpoints are
set, how to override them, and what works with the defaults. Callouts
on the preview pages say what each preview needs. The code samples use
example.com placeholders instead of the removed demo deployments, and
the TRS-Filer samples pass the base URL as a string, as the provider
expects. The "Live Demo" links of the introduction point to the preview
pages; WES and TRS-Filer have none.

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

sourcery-ai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This documentation-only PR consolidates live-preview endpoints and sample IDs into a build-configurable module, switches previews to working public defaults or explicit missing-endpoint notices, fixes affected base URL initialization, replaces stale demo links and hosts, and documents authentication, CORS, and customization requirements.

Sequence diagram for documentation preview endpoint selection

sequenceDiagram
    participant Build as Documentation build
    participant Config as endpoints.ts
    participant Preview as Preview component
    participant API as Remote GA4GH API
    participant Notice as MissingEndpoint

    Build->>Config: Read process.env.NEXT_PUBLIC_* variables
    Config-->>Preview: Provide endpoint and sampleIds
    alt endpoint configured
        Preview->>API: Fetch using baseUrl or provider
        API-->>Preview: Return preview data
    else endpoint is empty
        Preview->>Notice: Render service and variable
        Notice-->>Preview: Show setup guidance
    end
Loading

Flow diagram for updated live preview navigation

flowchart LR
    Table[Introduction component table] --> Link[Live preview link]
    Link --> Service[Service Registry preview]
    Link --> Cloud[Cloud Registry preview]
    Link --> TRS[TRS preview]
    Service --> CORS[Anonymous CORS request]
    Cloud --> CORS
    TRS --> CORS
    WES[WES entry] --> Docs[Documentation and configuration instructions]
    Filer[TRS-Filer entry] --> Docs
Loading

File-Level Changes

Change Details Files
Centralize live-preview endpoints and sample object IDs with build-time environment-variable overrides and documented defaults.
  • Added shared endpoint and sample-ID configuration, including empty defaults for unavailable services.
  • Updated preview wrappers to consume the shared configuration instead of hard-coded deployments.
  • Added endpoint and CORS guidance to the contributing documentation.
apps/documentation/utils/endpoints.ts
apps/documentation/components/packages/cloud-registry/ServiceCreatePreview.tsx
apps/documentation/components/packages/service-registry/ServicePreview.tsx
apps/documentation/components/packages/service-registry/ServicesPreview.tsx
apps/documentation/components/packages/trs/ToolPreview.tsx
apps/documentation/components/packages/trs/ToolsPreview.tsx
apps/documentation/components/packages/wes/RunCreatePreview.tsx
apps/documentation/components/packages/wes/RunPreview.tsx
apps/documentation/components/packages/wes/RunsPreview.tsx
apps/documentation/pages/docs/contributing.mdx
Prevent unavailable WES and TRS-Filer previews from calling invalid endpoints and explain how to configure them.
  • Added a reusable missing-endpoint callout with setup instructions.
  • Rendered notices when WES or TRS-Filer endpoints are unset.
  • Kept configured endpoints usable through the corresponding preview providers.
apps/documentation/components/common/MissingEndpoint.tsx
apps/documentation/components/packages/wes/RunCreatePreview.tsx
apps/documentation/components/packages/wes/RunPreview.tsx
apps/documentation/components/packages/wes/RunsPreview.tsx
apps/documentation/components/packages/trs-filer/ToolCreatePreview.tsx
Fix documentation preview initialization and align examples with the new endpoint strategy.
  • Passed base URLs to affected form and list previews so they fetch correctly with server-rendered React wrappers.
  • Updated TRS-Filer provider examples to use the string constructor argument.
  • Replaced retired live hosts in code samples with example.com placeholders.
  • Added callouts describing authentication, placeholder IDs, data availability, and configuration requirements.
apps/documentation/components/packages/service-registry/ServicePreview.tsx
apps/documentation/components/packages/service-registry/ServicesPreview.tsx
apps/documentation/components/packages/trs/ToolsPreview.tsx
apps/documentation/components/packages/trs-filer/ToolCreatePreview.tsx
apps/documentation/pages/docs/cloud-registry/components/service-create.mdx
apps/documentation/pages/docs/service-registry/components/service.mdx
apps/documentation/pages/docs/service-registry/components/services.mdx
apps/documentation/pages/docs/trs-filer/components/tool-create.mdx
apps/documentation/pages/docs/trs/components/tool.mdx
apps/documentation/pages/docs/trs/components/tools.mdx
apps/documentation/pages/docs/wes/components/run-create.mdx
apps/documentation/pages/docs/wes/components/run.mdx
apps/documentation/pages/docs/wes/components/runs.mdx
Replace obsolete external demo links with documentation preview links and remove links for services without public demos.
  • Changed Service Registry, Cloud Registry, and TRS entries to point to their preview pages.
  • Removed WES and TRS-Filer live-demo links where no unauthenticated public endpoint exists.
  • Updated the table icon to indicate an in-document preview.
apps/documentation/pages/docs/introduction.mdx
Update documentation spelling configuration for the new terminology.
  • Adjusted the documentation project word list.
apps/documentation/project-words.txt

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.40%. Comparing base (dba860f) to head (86291ac).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #564   +/-   ##
=======================================
  Coverage   71.40%   71.40%           
=======================================
  Files          23       23           
  Lines        5655     5655           
  Branches      199      199           
=======================================
  Hits         4038     4038           
  Misses       1610     1610           
  Partials        7        7           

☔ 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 marked this pull request as ready for review November 5, 2026 18:21
@uniqueg
uniqueg requested a review from anuragxxd as a code owner November 5, 2026 18:21

@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 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="apps/documentation/components/packages/service-registry/ServicePreview.tsx" line_range="17" />
<code_context>
-        provider={provider}
-        serviceId="JOMGD2"
+      <ECCClientGa4ghServiceRegistryService
+        baseUrl={endpoints.serviceRegistry}
+        serviceId={sampleIds.service}
         onEccServiceChanged={handleServiceChanged}
</code_context>
<issue_to_address>
**Previews fetch initial data twice**

When a Service Registry or TRS Tools preview mounts with its configured `baseUrl`, `firstUpdated()` starts the initial fetch and Lit’s initial `updated()` starts it again; the unsequenced `loadData` responses can let an older snapshot overwrite newer data, leaving stale results, and the duplicate requests can throttle public endpoints.

Skip one of the initial fetch paths so mounting starts only one request.

Also at `apps/documentation/components/packages/service-registry/ServicesPreview.tsx:22`, `apps/documentation/components/packages/trs/ToolsPreview.tsx:13`, `apps/documentation/components/packages/service-registry/ServicePreview.tsx:18`.
</issue_to_address>

### Comment 2
<location path="apps/documentation/pages/docs/cloud-registry/components/service-create.mdx" line_range="31" />
<code_context>
   <Tabs.Tab>
     <ServiceCreatePreview />
+    <Callout type="info" emoji="ℹ️">
+      The preview above loads the service types from a public Cloud Registry without a login. Creating a service there needs a login, so submitting the form fails with an error. See [Live previews](/docs/contributing#live-previews) to use another registry.
+    </Callout>
   </Tabs.Tab>
</code_context>
<issue_to_address>
**Cloud Registry submission**

The issue asks for all previews to work without authentication. The callout says the form loads its options, but submitting it fails because creating a service requires a login.
</issue_to_address>

### Comment 3
<location path="apps/documentation/utils/endpoints.ts" line_range="15" />
<code_context>
+export const endpoints = {
+  // GA4GH Service Registry (read-only previews)
+  serviceRegistry:
+    process.env.NEXT_PUBLIC_SERVICE_REGISTRY_URL || 'https://elixir-on.cloud/ga4gh/registry/v1',
+  // Cloud Registry (form; creating a service needs a login)
+  cloudRegistry:
</code_context>
<issue_to_address>
**Trailing slashes break previews**

When a configured `NEXT_PUBLIC_*_URL` value ends in `/`, the REST providers append paths directly to `baseUrl` (for example, `${this.baseUrl}/services`) without normalizing it, so APIs that do not collapse doubled path separators return 404 and the corresponding previews fail.

Strip trailing slashes from configured endpoint values before passing them to the providers.

Also at `apps/documentation/utils/endpoints.ts:18`, `apps/documentation/utils/endpoints.ts:20`, `apps/documentation/utils/endpoints.ts:22`, `apps/documentation/utils/endpoints.ts:24`.
</issue_to_address>

Linked issues

#445 Docs: live examples broken — update WES, TRS, Cloud Registry and Service Registry endpoints · 1 of 3 met

# Requirement Status Notes
1 Replace the broken preview endpoints with maintained endpoints that do not require authentication. 🟡 Partly met Service Registry, Cloud Registry, and TRS use public endpoints, but WES and TRS-Filer have no default endpoint and show a notice instead.
2 Define the preview endpoints in one config file. ✅ Met The preview wrappers use apps/documentation/utils/endpoints.ts for their endpoint values.
3 Make all documentation previews and Live Demo links work without authentication. 🟡 Partly met Some previews work, but WES and TRS-Filer are notices, the Service preview uses a placeholder ID, and Cloud Registry form submission needs a login.

Sourcery assessment

Approval pending. 3 findings to address first.

Blocking findings: apps/documentation/components/packages/service-registry/ServicePreview.tsx:17, apps/documentation/pages/docs/cloud-registry/components/service-create.mdx:31, apps/documentation/utils/endpoints.ts:15


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

Comment thread apps/documentation/utils/endpoints.ts Resolved
The providers append paths to the base URL, so an overridden endpoint
that ends in "/" would double the separator.

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

@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.

Linked issues

#445 Docs: live examples broken — update WES, TRS, Cloud Registry and Service Registry endpoints · 1 of 2 met

# Requirement Status Notes
1 All documentation previews and “Live Demo” links work without authentication. 🟡 Partly met The remaining links now lead to preview pages, and the TRS and registry read previews use public endpoints, but the default Service preview uses a placeholder ID, Cloud Registry creation requires login, and WES/TRS-Filer show notices instead of live previews.
2 Define the preview endpoints in one place. ✅ Met Preview endpoint values are centralized in apps/documentation/utils/endpoints.ts; the documentation samples use placeholder hosts.

Comment thread apps/documentation/utils/endpoints.ts Resolved
Comment thread apps/documentation/utils/endpoints.ts Resolved
@uniqueg
uniqueg merged commit ab13670 into dev Nov 5, 2026
27 of 31 checks passed
@uniqueg
uniqueg deleted the docs/445-preview-endpoints branch November 5, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: live examples broken — update WES, TRS, Cloud Registry and Service Registry endpoints

1 participant