Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 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
4f35799
Merge feat/io-schema into feat/io-run-request-proposal
uniqueg Dec 4, 2026
06e7033
test(wes): check deciding locations under '#' names
uniqueg Dec 4, 2026
667f54c
fix(wes): guard schema-mode submissions
uniqueg Dec 4, 2026
4d95ecc
fix(wes): refuse conflicting parameter names
uniqueg Dec 4, 2026
9a44203
docs(wes): document schema-mode checks and events
uniqueg Dec 4, 2026
423579e
docs(wes): name the builder's reference limits
uniqueg Dec 4, 2026
12a2282
refactor(wes): move TrsToolVersionRef to trs.ts
uniqueg Dec 4, 2026
8841799
fix(wes): show service-info loading as a note
uniqueg Dec 5, 2026
ca3b63e
docs(wes): add an HTML example of schema mode
uniqueg Dec 5, 2026
aff7c81
fix(wes): keep submissions to their context
uniqueg Dec 5, 2026
cad6fa1
fix(wes): bound value depth, check profile type
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-requests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@elixir-cloud/wes": minor
---

Build WES run requests from GA4GH IO Schemas: `ecc-client-ga4gh-wes-run-create` gains a schema mode (`ioSchema`, `trsToolVersion`, `engineProfile`, `allowedSchemes`) that shows the workflow's input form and submits the request built by the profile's engine bindings; the raw mode keeps its fields and API, and both modes submit once per click and ignore the `service-info` of a replaced provider. `@elixir-cloud/wes/utils` exports the builder (`toWorkflowParams`, `buildRunRequest`), `unsupportedBy` (a service's `service-info` against the workflow), TRS helpers (`trsDescriptorUrl`, `findSchemaFile`, `findPrimaryDescriptorPath`) and `conquestEngineProfile`, with the types `EngineBinding`, `TranslationOptions`, `RunRequestOptions`, `SchemaFile`, `EngineProfile`, `EngineProfileContext` and `TrsToolVersionRef`; the builder's errors are `TranslationError`s, and `getBinding` reads a schema's workflow block. The IO schema check gains an optional `validateAt` (`SubschemaValidator`) for the subschemas that decide which schemas apply.
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React, { useMemo, useState } from 'react';
import { ECCClientGa4ghWesRunCreate } from '@elixir-cloud/wes/react';
import type { RunRequest, WesProvider } from '@elixir-cloud/wes/providers';
import PreviewLayout from '@/components/common/PreviewLayout';
import { ioFormExamples } from '@/components/packages/wes/ioFormExamples';

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

/** A TRS tool version for each example (made up, nothing is fetched). */
const trsToolVersion = (example: string) => ({
trsUrl: 'https://trs.example.org/ga4gh/trs/v2',
toolId: example,
versionId: '1.0.0',
descriptorTypeVersions: ['DSL2', '8', 'v1.2', '1.1'],
});

/**
* A provider that runs nothing: it says that it runs every workflow type
* and shows the request that the component would submit.
*/
class DryRunProvider implements WesProvider {
private show: (request: RunRequest) => void;

constructor(show: (request: RunRequest) => void) {
this.show = show;
}

async getServiceInfo() {
const all = { workflow_type_version: [] as string[] };
return {
workflow_type_versions: { NFL: all, SMK: all, WDL: all, CWL: all },
supported_wes_versions: ['1.1.0'],
supported_filesystem_protocols: allowedSchemes,
workflow_engine_versions: {},
default_workflow_engine_parameters: [],
system_state_counts: {},
};
}

async runWorkflow(request: RunRequest) {
this.show(request);
return { run_id: 'dry-run' };
}

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

async getRunLog(): Promise<never> {
throw new Error('A dry run has no runs.');
}

async getRunStatus(): Promise<never> {
throw new Error('A dry run has no runs.');
}

async cancelRun(): Promise<never> {
throw new Error('A dry run has no runs.');
}
}

export default function RunCreateSchemaPreview() {
const [example, setExample] = useState('greetings-nextflow');
const [request, setRequest] = useState<RunRequest | null>(null);
const provider = useMemo(() => new DryRunProvider(setRequest), []);

return (
<PreviewLayout>
<div className='flex w-full flex-col gap-4'>
<label className='flex items-center gap-2 text-sm'>
Example
<select
className='rounded-md border px-2 py-1'
value={example}
onChange={(e) => {
setRequest(null);
setExample(e.target.value);
}}
>
{Object.entries(ioFormExamples).map(([key, { label }]) => (
<option key={key} value={key}>
{label}
</option>
))}
</select>
</label>
<ECCClientGa4ghWesRunCreate
key={example}
provider={provider}
ioSchema={ioFormExamples[example].schema}
trsToolVersion={trsToolVersion(example)}
allowedSchemes={allowedSchemes}
/>
{request && (
<pre className='overflow-auto rounded-md bg-muted p-3 text-xs'>
{JSON.stringify(request, null, 2)}
</pre>
)}
</div>
</PreviewLayout>
);
}
98 changes: 92 additions & 6 deletions apps/documentation/pages/docs/wes/components/run-create.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Tabs } from 'nextra/components'
import ComponentName from '@/components/common/ComponentName'
import RunCreatePreview from '@/components/packages/wes/RunCreatePreview'
import RunCreateSchemaPreview from '@/components/packages/wes/RunCreateSchemaPreview'

# EccClientGa4ghWesRunCreate Component

Expand All @@ -12,7 +13,10 @@ import RunCreatePreview from '@/components/packages/wes/RunCreatePreview'

## Overview

The `ecc-client-ga4gh-wes-run-create` component provides a form for submitting new workflow runs to a WES endpoint.
The `ecc-client-ga4gh-wes-run-create` component provides a form for submitting new workflow runs to a WES endpoint. It has two modes:

- **Raw mode** (default): the user enters the workflow URL, type, version and `workflow_params` as JSON.
- **Schema mode** (with `ioSchema` and `trsToolVersion`): the user fills in the input form of the workflow's [I/O Schema](/docs/wes/io-schema) instead, and the component builds the run request from the schema, the values and the TRS tool version (see [Run requests](/docs/wes/io-schema#run-requests)).

## Usage

Expand Down Expand Up @@ -71,15 +75,97 @@ This example shows the basic form for creating a new workflow run.
</Tabs.Tab>
</Tabs>

### Schema mode

With an IO schema and the TRS tool version to run, the form shows the workflow's inputs ([`ecc-client-ga4gh-wes-io-form`](./io-form)) instead of the raw fields, and the workflow that will run: its type and language version (from the schema's `x-ga4gh-workflow`, else the first version of the TRS tool version that the service runs, else the first version of the TRS tool version) and the workflow URL (the plain primary descriptor in TRS). It says when the WES service doesn't run the workflow's type or version (from its `service-info`; if that can't be loaded, schema mode doesn't submit), and submits only valid values. When `ioSchema` is replaced, the values of the old form are dropped and the run can be submitted once the new form has valid values. A new `provider` object loads `service-info` again (giving up after `serviceInfoTimeout`) and blocks submission until it arrives, so keep the provider stable (e.g. `useMemo` in React). The I/O form element is loaded on demand; if it can't be loaded, the error shows in the form's error area.

On submit, the values are translated into `workflow_params` by the profile's engine binding for the descriptor type (`NFL`, `SMK`, `WDL`, `CWL`); values that the binding refuses (e.g. a file reference with a scheme that isn't allowed) are shown as `<JSON Pointer>: <message>`, and `ecc-run-create-failed` is fired with that text. The engine parameters (a JSON object of strings), tags (unique keys) and attachments of the advanced section are added; each click submits one run. If the schema, the TRS tool version, the engine profile, the allowed schemes or the provider change while a run is prepared, nothing is submitted (and a run submitted meanwhile doesn't reset the replaced form). An `engineProfile` then adapts the request to a particular WES server.

This preview uses a provider that submits nothing and shows the request instead:

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

<Tabs.Tab>
```tsx showLineNumbers copy filename="run-create-schema.tsx"
import React from 'react';
import { ECCClientGa4ghWesRunCreate } from '@elixir-cloud/wes/react';
import { RestWesProvider } from '@elixir-cloud/wes/providers';

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

return (
<ECCClientGa4ghWesRunCreate
provider={provider}
ioSchema={schema}
trsToolVersion={{
trsUrl: 'https://trs.example.org/ga4gh/trs/v2',
toolId: 'greetings',
versionId: '1.0.0',
primaryDescriptorPath: 'main.nf',
descriptorTypeVersions: ['DSL2'],
}}
/>
);
}
```
</Tabs.Tab>
<Tabs.Tab>
```html showLineNumbers copy filename="run-create-schema.html"
<!DOCTYPE html>
<html>
<body>
<ecc-client-ga4gh-wes-run-create allowed-schemes="drs https">
</ecc-client-ga4gh-wes-run-create>

<script type="module">
import { RestWesProvider } from 'https://esm.sh/@elixir-cloud/wes@2.0.0-alpha.1/providers';

const element = document.querySelector('ecc-client-ga4gh-wes-run-create');
element.provider = new RestWesProvider(
'https://wes.example.com/ga4gh/wes/v1'
);
// The IO schema of the tool version, e.g. fetched from TRS
element.ioSchema = await (await fetch('ga4gh-io.schema.json')).json();
element.trsToolVersion = {
trsUrl: 'https://trs.example.org/ga4gh/trs/v2',
toolId: 'greetings',
versionId: '1.0.0',
primaryDescriptorPath: 'main.nf',
descriptorTypeVersions: ['DSL2'],
};
</script>
</body>
</html>
```
</Tabs.Tab>
</Tabs>

#### Engine profiles

Some WES servers need more than the profile's binding gives. An engine profile (`EngineProfile` from `@elixir-cloud/wes/utils`) takes the built request and returns the request for one server; it is kept out of the generic builder. The package has one:

- `conquestEngineProfile`: [Conquest](https://github.com/elixir-cloud-aai/conquest) runs workflows from public GitHub repositories at a full commit SHA. The profile sets `workflow_url` to the repository and adds the engine parameters `revision` and the path of the main workflow file (`main_script` for Nextflow, `snakefile` for Snakemake, `main_workflow_path` for WDL), all taken from `trsToolVersion.primaryDescriptorUrl`: the `url` of the TRS descriptor, a `raw.githubusercontent.com` or `github.com/.../blob/...` URL at a commit. It refuses CWL, branches and tags, and a request whose `workflow_type` isn't the context's descriptor type.

## Properties

| Property | Type | Default | Description |
|------------|---------------------------|---------|--------------------------------------------------------------------------------|
| `provider` | `WesProvider` | `null` | Data provider for submitting the run (see [Providers](/docs/wes/providers)) |
| Property | Type | Default | Description |
|------------------|---------------------|--------------------|-------------|
| `provider` | `WesProvider` | `null` | Data provider for submitting the run (see [Providers](/docs/wes/providers)) |
| `ioSchema` | `object` | `undefined` | An IO schema (GA4GH IO Schema Profile 0.3.0); switches to schema mode |
| `trsToolVersion` | `TrsToolVersionRef` | `undefined` | The TRS tool version to run in schema mode: `trsUrl`, `toolId`, `versionId`, and optionally `primaryDescriptorPath` (as TRS lists it; else the schema's `primary_descriptor_path`), `descriptorTypeVersions` (of the tool version) and `primaryDescriptorUrl` (for engine profiles) |
| `engineProfile` | `EngineProfile` | `undefined` | Adapts the built request to a WES server, e.g. `conquestEngineProfile` |
| `serviceInfoTimeout` | `number` | `30000` | Milliseconds to wait for the service's `service-info` before reporting it as not loaded; attribute `service-info-timeout` |
| `allowedSchemes` | `string[]` | `['drs', 'https']` | URI schemes that file references may have in schema mode, in the I/O form and in the built request; attribute `allowed-schemes`, separated by spaces or commas, in any case |

## Events

| Event Name | React Event Name | Detail Type | Description |
|------------------------|------------------------|--------------------------------|------------------------------------------------|
| `ecc-run-submitted` | `onEccRunSubmitted` | `{ runId: string }` | Fired when a workflow run is successfully submitted. |
| `ecc-run-create-failed` | `onEccRunCreateFailed` | `Error` | Fired when run submission fails. |
| `ecc-run-submitted` | `onEccRunSubmitted` | `{ runId: string, request: RunRequest }` | Fired when a workflow run is successfully submitted, with the submitted request. |
| `ecc-run-create-failed` | `onEccRunCreateFailed` | `{ error: string }` | Fired when run submission fails; in schema mode, values that the binding refuses come as `<JSON Pointer>: <message>` (`/` for the root). |
26 changes: 25 additions & 1 deletion apps/documentation/pages/docs/wes/io-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The WES components understand the [GA4GH IO Schema Profile](https://github.com/e

## Profile version

The package supports version **0.3.0** of the profile, pinned at commit [`2c3dc49`](https://github.com/elixir-cloud-aai/ga4gh-io-schema/tree/2c3dc49ad89f0a556272f160369a2a2d7a21dac3). Its meta-schema and vocabularies are bundled with the package; `scripts/sync-io-schema.mjs` in the package copies them, the conformance suite and the example schemas from a checkout of the profile's repository at the pinned commit.
The package supports version **0.3.0** of the profile, pinned at commit [`2c3dc49`](https://github.com/elixir-cloud-aai/ga4gh-io-schema/tree/2c3dc49ad89f0a556272f160369a2a2d7a21dac3). Its meta-schema and vocabularies are bundled with the package; `scripts/sync-io-schema.mjs` in the package copies them, the conformance suite, the test vectors and the example schemas from a checkout of the profile's repository at the pinned commit.

## Checks

Expand Down Expand Up @@ -51,6 +51,30 @@ JSON Schema can't check the values of file references (`x-ga4gh-file`), so the c

Outputs must be absolute URIs. The checks pass the profile's test vectors for file reference values (`tests/vectors/file-values`).

## Run requests

`@elixir-cloud/wes/utils` builds WES run requests from input values by the profile's [engine bindings](https://ga4gh-io-schema.readthedocs.io/en/latest/specification/engine-bindings/), which [`ecc-client-ga4gh-wes-run-create`](./components/run-create#schema-mode) uses in schema mode:

```typescript
import {
buildRunRequest,
findPrimaryDescriptorPath,
trsDescriptorUrl,
} from '@elixir-cloud/wes/utils';

const request = await buildRunRequest(schema, values, {
workflowUrl: trsDescriptorUrl(trsUrl, toolId, versionId, 'NFL', findPrimaryDescriptorPath(files)),
binding: { descriptorTypeVersion: 'DSL2' }, // only if the schema has none
});
```

- `toWorkflowParams()` checks the schema, validates the values against `inputs`, checks every file reference value, and translates the values for the descriptor type: unqualified names for `NFL` and `SMK`, names qualified with the entry point for `WDL`, `File` and `Directory` objects for CWL file values. Inputs are renamed by `x-ga4gh-parameter` (schemas of one input that name different parameters are refused); defaults of the schema are never inserted. Values that Nextflow or the CWL loader would change (`${`, keys with `-` for Nextflow; `File` objects, keys with `$` or `:` for CWL) are refused. Values nested more than 64 levels deep are refused. Errors are `TranslationError`s with the JSON Pointer of the value.
- `buildRunRequest()` adds `workflow_type`, `workflow_type_version` and `workflow_url` (for CWL, with the entry point as its fragment). Tags and engine parameters are left to the caller and to [engine profiles](./components/run-create#engine-profiles).
- `trsDescriptorUrl()`, `findPrimaryDescriptorPath()` and `findSchemaFile()` give the workflow URL of a TRS tool version and find its IO schema among its files.
- `unsupportedBy()` says whether a WES service runs a binding's type and version, by its `service-info`.

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.

## Descriptions

Titles, descriptions and `enum` values of IO schemas are always shown as text, never as markup.
Expand Down
86 changes: 84 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,8 @@
* - `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 of file reference values and the example schemas, for the tests
* and the demos.
* vectors (file reference values, engine bindings, workflow URLs and TRS
* files) and the example schemas, for the tests and the demos.
*
* Usage, from the package directory:
*
Expand Down Expand Up @@ -125,6 +125,88 @@ export const FILE_VALUE_CASES: FileValueCase[] = ${json(
`
);

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

write(
"src/io-schema/tests/fixtures/wes-params.ts",
`${header(
"Test vectors of the engine bindings (`tests/vectors/wes-params/`)."
)}
export interface WesParamsCase {
descriptorType: string;
name: string;
schema: Record<string, unknown>;
values: unknown;
/** The expected \`workflow_params\`, or else \`error\` */
workflow_params?: Record<string, unknown>;
error?: { pointer: string };
options?: { allowedSchemes?: string[]; allowAbsolutePaths?: boolean };
}

export const WES_PARAMS_CASES: WesParamsCase[] = ${json(
caseDirectories("wes-params")
)};
`
);

write(
"src/io-schema/tests/fixtures/trs.ts",
`${header(
"Test vectors of workflow URLs and TRS files (`tests/vectors/workflow-urls/`, `tests/vectors/trs-files/`)."
)}
export interface WorkflowUrlCase {
name: string;
trsUrl: string;
toolId: string;
versionId: string;
descriptorType: string;
primaryDescriptorPath?: string;
workflowUrl?: string;
error?: boolean;
imports?: { reference: string; url: string }[];
}

export interface TrsFilesCase {
name: string;
files: unknown;
schemaFile: { path: string; file_type: string } | null;
primaryDescriptorPath?: string | null;
}

export const WORKFLOW_URL_CASES: WorkflowUrlCase[] = ${json(
readJson("tests", "vectors", "workflow-urls", "cases.json")
)};

export const TRS_FILES_CASES: TrsFilesCase[] = ${json(
readJson("tests", "vectors", "trs-files", "cases.json")
)};
`
);

const examples = {
example_tool: readJson("tests", "data", "example_tool.schema.json"),
example_wdl: readJson("tests", "data", "example_wdl.schema.json"),
Expand Down
Loading
Loading