Skip to content

test: filter std.prql spans from unrelated snapshots - #6162

Merged
kgutwin merged 2 commits into
PRQL:mainfrom
bioteam:kg/6152/snapshot-span-filter
Aug 7, 2026
Merged

test: filter std.prql spans from unrelated snapshots#6162
kgutwin merged 2 commits into
PRQL:mainfrom
bioteam:kg/6152/snapshot-span-filter

Conversation

@kgutwin

@kgutwin kgutwin commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Resolves #6152.

This is the second part; trivial, really, but applies a filter to certain insta snapshots to replace the pattern r"\b0:\d+-\d+" with [std]. This has the effect that changes to std.prql generate much less churn in unrelated snapshots and improves code review overall.

Note that this filtering is applied very selectively at this point, since it was determined that this issue is fairly narrowly scoped. If we find that there are additional sources of churn, it'll be worth revisiting this approach and maybe making it more generally applied.

No changelog entry as this only affects the content of test snapshots.

@prql-bot prql-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the intent holds: prepending a comment line to std.prql (shifting every std span) leaves the full cargo test -p prqlc suite green with zero snapshot churn, so these three sites cover all the std-span exposure in this crate.

\b0:\d+-\d+ is sound here specifically because STD_LIB_SOURCE_ID is 0 and SourceTree hands user sources ids starting at 1. That's worth stating in a comment at each site, because the same 0: prefix means the query under test in the prqlc-parser snapshots and in error_messages.rs / bad_error_messages.rs — applying this filter there would silently erase real spans rather than noise. Two inline suggestions add that comment and switch to with_settings!, which is the repo's existing idiom (queries.rs uses it in six places; these two are the only Settings::clone_current() calls in the tree). Both compile and leave the snapshots unchanged.

Non-blocking: the regex literal is now in three places. If a fourth shows up, a pub(super) const next to erase_ids in resolver::test would cover both src sites (transforms.rs already reaches for super::super::test::erase_ids); queries.rs is a separate test crate and would keep its own copy.

Worth landing ahead of #6151 / #6155 / #6104 — they each rewrite these same std spans, and their snapshot diffs mostly disappear once this is in.

Comment thread prqlc/prqlc/src/semantic/resolver/mod.rs Outdated
Comment thread prqlc/prqlc/src/semantic/resolver/transforms.rs Outdated
Co-authored-by: prql-bot <107324867+prql-bot@users.noreply.github.com>
@kgutwin
kgutwin enabled auto-merge (squash) August 7, 2026 15:15
@kgutwin
kgutwin merged commit 47f3ad8 into PRQL:main Aug 7, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: remove spans from test snapshots

2 participants