Repository navigation
refactor(extract): begin per-language extractor split (#1212) - #1291
TheFedaikin wants to merge 3 commits into
Conversation
|
I deliberately chose the MIGRATION.md file over CLAUDE.md recommendation to be non-invasive, but if this is good looking you can probably add a reference to it and force people to get the upstreamed branch and run this inside their PRs so everything keeps moving. We can also after merging this to default branch point people to it on the stale/broken PRs, which is less invasive. I do think ideally we port high-churn stuff in one batch, but coordinated by your cherry-pick flow with one big swoop so it's less painful in the long run. cc @safishamsi |
|
Merged the conflicting stuff, but I'd love to hear the input on this so if that's not needed I'll stop supporting this effort and pivot to something that can move the project forward. Thanks! |
Suggested fixes for
|
Resolves the PR's merge conflict and the review comment on graphify/extractors/base.py. - uv.lock: took upstream/v8 verbatim — the only conflict was upstream's own version drift (pyproject 0.8.47 vs committed lock 0.8.45); the PR introduces zero lock changes. - extract.py: auto-merged; upstream's additions (mcp/manifest ingest, the new _LANGUAGE_BUILTIN_GLOBALS usage, Graphify-Labs#1390/Graphify-Labs#1446 etc.) preserved while the four moved extractors (blade/zig/elixir/razor) and the four base helpers stay out of the monolith behind the facade imports. - base.py: removed the module docstring and the _make_id/_file_stem docstrings per the reviewer (project convention: no docstrings, 1-line comment max); the import-direction note is kept as a one-line comment. Verified: ruff clean, graphify.extract imports with all four extractors + four base helpers present, full suite 2367 passed / 15 skipped. The lone flake (test_labeling parallel-batch ordering) is upstream's new Graphify-Labs#1390 code, non-deterministic, unrelated to this PR.
|
@safishamsi Hey! If you have a moment to at least glance into it and think if this is the right shape that'd be very good! I have some |
Move the blade/elixir/razor/zig extractors and the shared primitives (_make_id, _file_stem, _read_text, _LANGUAGE_BUILTIN_GLOBALS) out of the 13k-line extract.py into a graphify/extractors/ package: base.py holds the shared pieces, one module per language, and __init__ seeds a LANGUAGE_EXTRACTORS registry for future dispatch. Import direction is strictly extract.py -> extractors/ (extractors never import extract), so there is no cycle. extract.py re-exports every moved name, leaving all callers and the dispatch table unchanged. Ported from PR #1291 by @TheFedaikin onto current v8 as a thin, behavior-neutral slice (the PR itself was branched 31 commits behind and entangled with unrelated files). Verified the moved code is byte-identical to current v8 before porting; full suite 2393 passed, the zig/elixir/razor/blade extractor tests pass, ruff and skillgen --check clean. Also gitignores .DS_Store. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
The extractor split has landed on I ported the clean slice rather than merging this PR directly: the branch was cut from 0.8.44 and ended up 31 commits behind, and the sync commits did not fully catch up, so the diff here had grown to 165 files entangled with unrelated work that landed since (the work-memory feature, recent releases, and so on). Merging it as-is would have reverted that. So I took just the seven new files plus the matching The shape is right and is what landed: Before landing it I confirmed it is a true behavior-neutral move: extracting the same multi-file corpus with the pre-split code and the post-split code produced byte-identical node and edge sets, and the moved function bodies were verified byte-identical to current This unblocks your C#/Unity work: it can go in as its own |
…1212) Move the blade/elixir/razor/zig extractors and the shared primitives (_make_id, _file_stem, _read_text, _LANGUAGE_BUILTIN_GLOBALS) out of the 13k-line extract.py into a graphify/extractors/ package: base.py holds the shared pieces, one module per language, and __init__ seeds a LANGUAGE_EXTRACTORS registry for future dispatch. Import direction is strictly extract.py -> extractors/ (extractors never import extract), so there is no cycle. extract.py re-exports every moved name, leaving all callers and the dispatch table unchanged. Ported from PR Graphify-Labs#1291 by @TheFedaikin onto current v8 as a thin, behavior-neutral slice (the PR itself was branched 31 commits behind and entangled with unrelated files). Verified the moved code is byte-identical to current v8 before porting; full suite 2393 passed, the zig/elixir/razor/blade extractor tests pass, ruff and skillgen --check clean. Also gitignores .DS_Store. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
First slice of #1212:
extract.py(12,059 lines, 44 extractors) starts splitting intographify/extractors/, one small reviewable batch at a time. This batch moves fourbespoke, low-churn extractors (~565 lines): blade, zig, elixir, razor.
What's in the diff
graphify/extractors/base.py— four shared names moved verbatim (_make_id,_file_stem,_read_text,_LANGUAGE_BUILTIN_GLOBALS);extract.pyre-imports them.git diff --color-moved). Internal closures/consts/imports stay inside their functions.extract.pykeeps every public and private name via a marked facade block — zerochanges to
__main__.py,watch.py,pg_introspect.py, or any existing test.extractors/__init__.py— a registry seed (LANGUAGE_EXTRACTORS); dispatch sill flowsthrough
graphify.extract. Mechanical code motion only — registry-driven dispatch,class protocols, or lazy imports can layer on later if wanted.
extractors/MIGRATION.md— a playbook so any contributor (or AI agent) can port onelanguage per small, conflict-free PR: verbatim-move rules, helper classification by
grep, facade invariants, pre-flight churn checks.
pyproject.toml—packagesnow lists the subpackage (first-ever subpackage in thedistribution; without this, wheels build green but break on
import graphify.extract).Proof of behavior preservation
tests/test_extractors_registry.py(7 identity/registry guards).moved blocks (checked against this PR's base) is the proof.
Prior art
language-by-language; Add a pre-commit / CI guardrail against runaway file sizes #1213 (file-size guardrail) becomes enforceable as the monolith
shrinks.
artifacts (the skill progressive-disclosure split with its drift-fence CI) — this PR
applies the same philosophy to
extract.py, with byte-identity instead of roundtripchecks.
the config-driven extractors (python/js/java/…) wait until the shared
_extract_genericcore moves as its own coordinated batch.