Resync Rust port to graphify-py v0.8.44 (dce54a0)#23
Conversation
Update the pinned `hk` version in `mise.toml` and the `amends`/`import` package URLs in `hk.pkl` from `1.46.0` to `1.48.0` so the pre-commit hook runner and its config schema stay in lockstep on the upstream release. Glory to the Omnissiah
Port the v0.8.40-0.8.44 behavior changes from the `graphify-py` submodule (`c4689a2..dce54a0`) across the Rust workspace, preserving behavioral parity with the Python reference. Ports: - extract: JS/TS assignment-form symbols, package.json workspace imports, Java records + `object_creation` constructor calls + cross-file type-reference resolution, Swift module anchors + cross-file member-call resolution, Markdown link edges, PowerShell `.psm1`/`.psd1` imports, package-manifest ingestion, and node-id unification via `build::normalize_id` - build: `dedupe_nodes`/`dedupe_edges`, ambiguous ghost-merge skip, edge `source_file` backfill, `build_merge` stale-source pruning - dedup: plain-Jaro scoring for cross-file long labels, numeric-token and cross-file file-anchored merge guards - llm: `OPENAI_BASE_URL`/`OPENAI_MODEL` and `ANTHROPIC_BASE_URL`/ `ANTHROPIC_MODEL` endpoints, openai output-token cap, non-dict `parse_llm_json` guard, `label_communities` split-and-retry, and `file_slice` oversized-document slicing - detect: `.psm1`/`.psd1` extensions, package-manifest classification, and merged `.gitignore` + `.graphifyignore` loading - export: `community_name` in `to_json`, `to_canvas` fallback community - serve: `community_name` preference in node and subgraph rendering - hooks: reject Windows-style git hooks paths - affected: NFC-normalize `resolve_seed` - watch: dual-root changed-path resolution, no-cluster dedup - html: escape U+2028/U+2029 in the tree-html script island - cli: `explain`/`cluster-only` `community_name`, custom-endpoint help Bump the workspace version to 0.8.44 and reconcile README.md and USAGE.md. Glory to the Omnissiah
`graphify extract --no-cluster` returned before `persist_manifest` ran, so `manifest.json` was never written and every later `--no-cluster` or `update` run fell back to a full rescan instead of the incremental path. graphify-py saves the manifest in this branch too (`__main__.py:4492`). Call `persist_manifest` in the `no_cluster` branch. Output stays byte-identical: the incremental re-extract walks the same deterministically sorted changed-plus-unchanged union as a full scan, so a no-op re-run reproduces graph.json exactly. The no-op parity test now also asserts `manifest.json` is created. Glory to the Omnissiah
CodeRabbit review findings on the resync diff. `community_label` fell back to `to_string` on the `community` value, which JSON-serializes it: a community stored as a string rendered with surrounding quotes instead of matching Python's `str(...)`. Fall back through `as_i64`, then `as_str`, then `to_string` so numeric and string community ids both render unquoted, and add a parity test for the string case. `dedupe_nodes` and `dedupe_edges` built their internal dedup keys with `to_string`, yielding quoted keys. Node ids and edge endpoints are always strings, so switch to `as_str`: identical dedup classes and byte-identical output, without the surprising keys. Tighten the label split-retry test to assert exactly 3 calls (one failed full batch plus two successful halves) instead of `>= 2`, so a regression that skipped the split would now fail. Glory to the Omnissiah
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (15)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (12)
📝 WalkthroughWalkthroughThis PR updates graph extraction, merge/export, LLM processing, hooks validation, HTML escaping, docs, tests, and version metadata. ChangesPlatform metadata and docs
Graph core, export, serving, and rebuild behavior
Extraction coverage and normalization
LLM pipeline
Safety fixes
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Resolve the still-valid CodeRabbit findings from the resync review; the rest were verified as parity-intentional and left in place. Add the accented-query assertion to the accent-distinction parity test (`resolve_seed_preserves_distinct_accents`) so both sides of the distinction are covered, not just the unaccented query. Correct the `.gitignore` plus `.graphifyignore` merge comment in `ignore.rs`. It claimed a `.graphifyignore` can only ever exclude more and never re-enable a `.gitignore`-excluded file, which contradicts the documented `!`-negation last-match-wins behavior: a negation does re-enable, subject to the parent-directory exclusion rule. Mark the pure owned-returning helpers `normalize_label`, `bare_name`, `build_node_link_nodes`, `resolve_markdown_link`, `lexical_normalize`, and `js_member_assignment_target` `#[must_use]`. Drop the blanket `expect_used`/`unwrap_used` allows from the `id_normalization_contract`, `js_workspace_resolution`, `markdown_links`, and `powershell_imports` extract tests (none are `parity.rs`). The first two had no `unwrap`/`expect` left; convert the others to `?`. Glory to the Omnissiah
Resolve two genuine bugs surfaced by review and document one
non-issue in the code.
`find_workspace_root` accepted any present `workspaces` key via
`.is_some()`, but `workspace_globs` only consumes a string array or a
`{ packages: [...] }` object. A nested `package.json` with a malformed
`workspaces` (null, a string, or an object without `packages`) thus
shadowed a real workspace root higher up the tree and resolved to zero
globs, so the package import silently fell back to a bare-module hash.
Validate the shape in `find_workspace_root` so the walk only stops at a
manifest `workspace_globs` can actually use. Add a regression test.
`reject_windows_path` unconditionally rejected drive-letter and
backslash paths, but on native Windows those are valid absolute paths
that `create_dir_all` resolves. Gate the check with
`#[cfg(not(windows))]` so it still fails loudly on POSIX/WSL (where the
path cannot resolve) but accepts valid paths on Windows. Gate the
matching parity test (and its `walk_all` helper) to non-Windows.
Document in `multi.rs` why the Swift AST `receiver` field needs no
cache bypass or schema-version check: the AST cache is namespaced by
crate version, so pre-`receiver` entries are never loaded.
Glory to the Omnissiah
dc288e5 to
babd875
Compare
Summary
Resyncs the Rust port with
graphify-pyatdce54a0(v0.8.39 -> v0.8.44),porting the new behavior from the upstream delta and auditing every changed
module for parity.
Commits
f04dab4Updategraphify-pysubmodule todce54a0eb5e8c9Bumphkto 1.48.04d9363bResync with graphify-py @ dce54a0 (the port)63bb519Persist manifest on no-cluster extraction (audit fix)df01382Fix string community rendering and dedup keys (review fixes)Ported behavior (highlights)
Extraction:
object_creation, and type resolution (#1373).psd1/.psm1manifest handling (#1331 / #1341)Build / dedup / detect:
dedupe_nodes/dedupe_edgesfor the--no-clusterandupdaterawwrite paths (#1317 / #1327)
source_filebackfill (#1279) andbuild_mergesource pruning(#1344 / #1361 / #1366)
block, Jaro tiebreak (#1284 / #1243)
LLM:
oversized-document slicing (#1369)
Serve / export / hooks:
community_namedisplay with numeric fallback (#1305)find_nodetokenized matching (#1353) and the--graphflag (#1304)Audit fixes
--no-cluster: the no-cluster branch returned beforepersist_manifest, so repeat--no-cluster/updateruns fell back to afull rescan. It now writes the manifest like graphify-py; re-extraction
output stays byte-identical.
communityrendering:community_labelJSON-serialized thevalue, quoting a string community id (
"7"instead of7); it now mirrorsPython
str()via anas_i64->as_str->to_stringfallback.Value::to_stringtoas_str(identical dedup classes for the string ids that always occur, nosurprising quoted keys).
(1 failed full batch + 2 successful halves).
Documented divergences (not gaps)
tree_htmlescapes</, U+2028, U+2029 (security-equivalent to Pythonensure_ascii=True; renders identically).normalize_id/affecteduseto_lowercasevs Pythoncasefold(consistent codebase convention).
serve/mcpis--graph-flag-native (no positional graph path).Verification
cargo nextest run --workspace: 2066 passed, 2 skipped (network-gatednet_tests).cargo clippy --all-targets --all-features --workspace: clean.cargo fmt --check: clean.--base master): two rounds; the second returned 0 findings.Summary by CodeRabbit
New Features
.psd1module dependencies.Enhancements
Bug Fixes
Documentation