Skip to content

[orchestrator] Backport orchestrator fixes and enhancements to 1.9 #2669

Merged
karthikjeeyar merged 1 commit into
workspace/orchestratorfrom
orchestrator-1.9-backport
Apr 1, 2026
Merged

[orchestrator] Backport orchestrator fixes and enhancements to 1.9 #2669
karthikjeeyar merged 1 commit into
workspace/orchestratorfrom
orchestrator-1.9-backport

Conversation

@karthikjeeyar

Copy link
Copy Markdown
Member

Hey, I just made a Pull Request!

Cherrypick of below PR's

#2654
#2602
#2653
#2570

Summary

  1. Backport Execute Workflow query param prefill
  2. Backport async validation scoping to active step
  3. Backport ui:hidden preservation for object properties
  4. Backport schema-defaults initialization for form data

…2666)

* feat(orchestrator): pre-populate Execute Workflow form from URL query params (#2570)

* prepopulate workflow execution page form from URL query params

Signed-off-by: Karthik <karthik.jk11@gmail.com>

* support enum coercison for case-insenstive match and skip invalid values

* add support for fields that are defined via '$ref'

* add full support for json schema fields

---------

Signed-off-by: Karthik <karthik.jk11@gmail.com>

* fix(orchestrator-form-react): scope async validation to active step (#2602)

* fix(orchestrator-form-react): scope async validation to active step

Limit validate:url requests to the active step during multi-step navigation.

Made-with: Cursor

* fix(orchestrator-form-react): keep full formData for async validation

Pass full formData to template evaluation while scoping uiSchema traversal.

Made-with: Cursor

* fix(orchestrator-form-react): preserve ui:hidden on objects with properties (#2653)

* fix(orchestrator): honor json schema defaults in initial formData (#2654)

* fix(orchestrator): honor json schema defaults

Ensure extractStaticDefaults falls back to JSON Schema defaults when ui:props fetch:response:default is absent so initial formData includes schema defaults.

Made-with: Cursor

* chore(changeset): document schema default fix

Add changeset for orchestrator form defaults update.

Made-with: Cursor

* fix(orchestrator): handle root defaults

Avoid setting an empty key for root schema defaults and add tests to cover root default handling.

Made-with: Cursor

* fix(orchestrator): document and test defaults

Clarify extractStaticDefaults precedence in docs and add test coverage for default handling.

Made-with: Cursor

* chore(orchestrator): update yarn.lock after backport

Made-with: Cursor

---------

Signed-off-by: Karthik <karthik.jk11@gmail.com>
Co-authored-by: Karthik Jeeyar <karthik@redhat.com>
@rhdh-qodo-merge

Copy link
Copy Markdown

Review Summary by Qodo

Backport orchestrator fixes and enhancements to 1.9

✨ Enhancement 🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Pre-populate Execute Workflow form from URL query parameters with full schema support
• Scope async validation to active step in multi-step forms
• Honor JSON Schema defaults in initial form data
• Preserve ui:hidden on object properties with nested fields
Diagram
flowchart LR
  A["URL Query Parameters"] -->|"mergeQueryParamsIntoFormData"| B["Form Data"]
  C["JSON Schema"] -->|"extractStaticDefaults"| B
  B -->|"generateUiSchema"| D["UI Schema"]
  D -->|"preserves ui:hidden"| E["Rendered Form"]
  F["Multi-step Form"] -->|"scoped validation"| G["Active Step Only"]
Loading

Grey Divider

File Changes

1. workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts ✨ Enhancement +303/-0

New query parameter to form data conversion utility

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts


2. workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.test.ts 🧪 Tests +650/-0

Comprehensive test suite for query param merging

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.test.ts


3. workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx ✨ Enhancement +9/-1

Integrate query param prepopulation into workflow execution

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/ExecuteWorkflowPage.tsx


View more (11)
4. workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/extractStaticDefaults.ts ✨ Enhancement +26/-7

Support JSON Schema defaults fallback mechanism

workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/extractStaticDefaults.ts


5. workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/extractStaticDefaults.test.ts 🧪 Tests +119/-0

Test coverage for schema defaults extraction

workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/extractStaticDefaults.test.ts


6. workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/generateUiSchema.ts 🐞 Bug fix +1/-0

Preserve ui directives on object nodes with properties

workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/generateUiSchema.ts


7. workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/generateUiSchema.test.ts 🧪 Tests +23/-0

Test ui:hidden preservation on nested objects

workspaces/orchestrator/plugins/orchestrator-form-react/src/utils/generateUiSchema.test.ts


8. workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx 🐞 Bug fix +12/-1

Scope async validation errors to active step

workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx


9. workspaces/orchestrator/plugins/orchestrator/package.json Dependencies +1/-0

Add json-schema-library dependency for schema resolution

workspaces/orchestrator/plugins/orchestrator/package.json


10. workspaces/orchestrator/.changeset/honor-schema-defaults.md 📝 Documentation +6/-0

Changeset for schema defaults feature

workspaces/orchestrator/.changeset/honor-schema-defaults.md


11. workspaces/orchestrator/.changeset/scope-async-validation-to-step.md 📝 Documentation +5/-0

Changeset for async validation scoping fix

workspaces/orchestrator/.changeset/scope-async-validation-to-step.md


12. workspaces/orchestrator/.changeset/tall-games-fail.md 📝 Documentation +5/-0

Changeset for query param prepopulation feature

workspaces/orchestrator/.changeset/tall-games-fail.md


13. workspaces/orchestrator/.changeset/unlucky-poems-drum.md 📝 Documentation +5/-0

Changeset for ui:hidden preservation fix

workspaces/orchestrator/.changeset/unlucky-poems-drum.md


14. workspaces/orchestrator/docs/user-interface.md 📝 Documentation +46/-0

Document Execute Workflow form prepopulation feature

workspaces/orchestrator/docs/user-interface.md


Grey Divider

Qodo Logo

@rhdh-qodo-merge

rhdh-qodo-merge Bot commented Apr 1, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX Issues (0)

Grey Divider


Action required

1. allOf query prefill skipped 🐞 Bug ≡ Correctness
Description
mergeQueryParamsIntoFormData can never prepopulate fields defined under an allOf-only schema
node because pathExistsInSchema only branches for oneOf/anyOf and otherwise requires
properties. This causes valid draft-07 schemas composed via allOf to be ignored during URL
prepopulation despite the documented “full JSON Schema draft-07” support.
Code

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[R59-86]

+function pathExistsInSchema(
+  schema: JSONSchema7,
+  path: string,
+  root: JSONSchema7,
+): boolean {
+  if (!path) return true;
+  let s: JSONSchema7 | undefined = schema;
+  const parts = path.split('.');
+
+  for (let i = 0; i < parts.length; i++) {
+    const part = parts[i];
+    if (!s || typeof s === 'boolean') return false;
+    if (s.$ref) {
+      s = resolveRef(root, s.$ref);
+      i--;
+      continue;
+    }
+    if (s.oneOf || s.anyOf) {
+      const remaining = parts.slice(i).join('.');
+      return pathExistsInComposite(s, remaining, root);
+    }
+    const props = s.properties;
+    if (!props || typeof props !== 'object') return false;
+    if (!(part in props)) return false;
+    s = props[part] as JSONSchema7;
+  }
+  return true;
+}
Evidence
pathExistsInSchema does not treat allOf as a composite unless oneOf/anyOf are present, so
schemas that use allOf without direct properties will return false for valid paths. Since
mergeQueryParamsIntoFormData hard-gates on pathExistsInSchema before calling
json-schema-library resolution, these valid paths are skipped and never coerced/merged,
conflicting with the docs’ stated support.

workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[55-86]
workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[272-299]
workspaces/orchestrator/docs/user-interface.md[34-42]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`mergeQueryParamsIntoFormData` skips query params for schemas that use `allOf` composition without inline `properties` because `pathExistsInSchema` only treats `oneOf/anyOf` as composites and otherwise requires `properties`.

### Issue Context
The implementation already uses `json-schema-library` (`getSchemaAtPath`) which can resolve `allOf` (and other composition/conditionals) using the proposed data. The manual `pathExistsInSchema` pre-check is therefore both redundant and currently incorrect for `allOf`-only composition.

### Fix Focus Areas
- workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[59-109]
- workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[272-299]

### Recommended fix
Either:
1) Update `pathExistsInSchema` to treat `allOf` the same way as `oneOf/anyOf` (call `pathExistsInComposite` when `s.allOf` is present), and consider adding coverage for other composition-only nodes if you want the pre-check to match the “draft-07” claim.

OR (simpler and less error-prone):
2) Remove the `pathExistsInSchema(...)` gate and rely on `getSchemaAtPath(...)` returning `undefined` for unknown paths.

### Tests
Add a unit test showing that a schema like:
```ts
{ type: 'object', allOf: [{ type: 'object', properties: { language: { type: 'string' } } }] }
```
correctly prepopulates `?language=English`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@sonarqubecloud

sonarqubecloud Bot commented Apr 1, 2026

Copy link
Copy Markdown

@lokanandaprabhu lokanandaprabhu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Apr 1, 2026
@karthikjeeyar karthikjeeyar merged commit 223663b into workspace/orchestrator Apr 1, 2026
19 checks passed
Comment on lines +59 to +86
function pathExistsInSchema(
schema: JSONSchema7,
path: string,
root: JSONSchema7,
): boolean {
if (!path) return true;
let s: JSONSchema7 | undefined = schema;
const parts = path.split('.');

for (let i = 0; i < parts.length; i++) {
const part = parts[i];
if (!s || typeof s === 'boolean') return false;
if (s.$ref) {
s = resolveRef(root, s.$ref);
i--;
continue;
}
if (s.oneOf || s.anyOf) {
const remaining = parts.slice(i).join('.');
return pathExistsInComposite(s, remaining, root);
}
const props = s.properties;
if (!props || typeof props !== 'object') return false;
if (!(part in props)) return false;
s = props[part] as JSONSchema7;
}
return true;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Allof query prefill skipped 🐞 Bug ≡ Correctness

mergeQueryParamsIntoFormData can never prepopulate fields defined under an allOf-only schema
node because pathExistsInSchema only branches for oneOf/anyOf and otherwise requires
properties. This causes valid draft-07 schemas composed via allOf to be ignored during URL
prepopulation despite the documented “full JSON Schema draft-07” support.
Agent Prompt
### Issue description
`mergeQueryParamsIntoFormData` skips query params for schemas that use `allOf` composition without inline `properties` because `pathExistsInSchema` only treats `oneOf/anyOf` as composites and otherwise requires `properties`.

### Issue Context
The implementation already uses `json-schema-library` (`getSchemaAtPath`) which can resolve `allOf` (and other composition/conditionals) using the proposed data. The manual `pathExistsInSchema` pre-check is therefore both redundant and currently incorrect for `allOf`-only composition.

### Fix Focus Areas
- workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[59-109]
- workspaces/orchestrator/plugins/orchestrator/src/components/ExecuteWorkflowPage/queryParamsToFormData.ts[272-299]

### Recommended fix
Either:
1) Update `pathExistsInSchema` to treat `allOf` the same way as `oneOf/anyOf` (call `pathExistsInComposite` when `s.allOf` is present), and consider adding coverage for other composition-only nodes if you want the pre-check to match the “draft-07” claim.

OR (simpler and less error-prone):
2) Remove the `pathExistsInSchema(...)` gate and rely on `getSchemaAtPath(...)` returning `undefined` for unknown paths.

### Tests
Add a unit test showing that a schema like:
```ts
{ type: 'object', allOf: [{ type: 'object', properties: { language: { type: 'string' } } }] }
```
correctly prepopulates `?language=English`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants