Add step exclusion support to wizard navigation#2394
Closed
ravikiranvm wants to merge 1 commit into
Closed
Conversation
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>
|
Contributor
There was a problem hiding this comment.
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-pointnextStep/conditional.onFailure.skipToStepto the next surviving step. - Extends
resolveWizardNavigationwith an optionalexcludedStepIdsargument and applies filtering before navigation/progress calculation. - Extends the shared
WizardRequestschema with an optionaltemplateIdfield 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; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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
filterWizardConfig(config, excludedStepIds)inpackages/server/api/src/app/wizard/wizard-config-filter.ts: removes excluded steps from a provider wizard config and transitively re-pointsnextStep/ conditionalonFailure.skipToStepreferences 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.resolveWizardNavigationgains an optionalexcludedStepIdsparameter and filters the provider config before navigating — step progress counts follow automatically.WizardRequestgains an optionaltemplateIdfield (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
resolveWizardNavigationwith 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.tshave drifted between this repo and the enterprise repo (the enterprise version carries aNextStepResolution/isCompleterefactor). This PR deliberately does not include that refactor — one test assertion was adapted to this repo's response shape (nextStep === nullas 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-apiclean;sharedandserver-apibuild successfully.Visual Changes (if applicable)
None — no behavior change for any existing caller.