Repository navigation
Conversation
Some projects use non-standard file extensions for languages graphify
already supports — for example, a codebase that uses ``.pic`` for PHP
sources. Today those files are silently dropped: detect classifies them
as ``None``, collect_files won't pick them up, and the AST dispatch
in extract has no entry for the suffix.
This adds a small alias mechanism so users can teach graphify to treat
one extension as another:
- ``register_extension_alias(custom, canonical)`` — public helper in
graphify.detect that updates CODE_EXTENSIONS / DOC_EXTENSIONS and
records the mapping in EXTENSION_ALIASES. Validates that both
extensions start with a dot and that the canonical is known.
- ``GRAPHIFY_EXTENSION_ALIASES`` env var — comma-separated
``custom:canonical`` pairs (e.g. ``.pic:.php,.foo:.py``) applied
automatically at module import. Malformed pairs and unknown
canonicals are skipped silently so a bad config never crashes the
pipeline.
- ``_get_extractor()`` and ``collect_files()`` consult
EXTENSION_ALIASES so aliased files are routed to the canonical
extractor and discovered during file walks. Routing the alias
lookup through ``_get_extractor`` covers both the sequential and
parallel (ProcessPoolExecutor) extraction paths.
Tests added for the registrar (validation, case normalization, code
and doc extensions), env-var parsing (single, multiple, malformed,
empty), and end-to-end flow through ``collect_files`` and ``extract``
using a tiny ``.pic`` file containing PHP.
Backward-compatible: zero behavior change unless the env var is set or
the helper is called.
|
Hi, Programmatic aliases registered via register_extension_alias() are stored only in the parent process, but extract() can run per-file extraction in subprocesses, where EXTENSION_ALIASES will be empty unless the env var was set. This makes aliased files silently skip extraction when parallel mode is used. Severity: action required | Category: correctness How to fix: Propagate aliases to workers Agent prompt to fix - you can give this to your LLM of choice:
We noticed a couple of other issues in this PR as well - happy to share if helpful. Found by Qodo code review |
…s-env # Conflicts: # README.md
|
Resolved in 8598553. I added a regression test that forces the Validation: |
There was a problem hiding this comment.
Graphify reviewed this change.
Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.
Formal verification. 1 change(s) tested, no difference found (not proven).
Graphify review — findings
This PR adds support for user-defined custom file extension aliases, letting projects map non-standard extensions to canonical ones graphify already supports (e.g. treating .pic as .php). Aliases can be configured via the GRAPHIFY_EXTENSION_ALIASES environment variable or the new register_extension_alias() function, and the changes thread alias resolution through file classification (detect.py), file discovery (collect_files), and AST extractor dispatch (extract.py), including propagation to parallel worker processes. The surface area also includes a refactor of collect_files to iterate once over all files and filter by suffix rather than globbing per-extension, plus new README documentation and a test suite covering alias registration, case normalization, and classification behavior.
Worth a look
- collect_files case-normalization changes collected set for uppercase suffixes —
graphify/extract.py:4071· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review Execution auto-disposal is off for this run; enable it (with sandbox isolation) to have Graphify try to confirm or refute this automatically.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 495 functions depend on the 297 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract()— 17 callers, 10 callees - worse:
collect_files()— 12 callers, 4 callees
Verification — 495 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 492 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify collect\_files.
The verifier did not have enough to check collect\_files, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `target` is annotated `Path` — outside the synthesizable primitive/collection set
No difference found (not proven): No behavior difference found in extract (not a proof).
The verifier ran both versions of extract on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify extract\_js.
The verifier did not have enough to check extract\_js, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_extract\_parallel.
The verifier did not have enough to check \_extract\_parallel, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `effective_root` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_get\_extractor.
The verifier did not have enough to check \_get\_extractor, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. 1 change(s) tested, no difference found (not proven).
Graphify review — findings
This PR adds support for user-defined custom file extension aliases, letting non-standard extensions (e.g. .pic) be treated as a known canonical extension (e.g. .php). Aliases can be registered via a new register_extension_alias() function or the GRAPHIFY_EXTENSION_ALIASES env var, which is parsed at module import in detect.py. The extract.py changes wire aliases into the extractor dispatch, file collection, and the Python/Java cross-file resolution filters via a _canonical_suffix() helper, and propagate aliases to parallel-processing workers through a pool initializer. The change also adds README documentation and new tests covering alias registration, classification, discovery, and env-var parsing.
No blocking issues surfaced. 5 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 495 functions depend on the 297 functions this change touches.
Health — this change adds coupling hotspots:
- new:
detect()— 22 callers, 11 callees - new:
extract()— 17 callers, 10 callees - new:
main()— 3 callers, 42 callees - new:
run_pipeline()— 8 callers, 13 callees - new:
_extract_generic()— 12 callers, 5 callees - new:
extract_go()— 12 callers, 5 callees - new:
extract_julia()— 12 callers, 5 callees - new:
collect_files()— 12 callers, 4 callees - …and 7 more
Verification — 495 functions in the blast radius were not formally verified this run (proofs are advisory here).
Health delta baseline: last indexed commit 7281f27 (diverged from this PR's base — delta is approximate).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 492 function(s) in the blast radius were not formally verified this run
Formal verification
Could not verify: Could not verify collect\_files.
The verifier did not have enough to check collect\_files, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `target` is annotated `Path` — outside the synthesizable primitive/collection set
No difference found (not proven): No behavior difference found in extract (not a proof).
The verifier ran both versions of extract on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify extract\_js.
The verifier did not have enough to check extract\_js, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_extract\_parallel.
The verifier did not have enough to check \_extract\_parallel, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `effective_root` is annotated `Path` — outside the synthesizable primitive/collection set
Could not verify: Could not verify \_get\_extractor.
The verifier did not have enough to check \_get\_extractor, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 1 grounded finding(s) anchored inline below; 14 more finding(s) on lines outside this diff (see the check run).
Summary
Adds an opt-in mechanism for projects whose source files use non-standard extensions for languages graphify already supports. The motivating case is a codebase that uses
.picfor files that are valid PHP — today those files are silently dropped at every stage (detection, collection, AST dispatch).This PR introduces:
graphify.detect.register_extension_alias(custom, canonical)— public helper that adds the custom extension toCODE_EXTENSIONS(orDOC_EXTENSIONS) and records the mapping in a newEXTENSION_ALIASESdict. Validates that both arguments start with.and that the canonical extension is already known.GRAPHIFY_EXTENSION_ALIASESenv var — comma-separatedcustom:canonicalpairs applied automatically whengraphify.detectis imported. Malformed pairs and unknown canonicals are skipped silently so a bad config never crashes the pipeline._get_extractor()andcollect_files()consult the alias map, so aliased files are routed to the canonical extractor and discovered during file walks. Routing the alias lookup through_get_extractor(rather than mutating a local dispatch dict inextract()) keeps a single source of truth and means both the sequential andProcessPoolExecutorparallel paths pick up aliases consistently — a runtime call toregister_extension_alias()takes effect immediately without re-running setup.Example
Or programmatically:
Why an env var
Same pattern as
GRAPHIFY_WHISPER_MODEL— keeps the slash-command invocation untouched while allowing per-project configuration. Drop-in from prep scripts and CI without rewriting any of the skill flow.Tests
Added to
tests/test_detect.py:collect_filesandextractusing a tiny.picfile with PHP contentTest plan
pytest tests/test_detect.py -v— 40 pass (29 existing + 11 new)pytest tests/ --ignore=tests/test_install.py --ignore=tests/test_transcribe.py --ignore=tests/test_claude_md.py— 454 pass; the 5 pre-existing SQL failures onv6reproduce on a clean checkout and are unrelated to this change.GRAPHIFY_EXTENSION_ALIASES=".pic:.php" python -c "from graphify.detect import classify_file; from pathlib import Path; print(classify_file(Path('foo.pic')))"returnsFileType.CODENotes
EXTENSION_ALIASESis exported as a public name ongraphify.detectso downstream tooling can introspect what's registered.