-
Notifications
You must be signed in to change notification settings - Fork 1
Bug - Pattern Liquid tests #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
delphine-demeulenaere
wants to merge
1
commit into
main
Choose a base branch
from
bug_pattern_liquid_testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+216
−93
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 92
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 90
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 1477
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 1947
🏁 Script executed:
ast-grep --pattern 'function extractAnchorBlocks($_) { $$$}'Repository: silverfin/silverfin-cli
Length of output: 49
🏁 Script executed:
rg -n "extractAnchorBlocks" lib/liquidTestRunner.jsRepository: silverfin/silverfin-cli
Length of output: 229
🏁 Script executed:
rg -n "function extractAnchorBlocks" lib/Repository: silverfin/silverfin-cli
Length of output: 163
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 2495
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 1474
🏁 Script executed:
rg -n "filterTestsByPattern" lib/liquidTestRunner.jsRepository: silverfin/silverfin-cli
Length of output: 286
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 4065
🏁 Script executed:
rg -n "lineAdjustments" lib/liquidTestRunner.jsRepository: silverfin/silverfin-cli
Length of output: 849
🏁 Script executed:
rg -n "test_line" lib/liquidTestRunner.jsRepository: silverfin/silverfin-cli
Length of output: 124
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 596
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 336
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 2497
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 1497
🏁 Script executed:
rg -n "createTestRun\|createPreviewRun" lib/ -A 5Repository: silverfin/silverfin-cli
Length of output: 49
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 183
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 570
🏁 Script executed:
rg -n "createTestRun" lib/Repository: silverfin/silverfin-cli
Length of output: 306
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 1784
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 774
🏁 Script executed:
Repository: silverfin/silverfin-cli
Length of output: 420
Pattern filtering is undermined by prepending full test blocks containing unmatched tests.
The
extractAnchorBlocksfunction (line 117) returns entire test blocks, not just anchor definitions. These blocks come from tests that don't match the filter pattern and are prepended tofilteredContent(line 194). Since no pattern information is passed to the backend API (lines 294-298 send onlytemplate,tests, andmode), the server executes all test blocks in the YAML—including those injected for anchor resolution. This reintroduces excluded tests and defeats the filtering guarantee.Additionally,
lineAdjustmentsonly contains mappings fororderedMatchingTests(lines 202-208), so tests from injected anchor blocks lack proper line tracking, potentially causing incorrect error reporting.Consider instead inlining referenced anchor nodes into matching tests or implementing server-side test filtering by name.
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried implementing this but I'm afraid it's not doable for the way we run liquid tests.
When filtering tests, we only added small anchor snippets back into the YAML. These snippets were often incomplete/indented, which broke the YAML structure. The backend then saw missing data (like periods) and failed validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@delphine-demeulenaere, thank you for trying the suggested approach and sharing the findings. That's a valid technical constraint—if extracting only the anchor definitions breaks the YAML structure and causes backend validation failures, then preserving the full test blocks is the pragmatic solution.Given that the backend expects valid YAML with complete test structures, the current implementation makes sense. While it does mean that some non-matching tests (those containing the anchors) will be included when pattern filtering is active, that's preferable to broken YAML or validation errors.
Are you comfortable proceeding with the current approach, or would you like to explore any alternative solutions (such as server-side pattern filtering, if that's feasible)?
🧠 Learnings used