Skip to content

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

Done

Description

@sub4biz

Summary

On Windows, test_js_liquid_keeps_liquid_references fails on the clean v0.9.122 tag. The test checks whether target_file ends with assets/x.js, but the extractor supplies a native Windows path containing backslashes. The reference edge itself is present. This makes a correct extraction appear to fail in the test suite.

The Liquid extractor was introduced as part of the Shopify theme work related to #5552.

Steps to reproduce

On Windows, with Git, Python and uv installed:

git clone https://github.com/Graphify-Labs/graphify.git
Set-Location graphify
git checkout --detach v0.9.122
uv sync --all-extras
uv run pytest -q --tb=no tests/test_liquid_extractor.py::test_js_liquid_keeps_liquid_references

The test fails. To verify independently that the edge exists, run this from the same checkout:

@'
from pathlib import Path
from tempfile import TemporaryDirectory
from graphify.extractors.liquid import extract_liquid

with TemporaryDirectory() as tmp:
    root = Path(tmp)
    (root / "layout").mkdir()
    (root / "assets").mkdir()
    (root / "layout" / "theme.liquid").write_text(
        "{{ content_for_layout }}", encoding="utf-8"
    )
    (root / "assets" / "x.js").write_text("// x\n", encoding="utf-8")
    source = root / "assets" / "app.js.liquid"
    source.write_text(
        "const x = {{ 'x.js' | asset_url | json }};\n", encoding="utf-8"
    )
    edges = extract_liquid(source)["edges"]
    refs = [e for e in edges if e.get("relation") == "references"]
    print("native path matches:", any(
        Path(e.get("target_file", "")).name == "x.js" for e in refs
    ))
    print("forward-slash suffix matches:", any(
        e.get("target_file", "").endswith("assets/x.js") for e in refs
    ))
'@ | uv run python -

On Windows the output is:

native path matches: True
forward-slash suffix matches: False

Expected behavior

The test should pass when the reference points to assets/x.js using the platform’s native path representation. Comparing Path(target_file) components or converting to POSIX form in the assertion would make the check portable.

Environment

Windows, Python 3.12, clean upstream tag v0.9.122. The failure and the presence of the edge were checked on that tag.

Activity

  1. github-actions commented on Nov 28, 2026

    @github-actions

    Thanks for opening this issue, @sub4biz. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. added a commit that references this issue on Nov 30, 2026
    bdac432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions