mirror of
https://github.com/Graphify-Labs/REAgraph.git
synced 2026-11-07 09:35:57 -10:00
Stress-tested the signature diff on a bigger (7-module) real REA app and found one
source of false movement: an Electron IPC channel spans the main process
(ipcMain.handle) and the preload (ipcRenderer.invoke), and REA attributes the
channel node to one file or the other from run to run. Including source_file in the
signature made an untouched channel flip add/remove on every build.
Fix: rea_signature is now kind-aware. For kinds whose source attribution drifts
(_LOCATION_UNSTABLE_KINDS = {"ipc-channel"}), the signature is kind+label only (the
channel name is the stable identity); all other kinds keep kind+label+source_file.
bench_diff_quality's descriptor uses the same rule so the measured "true delta" is
the stable-identity delta. Regression test added.
Also establishes what REA's JS graph does and does not model: modules, imports,
IPC channels/handlers, endpoints, windows, assets -- NOT individual function
definitions. So a function-level rename/removal is below its node granularity and
correctly reads as no change (the diff must not hallucinate it); the
security-relevant diffs (added/removed endpoint, IPC handler, module) are detected
exactly.
Results on TWO real corpora (bench/fixtures/diff/real = first app,
bench/fixtures/diff/real2 = bigger app), both generated via examples/rea-docker:
- pure reorder / reformat / sub-granularity change -> 0 changes (was 75-80);
- added exfil endpoint, added module, removed endpoint+handler -> detected exactly;
- precision/recall/F1 = 1.00, noise_floor = 0.00, zero spurious, zero data loss.
185 tests pass.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
9 lines
889 B
JSON
9 lines
889 B
JSON
{
|
|
"_comment": "Real REA graphs of a bigger (7-module) Electron app, generated via examples/rea-docker. Stress-tests the signature diff on harder cases. Note: REA models modules/imports/IPC/endpoints/windows, NOT individual function definitions, so a function-level change (movefunc) is below its node granularity and correctly reads as no change -- the diff must not hallucinate it.",
|
|
"pairs": [
|
|
{"name": "reorder", "a": "graphs/base.json", "b": "graphs/reorder.json", "note": "pure intra-file reorder of store.js -> ideal diff empty (the #4520 case at scale)"},
|
|
{"name": "addmod", "a": "graphs/base.json", "b": "graphs/addmod.json", "note": "added src/cache.js module + its import -> detected"},
|
|
{"name": "movefunc", "a": "graphs/base.json", "b": "graphs/movefunc.json", "note": "removed a helper FUNCTION (rand) -> below REA's node granularity, correctly 0"}
|
|
]
|
|
}
|