Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8d45d70
feat(wes): check I/O Schemas against the profile
uniqueg Dec 3, 2026
abd7e89
feat(wes): check file reference values
uniqueg Dec 3, 2026
8d98107
feat(wes): render Markdown descriptions safely
uniqueg Dec 3, 2026
21d392a
feat(wes): add the I/O Schema input form
uniqueg Dec 3, 2026
6a40038
fix(wes): harden I/O Schema checks
uniqueg Dec 3, 2026
8be98ef
feat(wes): render the I/O Schema widget hints
uniqueg Dec 3, 2026
c771794
fix(wes): bound the I/O form's field walk
uniqueg Dec 3, 2026
2bba81e
feat(wes): check file reference inputs
uniqueg Dec 3, 2026
70ca407
feat(wes): add error messages, hidden inputs
uniqueg Dec 3, 2026
e340895
feat(wes): edit lists and unions in the I/O form
uniqueg Dec 3, 2026
48d818c
feat(wes): show allOf groups as form sections
uniqueg Dec 3, 2026
cedf572
fix(wes): name I/O form controls and buttons
uniqueg Dec 3, 2026
48fdfbd
fix(wes): check file values by the schema
uniqueg Dec 3, 2026
8f06592
fix(wes): bound and narrow the file value walk
uniqueg Dec 3, 2026
7712c89
feat(wes): translate I/O values to workflow_params
uniqueg Dec 4, 2026
49377ea
feat(wes): add a Conquest engine profile
uniqueg Dec 4, 2026
101e99b
feat(wes): add a schema mode to run-create
uniqueg Dec 4, 2026
3f49d1b
fix(wes): address review of the run request builder
uniqueg Dec 4, 2026
f28c15c
fix(wes): tighten subschema and Conquest checks
uniqueg Dec 4, 2026
abb56bc
feat(wes): normalise run outputs by I/O Schema
uniqueg Dec 4, 2026
20666d0
feat(wes): show run outputs with I/O Schema hints
uniqueg Dec 4, 2026
e817e63
fix(wes): address review of the output view
uniqueg Dec 4, 2026
c24a517
fix(wes): word the unconverted-outputs notice
uniqueg Dec 4, 2026
c3f322f
fix(wes): map the run element's run-id attribute
uniqueg Dec 4, 2026
3a06d71
fix(wes): define the run output element once
uniqueg Dec 5, 2026
f5f59c2
docs(wes): say the output element defines once
uniqueg Dec 5, 2026
f63ec1d
Merge feat/io-schema into feat/io-run-output-proposal
uniqueg Dec 5, 2026
062a473
test(wes): validate outputs under names with '#'
uniqueg Dec 5, 2026
fe26036
fix(wes): address review of the outputs merge
uniqueg Dec 5, 2026
3467ff4
fix(wes): drop run logs of earlier run IDs
uniqueg Dec 5, 2026
902d2a3
fix(wes): drop run logs when the run ID is cleared
uniqueg Dec 5, 2026
af2e3ea
docs(wes): note property-only run output settings
uniqueg Dec 5, 2026
b692f05
fix(wes): drop run logs on a new provider without ID
uniqueg Dec 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wes-run-id-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@elixir-cloud/wes": patch
---

`ecc-client-ga4gh-wes-run` reads its run ID from the documented `run-id` attribute. Before, Lit mapped `runId` to the attribute `runid`, so `run-id` did nothing; markup that used `runid` must switch to `run-id`. The `runId` property is unchanged.
5 changes: 5 additions & 0 deletions .changeset/wes-run-output-define-once.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@elixir-cloud/wes": patch
---

Define `ecc-client-ga4gh-wes-run-output` only in browsers and only once (`defineRunOutput()`), so that a second copy of the module doesn't throw.
5 changes: 5 additions & 0 deletions .changeset/wes-run-outputs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@elixir-cloud/wes": minor
---

Show run outputs with GA4GH IO Schema hints: `ecc-client-ga4gh-wes-run` gains `ioSchema`, `outputOptions`, `outputProvider` and `allowedSchemes`; with a schema, its Outputs tab shows the normalised outputs of a run that has ended through `ecc-client-ga4gh-wes-run-output` (titles, descriptions, viewers, downloads), with warnings for partial and non-conformant outputs and the normaliser's reports; without one, the raw outputs stay. `@elixir-cloud/wes/utils` exports the output normaliser (`normaliseOutputs`, `NormalisationError`, `FINAL_STATES`). `IoSchemaCheck` gains an optional `validateOutputs` (`OutputsValidator`): a validator set with `setIoSchemaValidator()` needs it for the normaliser.
5 changes: 5 additions & 0 deletions .changeset/wes-run-stale-run-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@elixir-cloud/wes": patch
---

`ecc-client-ga4gh-wes-run` drops the run log of an earlier request when the run ID or provider changed or was cleared while it was loading, so a slow answer for the previous run no longer replaces the selected run (or the "no run ID" error).
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import React, { useMemo, useState } from 'react';
import { ECCClientGa4ghWesRun } from '@elixir-cloud/wes/react';
import type { RunLog, WesProvider } from '@elixir-cloud/wes/providers';
import PreviewLayout from '@/components/common/PreviewLayout';
import { ioFormExamples } from '@/components/packages/wes/ioFormExamples';
import {
DEMO_RUN,
exampleOutputProvider,
} from '@/components/packages/wes/runOutputExample';

const allowedSchemes = ['drs', 'https', 's3'];

/** The output directory of the demo run, as miniwdl sees it (made up). */
const LOCAL_DIR = '/data/miniwdl-runs/20261113_021212_io_schema_demo/out';

/** Outputs of the demo workflow as miniwdl reports them: local paths. */
const reported: Record<string, string> = {
'io_schema_demo.report': `${LOCAL_DIR}/report/report.html`,
'io_schema_demo.read_counts': `${LOCAL_DIR}/read_counts/read_counts.tsv`,
'io_schema_demo.filtered_bam': `${LOCAL_DIR}/filtered_bam/filtered.bam`,
'io_schema_demo.filtered_bam_index': `${LOCAL_DIR}/filtered_bam_index/filtered.bam.bai`,
};

const runs: Record<string, { label: string; log: RunLog }> = {
complete: {
label: 'Completed run',
log: {
run_id: 'demo-complete',
state: 'COMPLETE',
outputs: reported,
} as unknown as RunLog,
},
failed: {
label: 'Failed run (partial outputs)',
log: {
run_id: 'demo-failed',
state: 'EXECUTOR_ERROR',
outputs: {
'io_schema_demo.report': reported['io_schema_demo.report'],
'io_schema_demo.read_counts': reported['io_schema_demo.read_counts'],
},
} as unknown as RunLog,
},
};

/** A provider that returns one made-up run of the demo workflow. */
class DemoRunProvider implements WesProvider {
private log: RunLog;

constructor(log: RunLog) {
this.log = {
...log,
request: {
workflow_type: 'WDL',
workflow_type_version: '1.1',
workflow_url: 'https://example.org/demo.wdl',
workflow_params: {},
},
run_log: {},
task_logs: [],
} as unknown as RunLog;
}

async getRunLog() {
return this.log;
}

async getServiceInfo(): Promise<never> {
throw new Error('Not available in the demo.');
}

async runWorkflow(): Promise<never> {
throw new Error('Not available in the demo.');
}

async listRuns() {
return { runs: [] };
}

async getRunStatus(): Promise<never> {
throw new Error('Not available in the demo.');
}

async cancelRun(): Promise<never> {
throw new Error('Not available in the demo.');
}
}

export default function RunSchemaOutputsPreview() {
const [run, setRun] = useState('complete');
const provider = useMemo(() => new DemoRunProvider(runs[run].log), [run]);

return (
<PreviewLayout>
<div className='flex w-full flex-col gap-4'>
<label className='flex items-center gap-2 text-sm'>
Run
<select
className='rounded-md border px-2 py-1'
value={run}
onChange={(e) => setRun(e.target.value)}
>
{Object.entries(runs).map(([key, { label }]) => (
<option key={key} value={key}>
{label}
</option>
))}
</select>
</label>
<ECCClientGa4ghWesRun
key={run}
provider={provider}
runId={runs[run].log.run_id}
ioSchema={ioFormExamples.demo.schema}
outputOptions={{ outputDir: DEMO_RUN, localDir: LOCAL_DIR }}
outputProvider={exampleOutputProvider}
allowedSchemes={allowedSchemes}
/>
</div>
</PreviewLayout>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { withBasePath } from '@/utils/basePath';

export const PROFILE_COMMIT = '2c3dc49ad89f0a556272f160369a2a2d7a21dac3';

const DEMO_RUN =
export const DEMO_RUN =
's3://conquest/v1/workflow-runs/9f1c2e4a-5b6d-4e7f-8a9b-0c1d2e3f4a5b/outputs/files/miniwdl-runs/20261113_021212_io_schema_demo/out';

/** Schemas of the outputs (the `properties` of `outputs`). */
Expand Down
2 changes: 2 additions & 0 deletions apps/documentation/pages/docs/wes/components/run-output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Outputs and schemas are treated as untrusted:

## Usage

Importing the element defines it, only in browsers and only once (`defineRunOutput()` does the same), so a second copy of the module, for example in another bundle, doesn't throw.

The preview shows the outputs of the IO Schema's demo workflow. The report tries to run a script and load an external image; both are blocked.

<Tabs items={['Preview', 'React', 'HTML']}>
Expand Down
73 changes: 69 additions & 4 deletions apps/documentation/pages/docs/wes/components/run.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Callout, Tabs } from 'nextra/components'
import ComponentName from '@/components/common/ComponentName'
import RunPreview from '@/components/packages/wes/RunPreview'
import RunSchemaOutputsPreview from '@/components/packages/wes/RunSchemaOutputsPreview'

# EccClientGa4ghWesRun Component

Expand Down Expand Up @@ -77,12 +78,76 @@ This example shows the details for a specific workflow run ID.
</Tabs.Tab>
</Tabs>

### Outputs with an IO schema

Without an IO schema, the Outputs tab shows `RunLog.outputs` as the server reports it. With the workflow's [IO schema](../io-schema) (`ioSchema`), it shows the [normalised outputs](../io-schema#run-outputs) of a run that has ended: each output by its title and description, with its viewer hint (a table, an HTML report in a sandboxed frame) and download, as [`ecc-client-ga4gh-wes-run-output`](./run-output) shows it. Only URIs with a scheme from `allowedSchemes` are fetched or offered for download, through `outputProvider`.

- While the run hasn't ended, the tab says that outputs are shown when it has (without the raw outputs).
- Outputs of a run that didn't complete are shown with a warning that they may be incomplete; invalid ones are left out and named.
- Outputs that don't match the schema are kept, with a warning and the errors.
- Outputs that the engine reports but the schema doesn't declare, and listed files that no output found ("Other files"), are shown without a description; outputs that weren't produced are named.
- Outputs that can't be converted (e.g. files that can't be located, or values nested too deeply), globs that match several files, and listed files with unsafe paths are named in notices.
- If the outputs can't be normalised (e.g. an unsupported shape, or a schema that doesn't conform to the profile), the tab says why and shows them as reported.

Where the server keeps the run's files is deployment knowledge: `outputOptions` gives it (`outputDir`, `localDir`, `files`), or a function of the run log that returns it, also as a promise (e.g. to fetch a listing). The outputs are normalised again whenever `ioSchema` or `outputOptions` changes, so pass the same object or function between renders (in React, define it outside the component or memoise it). The normaliser and the output element are loaded when they are first needed.

This preview uses a provider that returns a run of the profile's demo workflow (WDL), as miniwdl reports it (local paths), from a completed or a failed run:

<Tabs items={['Preview', 'React']}>
<Tabs.Tab>
<RunSchemaOutputsPreview />
</Tabs.Tab>

<Tabs.Tab>
```tsx showLineNumbers copy filename="run-outputs.tsx"
import React from 'react';
import { ECCClientGa4ghWesRun } from '@elixir-cloud/wes/react';
import { RestWesProvider } from '@elixir-cloud/wes/providers';
import type { RunLog, WesOutputProvider } from '@elixir-cloud/wes/providers';

// Defined once, so that the outputs aren't normalised on every render
const outputOptions = (runLog: RunLog) => ({
outputDir: `s3://bucket/runs/${runLog.run_id}`,
});

export default function RunOutputs({
schema,
outputProvider,
}: {
schema: object;
outputProvider: WesOutputProvider;
}) {
const provider = new RestWesProvider(
'https://wes.example.com/ga4gh/wes/v1'
);

return (
<ECCClientGa4ghWesRun
provider={provider}
runId="placeholder-run-id"
ioSchema={schema}
outputOptions={outputOptions}
outputProvider={outputProvider}
allowedSchemes={['drs', 'https', 's3']}
/>
);
}
```
</Tabs.Tab>
</Tabs>

## Properties

| Property | Type | Default | Description |
|------------|---------------------------|---------|--------------------------------------------------------------------------------|
| `runId` | `string` | `""` | ID of the workflow run to display details for. |
| `provider` | `WesProvider` | `null` | Data provider for fetching run data (see [Providers](/docs/wes/providers)) |
| Property | Type | Default | Description |
|------------------|---------------------------|-------------|--------------------------------------------------------------------------------|
| `runId` | `string` | `""` | ID of the workflow run to display details for. |
| `provider` | `WesProvider` | `null` | Data provider for fetching run data (see [Providers](/docs/wes/providers)) |
| `ioSchema` | `object` | `undefined` | The workflow's IO schema (GA4GH IO Schema Profile 0.3.0); shows the normalised outputs |
| `outputOptions` | `OutputOptions \| (runLog) => OutputOptions \| Promise<OutputOptions>` | `undefined` | Where the run keeps its files: `outputDir` (URI), `localDir` (path as the engine sees it), `files` (a listing) |
| `outputProvider` | `WesOutputProvider` | `undefined` | Fetches output files for viewers and returns download URLs (see [Run Output](./run-output)) |
| `allowedSchemes` | `string[]` | `['drs', 'https']` | URI schemes of outputs that may be fetched or downloaded |

The run ID can also be set with the `run-id` attribute (earlier versions read it from `runid`, which no longer works). `ioSchema`, `outputOptions`, `outputProvider` and `allowedSchemes` are properties only, without attributes; when `allowedSchemes` is unset, outputs use `['drs', 'https']`. The preview above adds `s3` because its provider resolves `s3` URIs: add a scheme only if your `outputProvider` handles it safely.

## Events

Expand Down
23 changes: 23 additions & 0 deletions apps/documentation/pages/docs/wes/io-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,29 @@ const request = await buildRunRequest(schema, values, {

The translation passes the profile's test vectors (`tests/vectors/wes-params`, `workflow-urls` and `trs-files`). It needs a validator that can check subschemas (`validateAt` of the check result), and refuses schemas that it can't follow: references that don't resolve within the document by a JSON Pointer fragment (so also references by `$anchor` or to the document's `$id` without a fragment), references and branches inside embedded `$id` resources, and `$dynamicRef`. GALAXY workflows have no binding in profile 0.3.0.

## Run outputs

`normaliseOutputs()` from `@elixir-cloud/wes/utils` builds the [normalised outputs object](https://ga4gh-io-schema.readthedocs.io/en/latest/specification/outputs/#the-normalised-outputs-object) of a WES run from what the server reports, keyed by the outputs of an IO schema, which [`ecc-client-ga4gh-wes-run`](./components/run#outputs-with-an-io-schema) shows:

```typescript
import { normaliseOutputs } from '@elixir-cloud/wes/utils';

const result = await normaliseOutputs(schema, runLog, {
outputDir: 's3://bucket/runs/7', // where the server keeps the run's files
localDir: '/data/runs/7/out', // the same directory as the engine sees it
});
// result.conformance: 'conformant' | 'non-conformant' | 'partial'
// result.outputs: { report: 's3://bucket/runs/7/report/report.html', ... }
```

- Outputs are found **by name** (the property name, or `name` of `x-ga4gh-parameter`, qualified with the entry point for WDL), else **by `x-ga4gh-output-glob`** among the files that the server lists: Sapporo's list of files, WESkit's `filesystem`, or `files` of the options. CWL `File` and `Directory` objects give their `location`; paths under `localDir`, and relative paths, become URIs under `outputDir` (each segment percent-encoded); other paths are reported as `unconverted`.
- Listed entries are checked before globs are matched: absolute paths, `.`, `..` and empty segments, backslashes, control characters, a colon in the first segment, URIs outside `outputDir`, with a query or fragment, or with an encoded `/` are skipped and reported (`skippedFiles`, without user information, query and fragment, which may carry credentials). WESkit's presigned URLs (`S3`) are dropped.
- The object is validated against `outputs` for a run that completed (`non-conformant` outputs are kept as they are, with `errors`); for a run that ended otherwise, output by output, and invalid outputs are left out (`removed`). File references must be absolute URIs with one of their `schemes`.
- Outputs that the schema doesn't declare (`undeclared`), files that no output found (`unmatchedFiles`) and globs of one file with several matches (`ambiguous`) are reported, never dropped silently.
- A run that hasn't ended, a run log of an unsupported shape and inconsistent options raise a `NormalisationError` (with `schemaErrors` for a schema that doesn't conform to the profile).

The normaliser never fetches anything, and it doesn't check output URIs against the deployment's allow-list: [`ecc-client-ga4gh-wes-run-output`](./components/run-output) does that before it shows or fetches a file. It passes the profile's test vectors (`tests/vectors/wes-outputs`) and needs a validator that validates outputs (`validateOutputs` of the check result). Unlike the reference implementation, it checks the `schemes` of file references only in the shapes that values are converted by (files, lists, records, files keyed by name, a single branch besides `null`, `allOf`), not inside other unions. It doesn't follow references into embedded `$id` resources (the value is then kept as reported, for validation to report), and refuses values nested more than 64 levels deep (`unconverted`).

## Descriptions

Titles, descriptions and `enum` values of IO schemas are always shown as text, never as markup.
Expand Down
58 changes: 56 additions & 2 deletions packages/ecc-client-ga4gh-wes/scripts/sync-io-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
* - `src/io-schema/profile.ts`: the meta-schema and its vocabularies, with
* the commit and the version of the profile;
* - `src/io-schema/tests/fixtures/*.ts`: the conformance suite, the test
* vectors (file reference values, engine bindings, workflow URLs and TRS
* files) and the example schemas, for the tests and the demos.
* vectors (file reference values, engine bindings, workflow URLs, TRS
* files and outputs of runs) and the example schemas, for the tests and
* the demos.
*
* Usage, from the package directory:
*
Expand Down Expand Up @@ -173,6 +174,59 @@ export const WES_PARAMS_CASES: WesParamsCase[] = ${json(
`
);

/**
* The cases of `tests/vectors/<kind>/<case>/`, each with its JSON files by
* name (without `.json`), sorted by name.
*/
const flatCaseDirectories = (kind) =>
readdirSync(path.join(checkout, "tests", "vectors", kind), {
withFileTypes: true,
})
.filter((entry) => entry.isDirectory())
.map((entry) => entry.name)
.sort()
.map((name) => {
const files = {};
const at = ["tests", "vectors", kind, name];
for (const file of readdirSync(path.join(checkout, ...at))
.filter((entry) => entry.endsWith(".json"))
.sort()) {
files[file.replace(/\.json$/, "")] = readJson(...at, file);
}
return { name, ...files };
});

write(
"src/io-schema/tests/fixtures/wes-outputs.ts",
`${header(
"Test vectors of the output normaliser (`tests/vectors/wes-outputs/`)."
)}
export interface WesOutputsCase {
name: string;
schema: Record<string, unknown>;
run_log: Record<string, unknown>;
options?: { outputDir?: string; localDir?: string; files?: unknown[] };
/** The expected result, or else \`error\` */
expected?: {
description: string;
conformance: string;
outputs: Record<string, unknown>;
removed?: string[];
ambiguous?: Record<string, string[]>;
unconverted?: string[];
undeclared?: string[];
unmatchedFiles?: string[];
skippedFiles?: unknown[];
};
error?: Record<string, unknown>;
}

export const WES_OUTPUTS_CASES: WesOutputsCase[] = ${json(
flatCaseDirectories("wes-outputs")
)};
`
);

write(
"src/io-schema/tests/fixtures/trs.ts",
`${header(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@ import ECCClientGa4ghWesRunOutput from "./run-output.js";
export * from "./run-output.js";
export default ECCClientGa4ghWesRunOutput;

// Define the custom element
customElements.define(
"ecc-client-ga4gh-wes-run-output",
ECCClientGa4ghWesRunOutput
);
/**
* Defines the custom element `ecc-client-ga4gh-wes-run-output`, only in
* browsers and only once: if it is defined already (e.g. by another copy of
* this module in a second bundle), nothing happens.
*/
export function defineRunOutput(): void {
if (
typeof window !== "undefined" &&
window.customElements &&
!window.customElements.get("ecc-client-ga4gh-wes-run-output")
) {
window.customElements.define(
"ecc-client-ga4gh-wes-run-output",
ECCClientGa4ghWesRunOutput
);
}
}

defineRunOutput();

declare global {
interface HTMLElementTagNameMap {
Expand Down
Loading
Loading