nigig-org/crates/apps/nigig-traffic/docs/ADR/002-finish-circle-evaluator-scope.md

2.6 KiB

ADR 002: Evaluator scope is finish-circle plus collision/proximity

Status: accepted (Phase 2 honesty pass).

Context

The evaluator docs claimed per-variant simulation (roundabout exit arms, sign stop-lines, priority yield). The code checked the finish radius plus collision/proximity for five of nine variants; the payload fields (enter, exit_at, give_way, signs, yield_, stop) were unread.

Decision

Document exactly what each variant checks (objective.rs module docs) and pin it with behavior-locking tests. The payload fields stay as reserved data. A variant earns a real check only with geometry/query plumbing plus tests in the same change — never docs first.

Consequences

  • Roundabout/Signs/Priority/Hazards/FreeDrive are finish-circle by design, not by neglect. Say so out loud (the module doc does).
  • Reopen per variant when its check is implemented; each reopening must update the doc AND the locking test together.

Amendment 2026-09-25 (practice-preview honesty, no new assessment)

  • U-turn reversal is now course-RELATIVE heading (|relative| > 90°), not world forward-x (TRAFFIC-P1-02 partial; uturn_uses_course_relative... test). Turn zones/sequences/kerb remain reserved.
  • Proximity is never labelled contact: priority/hazard fail text says "too close", never "collision" (invariant 7; adversarial tests pin it).
  • haz_child_run, haz_branch, haz_rain now spawn their actor (TRAFFIC-P0-07 fixed; spawn-count test pins 1 each).
  • Completion text for every variant says PRACTICE and never confirms an unobserved behaviour (rule_adversarial pins the banned strings).
  • No variant is reopened as assessment: status stays PracticePreview for the whole catalog until TRAFFIC-08 curriculum sign-off lands.

Amendment 2026-09-25b (stateful production engine, still practice)

  • Production ticks go through RuleEngine::step (one-tick evaluate stays as the stateless, tested truth table sharing predicates and message constants with the engine):
    • speed needs 30 sustained over-limit ticks (grace) and 30 calm ticks to re-arm — one sampling artifact can no longer decide assessment;
    • lane/parking mistakes are edge-triggered per transition (no repeated-frame penalties); parking needs a 60-tick stopped dwell;
    • every transition lands in a bounded (4,096 + drop count) evidence trace explaining the result;
    • legal U-turns need actual reversal even at the finish marker.
  • Engine, trace bounds, determinism, and dwell/grace boundaries are pinned by 7 unit tests. Variants without observability (roundabout exits, signs, gaps) remain finish-marker practice by design.