Give the support inspector a stable walk through nested conditions
The support inspector duplicates recursive loops for a tree outline, field usage report, and copyable diagnostics. These loops disagree on child order and sometimes skip a nested condition.
- Focused work estimate
- 2h + prerequisites
- Priority in the scenario
- Medium
- Engineering practice
- Iteration · Tree traversal · Resource bounds
Estimated field mix
- Compiler and language tooling60%
- Developer tooling40%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Pattern topics
- IteratorApply
Provide a shared traversal contract for independent tree consumers without exposing the representation or coupling their presentation logic.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional fulfillment product routes parcels using destination zone, weight in grams, and service level. Its next release needs nested eligibility rules, but arbitrary customer scripts are out of scope. Create a local TypeScript baseline and synthetic parcel/rule fixtures; no starter repository or fixtures are supplied. Keep parsing and evaluation in a local practice application with no network, filesystem, or host-code expressions in the language.
Setup prerequisites
- Recursive data structures
- Parser error handling
- Discriminated unions
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
Acceptance criteria
- Expose a read-only depth-first iterator that yields each node once with a stable path and parent path.
- The outline and field usage report consume the same traversal contract while retaining their own presentation rules.
- Early termination releases traversal state, and malformed cycles are rejected instead of looping indefinitely.
Implementation constraints
- Do not expose the mutable traversal stack or allow consumers to rewrite children during iteration.
Verification to include
- Walk a mixed tree and compare the complete path order used by both consumers.
- Break after the first leaf, then start a fresh iteration; also supply a manually constructed cycle and assert a bounded error.
Deliverables
- Traversal API, two migrated consumers, and cycle/early-exit checks
Rollout and recovery
Compare inspector output before replacing the duplicated traversals; restore the old read path if ordering changes unexpectedly.
Value of the work
For the engineer: Practice expression modeling, language compatibility, bounded evaluation, and deciding whether object-oriented patterns improve a small interpreter.
For the team: Review concrete tradeoffs around rule changes, diagnostic quality, resource limits, and the cost of adding an operator without breaking saved rules.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.