Skip to content

fix(liquid): compare target_file path components portably in JS-Liquid test - #5583

Closed
m3lonxd wants to merge 1 commit into
Graphify-Labs:v8from
m3lonxd:fix/liquid-windows-path-separator-5579
Closed

m3lonxd wants to merge 1 commit into
Graphify-Labs:v8from
m3lonxd:fix/liquid-windows-path-separator-5579

Conversation

@m3lonxd

@m3lonxd m3lonxd commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Closes #5579

extract_liquid() returns OS-native path strings in edge[target_file] (consistent with source_file and every other extractor in graphify), so on Windows target_file uses backslash separators (e.g. ...\assets\x.js). test_js_liquid_keeps_liquid_references asserted e[target_file].endswith(assets/x.js), causing a false test failure on Windows even though the reference edge was present.

This PR updates test_js_liquid_keeps_liquid_references to match target_file suffix components via PurePosixPath / PureWindowsPath (via _target_matches_relative()), and adds test_js_liquid_keeps_liquid_references_handles_windows_separators to prove the pre-fix failure cross-platform on POSIX and Windows hosts.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Tests or CI
  • Refactor
  • Security fix

Verification & Invariants

  • Preserves the existing extractor invariant that individual extractors emit OS-native str(path) values for source_file and target_file, while extract() normalizes source_file to POSIX after path resolution.

  • Verified the new regression test fails against pre-fix test_js_liquid_keeps_liquid_references (failing on endswith(assets/x.js) when given Windows backslash separators) and passes with the fix.

  • No generated skill files or AST cache schemas are affected.

  • Read the CONTRIBUTING.md guide.

  • Reproduced the issue and identified the invariant.

  • Made the smallest fix necessary.

  • Added a regression test (if bug fix) or isolated boundary test.

  • Kept the PR description synchronized with the final implementation.

  • Documented any limitations / unsupported cases explicitly.

How was this tested?

uv run --frozen pytest tests/test_liquid_extractor.py tests/test_shopify_theme_json_extractor.py tests/test_css_extractor.py -q
  -> 113 passed, 1 xfailed (pre-existing xfail test_update_after_the_missing_file_appears_resolves_the_edge)
uv run --frozen pytest tests/test_liquid_extractor.py -q
  -> 81 passed, 1 xfailed
uv run --frozen ruff check .
  -> All checks passed!
uv run --frozen pyright tests/test_liquid_extractor.py
  -> 0 errors, 0 warnings, 0 informations
uv run --frozen python -m tools.skillgen --check
  -> check OK: 134 artifact(s) match committed output and expected/.

Graphify-specific checklist

  • I updated generated skill artifacts (uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A — test-only change)
  • I confirmed that AST/structural extraction remains deterministic (no ambient state dependencies like ENV variables).
  • I reviewed changes for security implications (no unsafe interpolation into shell/Python).
  • I confirmed no API keys or local-only graph data are included.
  • (If applicable) I disclosed AI authorship in my commit messages.

…d test

extract_liquid() returns OS-native path strings in target_file (matching all other extractors in graphify), so Windows paths use backslash separators and failed the raw '.endswith("assets/x.js")' check in test_js_liquid_keeps_liquid_references.

Compare path components via PureWindowsPath/PurePosixPath so both POSIX and Windows separators match cleanly, and add a cross-platform regression test that reproduces the Windows separator failure on any host OS.

Fixes Graphify-Labs#5579

Co-Authored-By: Gemini <[email protected]>
@m3lonxd
m3lonxd requested a review from safishamsi as a code owner November 28, 2026 11:46
@github-actions

Copy link
Copy Markdown

Thanks for the pull request, @m3lonxd. A maintainer will review it soon.

Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions.

A couple of things that speed up review: make sure the test suite passes on Python 3.11 and 3.13, and that the change keeps extraction deterministic.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify review View in Graphify

Nothing blocking · 2 possible issues to check · Merge confidence 5/5

2 possible issues to check · High impact

The test now matches Liquid reference paths by trailing path components and adds coverage for Windows-style separators.

2 possible issues we couldn't confirm

They don't change the score.

Code graph · 115 functions depend on this change
  • 1 of 652 test files are affected by this change.
  • Gate, test list and every flagged function: in the Graphify check.

Reviewed 6cd33c7

safishamsi added a commit that referenced this pull request Nov 30, 2026
Extractor accuracy (Swift #5641, Apex #5627, Python #5647, TypeScript
#5604/#5614/#5612, Bash caller-var #5602), GitHub Actions run-step
extraction (#5603), incremental correctness (#5634/#5638/#5636), symlink
and semantic-cache fixes (#5617/#5618), export/report hardening and perf
(#5643/#5644/#5645/#5646/#5619/#5620/#5621), and CLI/docs/skill/install
work (#5629/#5628/#5626/#5624/#5623/#5625/#5642/#5583). AST cache schema
59 to 60; Swift/Apex/Python/Bash/GHA inputs re-extract on first build.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Landed in v0.9.124 (just released to PyPI), cherry-picked with your authorship preserved so it shows under your name in the history. Thanks @m3lonxd for the portable JS-Liquid target-path comparison — verified green in the full suite and, where applicable, smoke-tested against the published package. 🙏

@safishamsi safishamsi closed this Nov 30, 2026
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.

Liquid: JS asset reference test fails on Windows due to path separator

2 participants