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
Changing anything within the std.prql module almost always results in churn of dozens of snapshots where the only changes are in the span: 0:1234-1238 lines. This makes code review substantially harder since you end up with a bunch of junk you have to skip, and a true substantial change to a snapshot is difficult to spot.
Instead, it probably makes sense to simply drop the span: lines from the snapshots. Spans are of course always relative to the total PRQL input and they don't really have any underlying meaning behind them. I'm having a hard time thinking of a case where a code reviewer would want to know that a span changed, or where we would want a test to fail because a span changed.
Reproduced the mechanism, but the measurements point somewhere slightly different: spans are a real source of churn, just a very small one compared to expression-ID renumbering.
Span churn is small and precisely bounded. Inserting a single comment line at the top of std.prql (zero semantic change, pure byte-offset shift) churns exactly 14 lines across 4 snapshots, all span: lines:
That's the whole footprint — those 14 lines are every source_id: 0 span in the prqlc crate's snapshots. The other ~2,090 spans in prqlc's snapshots are 1: (query-relative) and don't move when std.prql changes.
The "dozens of snapshots" churn is node IDs, not spans. For a normal std.prql change — adding or removing a declaration — I categorized the actual snapshot diffs:
The resolver assigns every expr an id from a single monotonic counter that numbers std.prql's exprs before the query's, so adding a declaration shifts every downstream id:, parent:, target_id:, input_id:, child-ID list entry, and _literal_N name. That lands almost entirely in the 31 debug_lineage snapshots. Dropping spans wouldn't have changed #5806's diff at all.
Suggest doing it at the snapshot layer, not by dropping the field.span is documented output of prqlc debug lineage (cli/mod.rs:206), and #4662 enabled span serialization specifically because the debug HTML renderer reconstructs AST nodes from JSON — it uses the presence of a "span" key as its node detector (render_html.rs:383).
An insta filter gets the same review benefit without touching serialization. Filtering only source_id: 0 spans, scoped to prqlc's tests, removes the churn while keeping the query-relative spans that are stable and readable:
I verified this on the debug_lineage test: the 9 std spans in …set_ops_remove.snap render as [std], the 39 1: spans are untouched, and re-running with a shifted std.prql produces no diff. Broadening the regex to \b\d+:\d+-\d+ drops spans wholesale if you'd rather go that way — worth noting the scoping matters, because in prqlc-parser source 0 is the test's own input, and those ~809 span assertions are arguably what the parser tests are checking.
Happy to open a PR for the span filter, for the ID churn, or both — the ID side is the one that would actually shrink those 40-file diffs, so it's probably worth deciding on first.
(The prqlc count above misses the two - - 0:…-… frame keys in set_ops_remove.snap, which is why the experiment shows 14 lines rather than 12.)
Filter verification — applied the filters block to queries.rs:151, accepted snapshots, then re-ran with the perturbed std.prql: git diff --stat was identical before and after, and the snapshot contains 0 occurrences of 0:, 9 of [std], 39 of 1:. All changes reverted; working tree is clean.
Activity
prql-bot commentedon Aug 6, 2026
Reproduced the mechanism, but the measurements point somewhere slightly different: spans are a real source of churn, just a very small one compared to expression-ID renumbering.
Span churn is small and precisely bounded. Inserting a single comment line at the top of
std.prql(zero semantic change, pure byte-offset shift) churns exactly 14 lines across 4 snapshots, allspan:lines:prqlc__semantic__resolver__test__functions_pipeline.snap/-2.snapprqlc__semantic__resolver__transforms__tests__aggregate_positional_arg-2.snapintegration__queries__debug_lineage__set_ops_remove.snapThat's the whole footprint — those 14 lines are every
source_id: 0span in theprqlccrate's snapshots. The other ~2,090 spans inprqlc's snapshots are1:(query-relative) and don't move whenstd.prqlchanges.The "dozens of snapshots" churn is node IDs, not spans. For a normal
std.prqlchange — adding or removing a declaration — I categorized the actual snapshot diffs:.snapfilesdate.nowdate.truncstd.prql_versionappend by:nameThe resolver assigns every expr an id from a single monotonic counter that numbers
std.prql's exprs before the query's, so adding a declaration shifts every downstreamid:,parent:,target_id:,input_id:, child-ID list entry, and_literal_Nname. That lands almost entirely in the 31debug_lineagesnapshots. Dropping spans wouldn't have changed #5806's diff at all.Suggest doing it at the snapshot layer, not by dropping the field.
spanis documented output ofprqlc debug lineage(cli/mod.rs:206), and #4662 enabled span serialization specifically because the debug HTML renderer reconstructs AST nodes from JSON — it uses the presence of a"span"key as its node detector (render_html.rs:383).An insta filter gets the same review benefit without touching serialization. Filtering only
source_id: 0spans, scoped toprqlc's tests, removes the churn while keeping the query-relative spans that are stable and readable:I verified this on the
debug_lineagetest: the 9 std spans in…set_ops_remove.snaprender as[std], the 391:spans are untouched, and re-running with a shiftedstd.prqlproduces no diff. Broadening the regex to\b\d+:\d+-\d+drops spans wholesale if you'd rather go that way — worth noting the scoping matters, because inprqlc-parsersource0is the test's own input, and those ~809 span assertions are arguably what the parser tests are checking.Happy to open a PR for the span filter, for the ID churn, or both — the ID side is the one that would actually shrink those 40-file diffs, so it's probably worth deciding on first.
Method
Repo state:
7bd749933dbf6c827a53ecd59b443006e4858b0d.Span-churn experiment — prepend one comment line to
prqlc/prqlc/src/semantic/std.prql, then:Yields 4 files / 14 lines, all matching
span.Historical categorization — for each commit touching
std.prql:otheris 41 lines for #5729 and 2 for #5806 (SQL output of new tests plus insta headers).Span footprint by crate:
(The
prqlccount above misses the two- - 0:…-…frame keys inset_ops_remove.snap, which is why the experiment shows 14 lines rather than 12.)Filter verification — applied the
filtersblock to queries.rs:151, accepted snapshots, then re-ran with the perturbedstd.prql:git diff --statwas identical before and after, and the snapshot contains 0 occurrences of0:, 9 of[std], 39 of1:. All changes reverted; working tree is clean.