Optimize graph reports and low-inference graph execution - #214
Open
forhappy wants to merge 12 commits into
Open
Conversation
forhappy
force-pushed
the
codex/community-label-stability
branch
from
August 10, 2026 19:56
eb4d346 to
17c1b5f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR covers the graph-report, inference, performance, and query-quality session scope:
GRAPH_REPORT.mdcommunity labels concise, deterministic, and unique without changing opaque community identities;low|medium|high|maxinference profiles while retainingmaxas the compatibility default;Implemented mitigations
Earlier inference admission
Inference policy is applied to coalesced raw records before node-link materialization. Calls are suppressed only when their inferred provenance is known and safe to exclude; unresolved endpoints, constructible targets, metadata relationships, hyperedge references, unknown provenance, and duplicate-evidence collisions remain conservative. Orphan cleanup is reference-aware.
Native testing found and fixed an overly broad collision key: occurrence protection now includes source and target, so true duplicate evidence remains protected without treating unrelated sparse call records as one collision group. This still does not eliminate every extraction and cross-file-resolution cost.
Bounded incremental clustering
Incremental builds reuse prior clustered artifacts for fact-neutral changes. Topology-changing updates recluster changed sources, touched communities, and their boundary closure under explicit node and ratio limits. Node deletion, missing prior assignments, invalid bounds, or oversized regions deterministically fall back to full Louvain clustering.
Query specificity and startup
Discovery separates entity-subject tokens from action predicates, restricts production roots to source-backed representation types, adds bounded composite-initialism matching, and rejects isolated generic subword noise. Immutable-store queries reuse graph identity, generation, and partial-build metadata from the first reader instead of reopening the snapshot for the same information.
Native compilation also caught and fixed operation-predicate set intersection before publication.
Independent accuracy oracles
The focused suite pins delta-rs at
c27874c10043b5ccf0207d27eee148be0a033c6eand contains 20 positive symbol/file/line labels plus five negative controls, each with an independent judgment source and rationale. Compass validation checks typed identity, anchors, direction, ambiguity/no-match behavior, and bounded work. Graphify is scored against the same declared seed identity and anchor rather than against tool agreement.Fresh post-mitigation replay
The complete focused comparison ran at Compass
54b69f39, Graphify09a34ad8, and the pinned delta-rs commit. It used three full build repetitions, ten measured batches for every query, one unmeasured warmup per query mode, release binaries, low inference, and clustering for both tools. The harness completed and intentionally exited nonzero because declared qualification gates were missed; no threshold or oracle label was weakened.The incremental p50 improved from the earlier 4.111 s to 1.218 s, and peak RSS fell from 1,312.2 MiB to 141.11 MiB. Cold cost and memory remained essentially unchanged, showing that admission must move farther upstream of resolver allocations.
All ten batches produced identical ranking evidence. No positive row passed both tools' strict eligibility checks, so this replay does not support a positive-query cross-tool speed claim. Both tools passed all five negative rows: Compass fresh p50 was 0.084–0.606 s versus Graphify 0.539–0.686 s. Compass exceeded 5x on one negative row and achieved 1.12x–1.33x on the other four.
The low graph contained 9,982 nodes and 25,206 relationships versus Graphify's 9,670 and 27,173. All Compass relationships carried exact evidence; only 100 (0.40%) were convention-origin, versus Graphify's 1,031
INFERREDrelationships (3.79%). The source-aware compatibility comparator still reported 82 missing/two ambiguous Graphify node hypotheses and 4,957 missing/36 ambiguous Graphify edge hypotheses. These are compatibility diagnostics, not ground-truth precision or recall.The replay therefore validates the incremental-clustering and ranking mitigations, but does not meet the 5x cold/query or cold-memory goals. The remaining priorities are earlier resolver admission, cold peak-memory reduction, the 12 failed positive rankings, and non-startup query search cost. Full evidence and claim boundaries are recorded in
docs/implementation/low-inference-graphify-evaluation.md.Compatibility
maxinference behavior by default.Validation
Native code validation at
54b69f39passed from the clean detached PR worktree:cargo fmt --all -- --checkcargo clippyfor graph/query/core/store with all targets, all features, and-D warningscargo clippy --workspace --lib --bins --locked -- -D warningscargo test --workspace --lib --bins --lockedcompass-graph,compass-query,compass-store, andcompass-coresuitescargo test -p compass-cli --test compass_product --lockedsh scripts/check_product_boundary.sh./scripts/qualify_code_graph_v1.sh --fixtures-onlyFixture qualification produced deterministic clean/warm/rebuild/restored/alternate-checkout byte equality with graph digest
sha256:ede1befdb08d19a487a7d006cff15b0a9047cf1a84367eb7a65d2e5dc7d5e7f7.All 14 GitHub checks passed at the validated code head. Commit
410ec0a0only adds the dated replay evidence to the evaluation document.Review focus
The highest-risk areas are conservative inference admission, deletion/boundary behavior in incremental clustering, and ranking eligibility versus ranking-only synonyms. Regression tests cover each boundary, and the repository baseline plus code-graph qualification pass at the pushed code head.