Files
verstack/docs/function-comparison.md

2.6 KiB

Function comparison reports v2

The core compares retained function inventories through the Rust API, functions BASELINE BASELINE_PATH TARGET TARGET_PATH, or GET /api/functions/compare with the same four parameter names (before, before_path, after, after_path). Baseline and target identify selection order; they do not establish publisher chronology.

Schema 2 / method exact-functions/2 matches unique exact SHA-256 body hashes of equal size (at least 32 bytes), excluding thunks and unavailable hashes. Names and addresses are never matching evidence. Duplicate addresses invalidate an inventory. Ambiguous body hashes remain unmatched. Address sets avoid a quadratic scan when assembling unmatched results.

The report includes both unmatched inventories, target-side reasons (no_exact_body_match, ambiguous_exact_body, thunk_excluded, below_minimum_size, body_hash_unavailable), and both source snapshots, function-facts artifact identities, paths, analysis run IDs, and release metadata. Edition and repository differences are disclosed. A function match does not establish equal behavior, data references, or the provenance of a feature. No names are transferred.

For schema-1 function facts, compatibility requires equal language, compiler, Ghidra version, and settings except the documented executable-selection field paths. Policy schema1_settings_except_paths_v1 is recorded in each report. Every unknown future setting remains significant. This changes comparison eligibility, never retained analysis facts. Tool-version changes still require compatible new analyses.

Use --save on the CLI command, or POST /api/functions/compare with the four fields in a JSON body, to retain function-comparison.json through the normal verified publication path. POST requires X-Verstack-Client: 1. A new processing run records both input artifacts and snapshot/path selectors. The derived snapshot uses the target as its parent; the report retains the baseline relationship too. Saved reports can be restored or downloaded independently and do not replace previous reports. Future garbage collection must follow both input relationships.

The WebUI initially displays unmatched target functions and supports baseline unmatched functions, exact matches, filtering, and pages of 100 rows. Save report to archive preserves a computed report; View report reopens a retained report without recomputing it. tests/ui-functions.mjs tests this flow using synthetic intercepted responses and no listener.

BSim, structural matching, global function search, and automatic symbol propagation are still pending.