# 17 — Compiler instrumentation and debugger feasibility gate Status: PLANNED; no implementation claim Requirements: R-010,R-013,R-016,R-017,R-018 Dependencies: Successful08;09/12 DTOs and source provenance; define Gate2 fixture before18-21. ## Ownership and boundaries Proposed Astra, tightly coupled compiler work. NEW experiments/debugger/, compiler-patches/ and debug instrumentation tests only under a later explicit scoped assignment. Root owns patch provenance/backend pin. Future assignments must verify the then-current baseline and exact disjoint paths; these proposed scopes do not authorize work in another repository. ## Contracts and data flow EvaluationEvent carries ordered sequence, causal/instantiation parent, kind, source origin and typed event-time values. Capture template instantiation, constraint outcomes, constexpr/consteval calls/evaluation, reflection queries, splices and expansions. Instrument the evaluator actually used by the pinned fork; do not assume newer upstream bytecode support. ## Implementation sequence 1. Map real pinned compiler entry/exit, evaluation and Sema re-entry paths. Distinguish stable callbacks from required instrumentation patches and obtain scope approval for compiler changes before implementing them. 2. Build a mixed fixture that crosses template substitution, failed constraints, nested constant evaluation, reflection and generated entities. Define expected source/event/value observations independently of emitted logs. 3. Prototype event-time capture and cooperative stop/control points with bounded serialization. Snapshot mutable values or deterministic deltas at the event; persisting final state or raw pointers is insufficient. 4. Prove live pause/step/resume and trace replay consistency, including cancellation/error unwinding. Record instrumentation overhead, capability gaps and maintenance burden as the Gate2 verdict. ## Failure behavior and constraints A source compiler build or template trace alone is not Gate2 success. Missing evaluator/constraint visibility, corrupt state on pause, unreliable origins or inaccessible historical values block dependent debugger milestones. Source incompatibility from08 is not repaired implicitly by this experiment. ## Acceptance scenarios 1. Assert nested evaluator/Sema event ordering and values for successful/failed constraints, dependent splices and template instantiations. 2. Pause/step/cancel at supported boundaries; compare uninstrumented/instrumented semantic results and ensure normal editing remains viable. 3. Replay captured prefixes after source changes, test truncation/worker crash and reject any fabricated missing state. ## Verification and integration Proposed NEW CTest label: `debug-instrumentation`. Once implemented, register a nonzero suite and run: ```sh dev cpp-gcc -c ctest --test-dir build/bootstrap -L debug-instrumentation --output-on-failure ``` This future command is not evidence that the label/tests exist now. Before dispatch, bind the fixtures above to actual targets and record prerequisites/side effects. Require fresh independent review of the implemented contract and affected integrations. Keep compiler patches versioned against the exact upstream revision with reproducible application/removal. A failed gate leaves the ordinary server/backend intact and requires a reviewed alternative plan.