Context
In PR #1487 (fix(bench): add warmup runs to incremental tiers in benchmark.ts), a confidence sort was added to src/domain/graph/builder/stages/build-edges.ts:1115-1121 to align the WASM engine's edge dedup behavior with the native engine's sort_targets_by_confidence call.
Problem
There is no regression test covering this ordering guarantee. A future refactor could silently revert the sort and the WASM engine would again emit the wrong (lower-confidence) edge when duplicate (source_id, target_id) pairs appear in the targets array.
Task
Add a unit or integration test to tests/ that:
- Sets up a call site with multiple resolution candidates for the same
(source, target) pair where the candidates have different confidence scores.
- Asserts that the emitted edge corresponds to the highest-confidence target — not the first one encountered.
This test should cover the WASM engine path (build-edges.ts) and run in CI to prevent the sort from being silently removed.
Reference
Context
In PR #1487 (
fix(bench): add warmup runs to incremental tiers in benchmark.ts), a confidence sort was added tosrc/domain/graph/builder/stages/build-edges.ts:1115-1121to align the WASM engine's edge dedup behavior with the native engine'ssort_targets_by_confidencecall.Problem
There is no regression test covering this ordering guarantee. A future refactor could silently revert the sort and the WASM engine would again emit the wrong (lower-confidence) edge when duplicate
(source_id, target_id)pairs appear in the targets array.Task
Add a unit or integration test to
tests/that:(source, target)pair where the candidates have different confidence scores.This test should cover the WASM engine path (
build-edges.ts) and run in CI to prevent the sort from being silently removed.Reference
src/domain/graph/builder/stages/build-edges.tslines 1115-1121sort_targets_by_confidenceinbuild_edges.rs