Stop treating an absent parcel weight as a zero-weight match
A carrier feed omitted weightGrams and the evaluator coerced it to zero. The parcel passed a weight limit despite having no measurement; OR branches also mask inconsistent missing-value behavior.
- Focused work estimate
- 3h 30m + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Evaluation semantics · Null handling · Determinism
Estimated field mix
- Compiler and language tooling70%
- Backend30%
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
- InterpreterRefactor
Replace coercion spread across conditions with one explicit interpreter result model and consistent missing-value semantics.
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
- Define true, false, and unknown outcomes with explicit AND/OR truth tables and no implicit string/number coercion.
- Missing referenced inputs produce unknown with the relevant field path; only true authorizes the synthetic routing decision.
- Repeated evaluation of the same rule and parcel returns the same outcome and bounded explanation without mutating either input.
Implementation constraints
- Short-circuit only when the declared three-valued semantics permit it; retain enough information to explain the final outcome.
Verification to include
- Exercise every pair in both truth tables, including false AND unknown and true OR unknown.
- Evaluate missing, null, zero, and numeric-string weights and assert the distinct documented results.
Deliverables
- Typed evaluation result, truth-table regression cases, and explanation format
Rollout and recovery
Compare decisions against a synthetic parcel corpus; keep unknown outcomes in a review queue and revert the evaluator by version.
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.