noCV
PDSL-102 · Define the language boundary

Represent nested all-of and any-of rules without special-case depth handling

Practice briefStoryIntermediate

The current rule model has separate fields for one AND group and one OR group. A warehouse needs (north OR west) AND (express OR under-500g), which cannot be represented without duplicated conditions.

Focused work estimate
2h 30m + prerequisites
Priority in the scenario
High
Engineering practice
Tree modeling · Immutability · Serialization

Estimated field mix

  • Compiler and language tooling75%
  • System design25%

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

  • CompositeCompare

    Compare uniform leaf/group composition with the existing fixed-depth structure, retaining type safety without requiring a class per node.

Your next step

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

  • Model comparisons and nested all-of/any-of groups through one expression contract while preserving child order.
  • Reject empty groups and enforce a documented maximum of 16 levels and 1,000 nodes at construction.
  • Serialize and parse a valid tree without changing its grouping, field types, or language version.

Implementation constraints

  • Compare a discriminated-union tree with a class hierarchy; choose the smaller representation that supports the required operations.

Verification to include

  • Round-trip a four-level mixed rule and compare every node and child position.
  • Reject a seventeenth level and a reused mutable child that would change an already constructed rule.

Deliverables

  • Expression model, boundary tests, and a short representation decision

Rollout and recovery

Convert only synthetic flat rules first and compare their trees; retain flat input conversion until nested-rule behavior is checked.

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.