You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/adr/ADR-0003-query-intermediate-representation.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -351,7 +351,19 @@ EndObject
351
351
EndVariant
352
352
```
353
353
354
-
The resulting `Value::Variant` preserves the tag distinct from the payload, preventing name collisions. When serialized to JSON, it flattens to match the documented data model: `{ tag: "A", ...payload }`.
354
+
The resulting `Value::Variant` preserves the tag distinct from the payload, preventing name collisions.
355
+
356
+
**JSON serialization** always uses `$data` wrapper for uniformity:
357
+
358
+
```json
359
+
{ "$tag": "A", "$data": { "x": 1, "y": 2 } }
360
+
{ "$tag": "B", "$data": [1, 2, 3] }
361
+
{ "$tag": "C", "$data": "foo" }
362
+
```
363
+
364
+
The `$tag` and `$data` keys avoid collisions with user-defined captures. Uniform structure simplifies parsing (always access `.$data`) and eliminates conditional flatten-vs-wrap logic.
365
+
366
+
This mirrors Rust's serde adjacently-tagged representation and remains fully readable for LLMs. No query validation restriction—all payload types are valid.
355
367
356
368
**Constraint: branches must produce objects.** Top-level quantifiers in tagged branches are disallowed:
357
369
@@ -430,7 +442,7 @@ struct Interpreter<'a> {
430
442
431
443
After initial construction, epsilon transitions can be eliminated by computing epsilon closures. The `pre_effects`/`post_effects` split is essential for correctness here.
432
444
433
-
**Why the split matters**: A match transition overwrites `current` with the matched node. Effects from *preceding* epsilon transitions (like `PushElement`) need the *previous*`current` value. Without the split, merging them into a single post-match list would use the wrong value.
445
+
**Why the split matters**: A match transition overwrites `current` with the matched node. Effects from _preceding_ epsilon transitions (like `PushElement`) need the _previous_`current` value. Without the split, merging them into a single post-match list would use the wrong value.
0 commit comments