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]>
|
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 
1 bug · 12 possible issues to check · High impact
New theme files leave cached references unresolved ·
liquid.py:175
12 possible issues we couldn't confirm
- Liquid template files are now counted as source code, so they go to the code extractor instead of the document path ·
graphify/detect.py:48 - Liquid templates are placed in their own interop family, so their inline scripts can no longer resolve calls to JavaScript defined in other ·
graphify/extract.py:4896 - Liquid files skip the cross-language import guard, so unverified imports and references from them can still bind to same-named files in othe ·
graphify/build.py:2308 - +9 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.
- Some lookups asked for files or lines that do not exist; the review was told and carried on.
- 10 of 10 changed files inspected. This is scope, not a correctness guarantee.
Code graph · 7570 functions depend on this change
- 6 functions became more coupled. Largest:
extract()(1400 callers),build_from_json()(349 callers),_get_extractor()(46 callers). - 644 of 644 test files are affected by this change.
- Gate, test list and every flagged function: in the Graphify check.
Review stopped early on 089d3eb · 14 earlier findings not re-checked
| def _place_sections(data: dict, out: _Collector) -> None: | ||
| sections = data.get("sections") | ||
| if not isinstance(sections, dict): | ||
| return |
There was a problem hiding this comment.
Theme edits leave cached section and translation links outdated
If a referenced section or locale entry is added after extraction, an unchanged template can keep showing its old unresolved or missing links.
Re-extract unchanged theme JSON when referenced sections or locale entries change.
Evidence · checked against the code
- Independent source review: Checked the extractor routing and cache lookup path: Shopify theme JSON reaches the generic cached extraction flow, with no dependency-based invalidation on that route. The tests inspected call the extractor directly and do not exercise cache invalidation for changed referenced files.
- The stale-result case depends on the existing AST cache being enabled; a forced extraction or cache miss reruns the Shopify extractor.
- 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/shopify_theme_json.py, extract_shopify_theme_json (lines 100-103):
Problem: Theme edits leave cached section and translation links outdated
Fix it at the cause, and add a test that fails without the fix.
Graphify · Checked against the code · View in Graphify
… 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]>
5bf1c35 to
089d3eb
Compare
| self._probe[target] = state | ||
| if state == "out": | ||
| return | ||
| if state == "missing": |
There was a problem hiding this comment.
New theme files leave cached references unresolved
If a missing snippet, asset, or section file is added after an initial scan, graphify can continue showing the reference as unresolved until the citing file is re-extracted.
Evidence · checked against the code
- Independent source review: Checked the cache invalidation path and the test's update helper: the helper runs graphify update twice around creation of the missing snippet, while cache hits bypass extraction for unchanged source. The test specifically asserts the unresolved edge is gone and is marked strict xfail; no test execution is claimed.
Prompt to fix with AI
In graphify/extractors/liquid.py, _Collector.file_edge (lines 172-175):
Problem: New theme files leave cached references unresolved
Fix it at the cause, and add a test that fails without the fix.
Graphify · Checked against the code · View in Graphify
…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! |
Part 2 of 2 for #5552, stacked on #5553 (Liquid extractor): until that one merges, this diff also shows its commits.
Problem
In a current theme the page structure lives in
templates/*.jsonandsections/*-group.json. graphify skips them as data JSON (_is_config_json), so "which pages use this section" has no answer, and a template with$schemawould be walked as a config file.Implementation
graphify/extractors/shopify_theme_json.py, routed by path in_get_extractorbefore the generic.jsondispatch, next to the other path-routed branches.json_config.pyis untouched..jsonundertemplates/(depth up to 2),sections/*.json, andconfig/settings_schema.json, only inside a theme root (ancestor withlayout/theme.liquid, same gate as PR 1). Anything else keeps today's routing./* ... */header is stripped, thenjson.loads. A parse failure yields only the file node. Keys are iterated sorted, so key order does not change the output.importsedge tosections/<type>.liquid; a missing file is an unresolved reference as in PR 1. App blocks (shopify://and@apptypes) get nothing.blocks/<type>.liquidonly when that file exists; otherwise nothing, because it may be a section-local block._blocksis the section type Shopify provides for top-level blocks. It never has a file, so it is not reported as broken, but the blocks under it still link.t:keys in{% schema %}bodies and insettings_schema.json->referencesedge to the key in the singlelocales/*.default.schema.json; unresolved when absent; nothing when there is no default schema locale or there are several.Verification
$schema, group plus.context.<x>.jsonvariant, empty template, key reordering, nested blocks, app blocks, missing section,t:keys, a repo withoutlayout/theme.liquid._blocksfix has a regression test that fails when the source change is reverted (checked on a throwaway branch).v8: the same 30 failures as an unmodifiedv8checkout in the same environment, none new.graphify affected snippets/icon.liquidnow also lists the templates that place the sections which render it.Limitations
config/settings_data.jsonand section-local blocks are not read.AI disclosure
Written with Claude Code. I reviewed the code and ran the commands above myself.