Skip to content

Add step exclusion support to wizard navigation#2394

Closed
ravikiranvm wants to merge 1 commit into
mainfrom
wizard-step-exclusion-support
Closed

Add step exclusion support to wizard navigation#2394
ravikiranvm wants to merge 1 commit into
mainfrom
wizard-step-exclusion-support

Conversation

@ravikiranvm

@ravikiranvm ravikiranvm commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Part of OPS-4615

Adds optional step-exclusion support to the shared wizard navigation service, keeping the open-source wizard code in sync with downstream usage where certain provider wizard steps do not apply to a given use case.

What changed

  • New pure filterWizardConfig(config, excludedStepIds) in packages/server/api/src/app/wizard/wizard-config-filter.ts: removes excluded steps from a provider wizard config and transitively re-points nextStep / conditional onFailure.skipToStep references at each excluded step's surviving successor. Validates that excluded ids exist and that at least one step survives. Returns the input config by reference when there is nothing to exclude.
  • resolveWizardNavigation gains an optional excludedStepIds parameter and filters the provider config before navigating — step progress counts follow automatically.
  • WizardRequest gains an optional templateId field (schema parity with downstream; unused by the Benchmark controller, which does not forward it).

Why

Downstream, some wizard consumers need to skip provider steps that a specific configuration cannot honor. The filtering belongs in the shared navigation service so the step chain, conditional jumps, and progress stay consistent. Everything is opt-in: Benchmark behavior is unchanged — it calls resolveWizardNavigation with the original arity, which takes a fast path returning the provider config untouched.

Note on repo parity

While porting, we noticed wizard.service.ts / wizard-response.ts have drifted between this repo and the enterprise repo (the enterprise version carries a NextStepResolution/isComplete refactor). This PR deliberately does not include that refactor — one test assertion was adapted to this repo's response shape (nextStep === null as the completion signal). Reconciling the drift is left as a separate decision.

Testing Checklist

Check all that apply:

  • I tested the feature thoroughly, including edge cases

  • I verified all affected areas still work as expected

  • Automated tests were added/updated if necessary

  • Changes are backwards compatible with any existing data, otherwise a migration script is provided

Testing notes: 7 unit tests for filterWizardConfig (tail/middle/first-step exclusion, transitive re-pointing through consecutive exclusions, input immutability, unknown-id and exclude-everything validation) and 3 navigation tests in the Benchmark wizard suite (tail-step exclusion completes the wizard, middle-step exclusion re-points, empty array behaves like omitted). npx nx lint server-api clean; shared and server-api build successfully.

Visual Changes (if applicable)

None — no behavior change for any existing caller.

Allow callers of resolveWizardNavigation to exclude provider wizard
steps: a new pure filterWizardConfig removes excluded steps and
re-points nextStep and conditional skipToStep references at each
excluded step's surviving successor. The parameter is optional and
defaults to no exclusions, so existing callers (Benchmark) are
unaffected. WizardRequest gains an optional templateId field for
parity with the enterprise repo's request schema.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 10, 2026 07:17
@sonarqubecloud

Copy link
Copy Markdown

@linear

linear Bot commented Jul 10, 2026

Copy link
Copy Markdown

OPS-4615

Copilot AI 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.

Pull request overview

Adds opt-in “step exclusion” support to the server-side wizard navigation so callers can remove provider wizard steps (and keep navigation/progress consistent) without changing the underlying provider configs.

Changes:

  • Introduces filterWizardConfig(config, excludedStepIds) to remove excluded steps and re-point nextStep / conditional.onFailure.skipToStep to the next surviving step.
  • Extends resolveWizardNavigation with an optional excludedStepIds argument and applies filtering before navigation/progress calculation.
  • Extends the shared WizardRequest schema with an optional templateId field for parity with downstream callers.

Blocking

None

Non-blocking

  • Add a unit test covering multi-hop consecutive exclusions to lock in the transitive “follow excluded chain” behavior (see PR comment).

Merge recommendation

Merge after addressing non-blocking comments

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/shared/src/lib/wizard/wizard-request.ts Adds optional templateId to the shared wizard request schema.
packages/server/api/src/app/wizard/wizard-config-filter.ts New pure config filter that removes excluded steps and re-links navigation pointers.
packages/server/api/src/app/wizard/wizard.service.ts Adds optional excludedStepIds parameter and filters config before navigation.
packages/server/api/test/unit/wizard/wizard-config-filter.test.ts Adds unit tests validating filtering behavior and immutability.
packages/server/api/test/unit/benchmark/wizard.service.test.ts Adds navigation tests ensuring exclusions affect next-step resolution and progress counts.

Comment on lines +31 to +38
// Follow the nextStep chain through excluded steps to the first survivor.
const resolveSurvivor = (id: string | undefined): string | undefined => {
let current = id;
while (current !== undefined && excluded.has(current)) {
current = stepById.get(current)?.nextStep;
}
return current;
};
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.

2 participants