From c71b7306c2b643d89117b45d3582c6dfbedbaa31 Mon Sep 17 00:00:00 2001 From: Christopher Bays Date: Mon, 22 Jun 2026 04:44:47 -0400 Subject: [PATCH 1/3] =?UTF-8?q?feat(adapters):=20#448=20=E2=80=94=20raw-Ji?= =?UTF-8?q?nja=20zone=20scanner=20+=20SpanRole::Zone=20facts=20+=203-state?= =?UTF-8?q?=20presence=20(CORE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hand-rolled tag-boundary scanner over raw_code in the adapter (locate_raw_zones, beside macro_call_sites), mirroring dbt-fusion's JinjaLayoutEvent model with ZERO new dependency. Pairs {% if is_incremental() %} / {% for %} start/mid/end via a depth-stack (not first-endif-wins), handling {%- -%} whitespace control, string-literal-aware delimiter skipping, {#…#} comments, and nesting; fail-closed (malformed/unbalanced → empty vec, never panic). A plain {% if %} pairs (so it never unbalances a sibling zone) but emits no v0.1 zone (L9). Each ZoneFact resolves in build_model_payload into a SpanRole::Zone SourceMapEntry (compiled span by honest token-location anchored on the longest literal SQL fragment; absent ⇒ None = the honest "pruned this build" verdict). The 3-state presence() + Structural detection lands CORE in src/domain/source_map.rs (un-gated, NO Experiment::RawZoneSync). RawZonePayload (§3.1) is projected through CodeMapPayload.raw_zones in a single gather_raw_zones fn: the presence verdict is derived ONCE in Rust and emitted as a string (compiled_in/compiled_out/structural) the prototype renders verbatim, and the owning node back-ref is derived via contains_range — null when compiled_out (type-incapable of an edge, never-a-false-claim). Goldens: the playground manifest's fct_encounters_incremental model carries a real {% if is_incremental() %} guard whose WHERE predicate compiled IN nested inside the terminal select body → an honest `structural` zone bound to (final select). The playground / diff-showcase report goldens + the explore / explore-macro tests.html goldens each gain exactly one raw_zones entry; regenerated + byte-verified both arms. TDD-first: Z1 scanner (incremental guard, for-loop, nested-by-depth-stack, whitespace-trim, comment-swallowed inner tag, string-literal %} skip, unbalanced → empty, plain-if pairs-no-zone) + Z2 (incremental compiled-OUT → None/compiled_out/ node_id null, Shape-A for-loop Structural, the compiled==None ⇒ no-edge fitness test over an exhaustive cte_spans cube) + presence()/to_wire unit tests. Gates: fmt, clippy --locked --all-targets, nextest (2456), bdd (242 scenarios), cargo doc -D warnings, cargo deny, headless zero-egress (12) + toggle (125) all green. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_0199AmBCec5kyVEEF1Qd7TSF --- examples/diff-showcase-report.html | 2 +- examples/explore-macro/tests.html | 2 +- examples/explore/tests.html | 2 +- examples/playground-report.html | 2 +- src/adapters/render.rs | 757 +++++++++++++++++++++++++++-- src/domain/source_map.rs | 174 ++++++- 6 files changed, 886 insertions(+), 53 deletions(-) diff --git a/examples/diff-showcase-report.html b/examples/diff-showcase-report.html index a65a546..0c48472 100644 --- a/examples/diff-showcase-report.html +++ b/examples/diff-showcase-report.html @@ -3197,7 +3197,7 @@

Project definition changed

- + + + +