Repository navigation
feat(managed): project call and field-access edges into the application graph - #6260
Conversation
…on graph project_managed_application_graph dropped the call_edges and field_accesses that member Evidence already decodes, so the graph was a containment tree that could not answer who calls a P/Invoke wrapper or which methods touch a field, while reporting complete-within-inputs. In-module call/callvirt/newobj/jmp sites now become one calls edge per caller and target, and field loads, stores and address-takes become one accesses edge per method and field, each with site and per-opcode counts and member Evidence links. MemberRef and MethodSpec targets, unknown targets, ldftn/ldvirtftn loads, recursive self-calls (the graph has no self-loops), MemberRef fields and sites whose node is absent are counted by reason in limitations, and the graph is partial with that omitted_count. Add the provider-neutral accesses relation. Graph Evidence projected before these counters existed still parses, with null calls and field_accesses summaries. Fixes #4056 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; no actionable issue was found. SummaryProjects managed member observations into aggregated
No actionable correctness or security issue was found. Checks were based on source inspection; tests were not run. Whether another PR supersedes this one could not be checked because GitHub access required authentication.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Member evidence] --> B[Match method and field nodes]
B --> C[Aggregate calls and accesses]
B --> D[Count omitted sites]
C --> E[Application graph with evidence links]
D --> F[Limitations and coverage]
F --> E
Reviews (1) · Last reviewed commit: "feat(managed): project call and field-ac..." · Reviewed by Greptile |
Summary
Fixes #4056. The plan was posted on the issue before implementation. On LibreHardwareMonitor 0.9.6, the graph now answers the issue's questions directly.
NvApi.GetDelegate→NvAPI32_QueryInterfaceandNvAPI64_QueryInterface. The callers of theNtQuerySystemInformationP/Invoke declaration areCpuLoad.GetWindowsTimesand a wrapper overload.Problem and expected behavior
call_edgesrow with amethod-deftarget, acall/callvirt/newobj/jmpopcode, and both endpoints present becomes acallsedge betweenmanaged-methodnodes.field_accessesrow whose field and method nodes exist becomes anaccessesedge to themanaged-fieldnode.{kind, site_count, opcodes}, plusaccess(read/write/address) for field accesses. Edge evidence links the member Evidence.limitationsrather than dropped silently:ldftn/ldvirtftnfunction-pointer loads (references, not calls)partialwithomitted_countequal to the omitted sites when nothing else is incomplete. When other omissions exist (partial input, selection),omitted_countstaysnull.summarygainscallsandfield_accesses.Change and scope
src/domain/managed/managedApplicationGraphRelations.ts, which aggregates edges and counts omissions. The omission types and their total live inmanagedApplicationGraphCoverage.ts, so the modules have no import cycle.accessesis added to the provider-neutral relation vocabulary. No existing relation fits data reads and writes, and traces need no allowlist change.calls: nullandfield_accesses: null. Null means "not projected", not zero. This follows the existingnullable().default(null)pattern for older Evidence. A reconstruction-candidates test caught that older Evidence would otherwise stop parsing.Contract and boundary impact
Semantic owner and earliest changed stage:
src/domain/managedprojection, using member Evidence that already exists. No new parsing.Contribution scope fit and linked maintainer decision: static, read-only. The direction was agreed in the issue thread, and the proposal was posted there.
CLI and MCP/tool-catalog contract: same inputs. Additive output: the
summary.callsandsummary.field_accessescounters, the new edge relations, and coverage that is nowpartialwith named omissions. The tool description mentions the new edges.Provider/platform compatibility: none.
Evidence/provenance: edges carry exact member-Evidence links and
managed-static-analysisobserved/exact evidence, the same as the existing member-derived nodes.Generated metadata: no committed outputs;
metadata:checkpasses.Read existing files or captured data.
Evidence and regression coverage
tests/composition/analysis-sessions/managedApplicationGraph.test.ts), using a real CIL fixture with two methods that share a body:call/callvirt/selfcall/ldftn/MemberRefcall/ldfld/stfld/ldflda.callsedges: one direction aggregates{call:1, callvirt:1}, the reverse has{call:1}. Also exactaccessesedges,summary, evidence IDs,omitted_count: 7, and the limitation text.missing-nodecounts.c537c52c9):contains: 12240, imports: 97, nocalls,complete-within-inputs, the same as the issue reports.Real-data before/after: LibreHardwareMonitor 0.9.6
LibreHardwareMonitorLib.dllThe DLL's SHA-256 is
6ebc1943…f66bf0and the zip's is086d9f1b…c001, both matching the issue. Inputs were artifact, members and native-boundary Evidence. Runs usedrea project-managed-application-graph g-in.json --format json, 3 warm runs each, on macOS arm64.contains12,240,imports97)calls3,076,accesses4,038)complete-within-inputspartial,omitted_count12,668…call sites are omitted: 12013 member-reference, 395 generic method-instantiation, 163 function-pointer (ldftn/ldvirtftn), 3 recursive self-call.and…field-access sites are omitted: 94 member-reference.Aggregation keeps the graph proportional to distinct relationships rather than sites: 10,651 in-module call sites become 3,076 edges, and 7,424 field-access sites become 4,038 edges.
Remaining proof gaps:
containsedges pay.Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npm run test:local -- tests/composition/analysis-sessions/managedApplicationGraph.test.ts src/contracts/workflowInputContracts.test.ts src/application/ReconstructionObligationCandidates.test.ts src/contracts/toolEffects.test.ts src/domain/javascript/javascriptApplicationGraph.test.ts: passed. Before the historical-schema fix, 2 reconstruction-candidate tests failed (they pass on main); after the fix the graph and reconstruction files pass, 21 + 6 tests.npm run test:focused -- tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts: 32 passed.npm run check:fast: passed.npm run format:check: passed.npm run docs:check: passed.npm run metadata:check: passed.Compatibility, safety, and release
complete-within-inputsas the normal state will now seepartialfor graphs with external calls, with the omitted classes named in limitations.Author readiness
Human owner: @kaoru0822-kitauji
Before merge
type(scope): outcome.🤖 Generated with Claude Code