Repository navigation
Conversation
Extract .liquid files of a Shopify theme (gated on a layout/theme.liquid ancestor). render/include/section/sections/content_for and schema blocks become 'imports' edges to the file they name, so 'graphify affected' on a snippet lists the sections rendering it. asset_url and the t filter become 'references' edges (asset file, or key of the single default locale). Relation 'includes' is avoided because affected does not follow it. Dynamic names, comment/doc/raw regions and path-traversal names emit nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A statically named render/include/section/sections/content_for target, asset or translation key that does not exist becomes an AMBIGUOUS edge (score 0.2) to a node flagged unresolved with id ref_liquid_<kind>_<name>, instead of being dropped. Documents how to list them from graph.json and adds Liquid to the built-in parsers list. The incremental cache keeps the stale edge of an unchanged citing file after the target appears; pinned by a strict xfail, a full rebuild clears it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A literal such as 'font.eot?#iefix' piped into asset_url named a file that cannot exist. Resolve the part before ? or # instead of reporting a broken reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… to JS siblings Shopify default locales start with a // header, so json.loads failed and every | t edge was lost; strip // and /* */ outside strings. A .liquid -> .js reference was dropped by the cross-language guard in build, and the references target was not salted with the colliding id when x.css and x.js share a stem. Co-Authored-By: Claude <[email protected]>
Templates and section groups of a Shopify theme place sections and blocks in JSON, which were skipped as data JSON. Route them by path (gated on a theme root) before the generic .json dispatch, link each placed section and existing theme block, and link t: schema keys to the default schema locale. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Templates place top-level blocks with section type _blocks, which Shopify provides; it never has a sections/ file, so it must not be reported as a broken reference. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iles Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…schemas Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
…ce rubric Co-Authored-By: Claude <[email protected]>
edge_lines() merges source_location with the same-file also_seen entries; explain and affected print them ascending (file:L58,L73). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
Standalone grep-vs-graph.json harness with its own nested-comment masking; measures render/include/section, css/js symbols, custom elements, settings, classes and metafields. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
…cases in the gate Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
…s for missing files Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
…wn schema Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
….json Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
- add a pure css_selectors scanner (classes, ids, custom elements; no pseudo-classes)
- strip Liquid keeping line numbers, with nested comment and raw handling
- emit selector nodes for {% stylesheet %} bodies with absolute lines
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
- register .css in CODE_EXTENSIONS and the extractor dispatch - extract_css yields no nodes (and is cached as skipped) outside a Shopify theme Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
- strip Liquid keeping lines ({{ }} becomes 0 so JS stays parseable) and call _extract_generic in memory
- bump the AST cache schema to 59
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
Adds an HTML segmenter to the Liquid scan and a per-root index of defines; the element node hangs from the defining JS so affected reaches the templates that use it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
Markup echoed from tags and outputs counts too. The defines index is read once per file, not once per match (a 30k-tag file took 13 s). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
…lectors INFERRED 0.55 edges from each class token to every selector of that name in theme CSS, css.liquid and stylesheet blocks; affected of a Liquid file does not grow. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XEpopcRhPeknSH9XUaK2bN
|
Thanks for the pull request, @dalexhd. 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. |
There was a problem hiding this comment.
Graphify review 
20 possible issues to check · High impact
20 possible issues we couldn't confirm
- Call sites recorded only in
also_seenare dropped when an edge has no primarysource_location·graphify/affected.py:464 - CSS class names with hex escapes such as
.\31 0get a wrong, truncated label ·graphify/extractors/css.py:106 - Unreadable CSS files return a result with no nodes or edges keys, unlike the other return paths ·
graphify/extractors/css.py:159 - +17 more in Graphify
They don't change the score.
What this review covered
- This review stopped before it finished; findings are from the part that ran.
- The AI model asked for code in a way the review could not use.
- We didn't review 9 files that aren't source code, such as docs, config, images, or generated or third-party code.
- A changed file's diff was too long to show in full, so the review may not have seen every changed line in it.
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
- +1 more notes in Graphify.
- 18 of 18 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 8291 functions depend on this change
- 18 functions became more coupled. Largest:
extract()(1408 callers),build_from_json()(352 callers),main()(132 callers). - 646 of 646 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Review stopped early on 6d50546 · 20 earlier findings not re-checked
| return lines | ||
|
|
||
|
|
||
| def _custom_element_defines(root: Path) -> dict[str, tuple[Path, int]]: |
There was a problem hiding this comment.
Commented-out custom-element definitions are treated as real
A custom element mentioned only in a JavaScript comment can appear to be defined, so Liquid references point to a definition that never runs.
Filter JavaScript comments before applying _CE_DEFINE in _custom_element_defines.
Evidence · checked against the code
- Independent source review: Checked the Liquid use path and tests covering actual definitions, unresolved uses, and JavaScript blocks. Those tests do not filter comments or prevent the raw scan from matching one; no mitigating guard on this route was found.
- A changed file's diff was too long to show in full.
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
Prompt to fix with AI
In graphify/extractors/liquid.py, _custom_element_defines (line 1032):
Problem: Commented-out custom-element definitions are treated as real
Fix it at the cause, and add a test that fails without the fix.
Graphify · Checked against the code · View in Graphify
| return [f for f in files if f.is_file()] | ||
|
|
||
|
|
||
| def _signature(files: list[Path]) -> tuple[int, int]: |
There was a problem hiding this comment.
Theme indexes can stay stale after editing an older file
After a CSS or JavaScript theme file changes, Liquid extraction can keep using the previous selector or custom-element index, so references may point to outdated results or appear unresolved.
Make _signature detect changes to every scanned file.
Evidence · checked against the code
- Independent source review: Inspected the Liquid extraction path and existing tests for CSS-class and custom-element linking. They exercise normal index construction, but do not cover editing an indexed file between extractions; no invalidation guard on these paths was found.
- A changed file's diff was too long to show in full.
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
Prompt to fix with AI
In graphify/extractors/liquid.py, _signature (line 1010):
Problem: Theme indexes can stay stale after editing an older file
Fix it at the cause, and add a test that fails without the fix.
Graphify · Checked against the code · View in Graphify
Blank // and /* */ comments (strings and template literals untouched) in
assets JS and {% javascript %} bodies before scanning for defines.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
.md\:flex and .w-1\/2 were cut at the escape; the selector now stores md:flex / w-1/2 so it matches class="md:flex" in Liquid. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y file The (count, newest mtime) signature missed a delete-plus-add and files restored with an old mtime (cp -p, rsync -t). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…5557) Squashed landing of @dalexhd's four-PR Liquid/Shopify-theme extractor stack: a Liquid extractor (.liquid), theme-JSON template→section/block linking, CSS classes, settings, custom elements and metafields. Pure-stdlib scanners, no new dependencies; all new extraction is gated to a theme root (layout/ theme.liquid) so non-theme .css/.json files are unaffected. Verified by adversarial review: zero node/edge diff on Python and a 20-language corpus (no existing-language regression), new extraction works, broken themes degrade gracefully. Schema bump is consolidated with the rest of this release's extraction-output changes in a following commit. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ema 58 Collapse the Shopify stack's internal 58/59/60 bumps and the TS/C++/Markdown bumps into a single 57->58 bump with one combined entry (TS #5525/#5529, C++ #5550/#5551, Markdown #5480, Shopify #5553/#5554/#5555/#5557), chaining to the shipped-57 (0.9.121) entry. Fixes the stack's schema-history mislabel that had carried the shipped-57 Rust text as 58. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Shipped in v0.9.122 as the Shopify/Liquid theme extractor. The four-PR stack landed as a single squashed commit authored to you (@dalexhd) so it keeps your authorship. Adversarial review confirmed zero regression to existing-language extraction (zero node/edge diff on Python + a 20-language corpus), no new dependencies, and graceful handling of broken themes. Thanks for a substantial feature! |
Stacked on #5555 (which builds on #5554 and #5553). Refs #5552.
Problem
After the Liquid and theme JSON extractors, a theme graph still misses several constructs that a "what breaks if I change X" question depends on:
settings.xreads, custom elements defined in JS and used in Liquid, CSS classes used in markup,shop.metafieldsreads, and.js.liquid/.css.liquidassets.explainandaffectedalso showed only the first line of an edge that is repeated many times in one file.Implementation
explainandaffectedprint every line of an edge (file:L58,L73), mergingsource_locationwith the same-filealso_seenentries..js.liquidassets: Liquid is stripped keeping line numbers ({{ }}becomes0so the JS stays parseable) and the result goes through the existing JS extractor in memory. The AST cache schema is bumped..css.liquidand{% stylesheet %}bodies: a pure selector scanner (classes, ids, custom elements, no pseudo-classes). A minimal.cssextractor is registered but yields nothing outside a theme root (ancestor withlayout/theme.liquid).settings.xlinks toconfig/settings_schema.json; section and block settings resolve against the file's own{% schema %}. An undeclared setting becomes an unresolved node, not a silent miss.<x-y>andis="x-y"; the element node hangs from the JS file that callscustomElements.define, soaffectedon that JS reaches the templates that use the element. The defines index is read once per file.affectedof a Liquid file does not grow..shopify/metafields.json; a missing definition is an unresolved node (a warning in the gate), not an error.scripts/theme_gate.py: standalone grep-versus-graph.jsonharness measuring render/include/section, CSS/JS symbols, custom elements, settings, classes and metafields.Verification
graph.jsongrows 1.9x to 3.6x.affected "snippets/accordion.liquid" --depth 5returns the same set of dependents as before.tests/test_liquid_extractor.py::test_two_megabyte_file_is_fast, a 2 s wall-clock limit that already sits at 1.3 to 1.8 s on the base and fails only under machine load; it passes when run alone.Limitations
AI disclosure
Written with Claude Code. I reviewed the code and ran the commands above myself.