Repository navigation
fix(rcfile): read .graphifyrc with utf-8-sig so a BOM doesn't drop the first key - #4538
rudycelekli wants to merge 1 commit into
Conversation
…e first key Windows PowerShell 5.1 (Set-Content -Encoding UTF8) and older Notepad save UTF-8 with a BOM. load_graphifyrc read the file as plain utf-8, so the BOM became part of the first key; unknown keys are ignored by design, so that setting (say language.inc=php) vanished without a warning. Read with utf-8-sig, as the other Windows-edited files in the repo already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the pull request, @rudycelekli. 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.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; formal verification proved 0 of 1 changed function(s) (1 sampled, not proven).
Formal verification. PR-changed functions: 1/1 verified (0 proven, 1 may-equivalent, 0 distinguished) · 0 not verified.
Graphify review — findings
Fixes load_graphifyrc silently dropping the first line of a .graphifyrc saved with a UTF-8 BOM, which is what Windows PowerShell 5.1 and older Notepad produce. The file is now read as utf-8-sig, so the BOM is stripped instead of being glued onto the first key, where it matched nothing and was ignored with no warning. A new test writes a BOM-prefixed file and checks that both the language.inc mapping and the following option are parsed.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 3303 functions depend on the 76 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
load_graphifyrc()— 11 callers, 3 callees
Verification — 3303 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: 1323 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
55 of 432 test file(s) selected (13%) via static blast radius.
tests/test_astro_extraction.py— impacttests/test_atomic_writes.py— impacttests/test_build.py— impacttests/test_cjs_module_extension.py— impacttests/test_csharp_interface_dispatch.py— impacttests/test_csharp_partial_classes.py— impacttests/test_detect.py— impacttests/test_dotnet.py— impacttests/test_ejs_extractor.py— impacttests/test_ext_tagged_id_clash.py— impacttests/test_extract.py— impacttests/test_extract_cli.py— impacttests/test_forwarding_review_findings.py— impacttests/test_hook_chain_survives_skip.py— impacttests/test_hooks.py— impacttests/test_hooks_rewrite.py— impacttests/test_ignore_file_encoding.py— impacttests/test_import_extension_resolution.py— impacttests/test_incremental_mtime_collision.py— impacttests/test_indirect_call_block_scoped_shadow.py— impacttests/test_js_exported_scalar_bindings.py— impacttests/test_js_member_collisions.py— impacttests/test_js_walk_order.py— impacttests/test_language_override_imports.py— impacttests/test_language_override_lifecycle.py— impacttests/test_language_overrides.py— impact, changed-testtests/test_language_resolvers.py— impacttests/test_languages.py— impacttests/test_loose_sibling_import_resolution.py— impacttests/test_manifest_ingest.py— impacttests/test_markdown_code_spans.py— impacttests/test_mcp_ingest.py— impacttests/test_multilang.py— impacttests/test_ocaml.py— impacttests/test_out_dir_evidence.py— impacttests/test_package_json_subpath_imports.py— impacttests/test_phantom_external_import.py— impacttests/test_pipeline.py— impacttests/test_pr10_csharp_overrides.py— impacttests/test_pr10_resolution_overrides.py— impacttests/test_pr10_watch_overrides.py— impacttests/test_python_import_resolution.py— impacttests/test_rationale.py— impacttests/test_skill_persisted_scan_options.py— impacttests/test_src_layout_import_resolution.py— impacttests/test_stale_prune.py— impacttests/test_svelte_extraction.py— impacttests/test_swift_protocol_dispatch.py— impacttests/test_symbol_resolution.py— impacttests/test_ts_new_expression_calls.py— impact- … and 5 more
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Formal verification
No difference found (not proven): No behavior difference found in load\_graphifyrc (not a proof).
The verifier ran both versions of load\_graphifyrc 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.
· 1 more finding(s) on lines outside this diff (see the check run).
What does this PR do?
load_graphifyrcread.graphifyrcas plainutf-8. Windows PowerShell 5.1 (Set-Content -Encoding UTF8) and older Notepad save UTF-8 with a BOM, which then became part of the first key (language.inc). Unknown keys are ignored by design, so the user's first setting was dropped without any warning:It now reads with
utf-8-sig, which strips a leading BOM and is identical toutf-8otherwise. That matches how build.py, cli.py, hooks.py, install.py and watch.py already read Windows-edited files.Type of change
Verification & Invariants
test_a_utf8_bom_does_not_swallow_the_first_keyintests/test_language_overrides.pyHow was this tested?
Graphify-specific checklist
I used Claude Code for this change and reviewed and ran it myself.
🤖 Generated with Claude Code