Repository navigation
Description
Problem
-
Today's fingerprint has no line and no content.
NormalizedFinding.fingerprinthashes tool, rule, path and canonical message [code: security/normalization.py:150-159].deduplicatekeeps the first finding per fingerprint [code: :210-224]. On the loop input, 286 ruff BLE001/C901 results collapse to 89 fingerprints [measured: d-incremental]. -
Line text is not enough.
- Of 513 BLE001 results at HEAD, 396 (77%) in 89 files share their whitespace-normalized line text with another result in the same file. Examples: 15 ×
except Exception as exc:in pipeline.py, and 12 ×except Exception:in pricing.py [measured: c-feasibility]. - An occurrence index would decide those identities. One identical line inserted above shifts every later index:
- suppressions move to another site;
- in a branch review, the new line takes the base revision's occurrence-0 identity and reads "preexisting", while the last old site reads "introduced".
- Of 513 BLE001 results at HEAD, 396 (77%) in 89 files share their whitespace-normalized line text with another result in the same file. Examples: 15 ×
-
Kube-linter results and advisories have no line.
- Kube-linter locations are
manifest:Kind/name[code: security/kubelinter.py:51]. They are 30 of the 41 tool candidates per loop run. - Nine read-only-root-fs DaemonSets in one file would be told apart only by their order.
- Kube-linter locations are
-
GitHub hashes a window, not one line.
- Its
primaryLocationLineHashis a rolling hash of the first 100 non-space characters starting at the line [sourced: github/codeql-action src/fingerprints.ts, via c-feasibility]. - Measured collisions: a 3-line window 17/513; enclosing symbol + line text 79/513 [measured: c-feasibility].
- Its
-
Merging is order-dependent and loses defects (from feat(review): order-independent review finding consolidation with a permutation test #608, merged into this item on 2026-10-03). Today's model-finding fold,
consolidate_duplicate_findings[code: ai/review_schema.py:1231-1246], is a greedy first-match fold over_are_findings_duplicate[code: :1039-1080], which is not transitive._merge_two_findings[code: :1110-1228] keeps the first argument's title and location, joins personas and list fields in arrival order, takes the first non-emptycategoryandrelocated_from, and givesdescriptionandfixlength ties to it.sort_findings[code: :1256-1272] stops at location and title, with no total key. Model emission, persona and segment order reach the fold; verification reads the folded list, so the kept anchor decides what gets checked. No test reorders the input [inference: feat(review): order-independent review finding consolidation with a permutation test #608's code trace, at an earlier commit].- A chained triple gives 3 distinct outputs over 6 orders; the fix(review): findings are lost between the model reply and the report #512 SQL-injection pair merges into 2 different findings over 2 orders; the recorded
_watchersession gives 12 sequences but 2 entry sets over 24 orders [measured: feat(review): order-independent review finding consolidation with a permutation test #608's probesconsolidate_probe.py,l302_perm_probe.py,l302_perm_probe2.py]. - A canonical order alone makes an over-merge deterministic, not rare: with the bridging finding first, a pre-sorted fold merges all three in every order, the defect loss fix(review): findings are lost between the model reply and the report #512 guards against; complete linkage leaves 2 [measured: feat(review): order-independent review finding consolidation with a permutation test #608's
v436_value_probe.py]. Connected components (networkx) merge the chain by definition. - refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 deletes that fold. Its replacement is this item's
deduplicateandcorrelate, which repeat the same order dependence:deduplicatekeeps the first finding per fingerprint [code: security/normalization.py:210-224],FindingCluster.representativekeeps the first seen on equal rank and tool [code: :248-251], and feat(review): every reported finding is admitted with its producer's anchor and a location that exists in the reviewed commit, the review writes findings.sarif, and review.md shows findings and suppressions #871 admits whatever anchor survives. rank_clustersbreaks ties on path and line only [code: security/normalization.py:284-298], so clusters equal on severity, confirmations, path and line keep their input order. A total key needs parsed locations: sorting raw location strings putsa.py:10beforea.py:9, as feat(review): order-independent review finding consolidation with a permutation test #608 found (the review sort has parsed them since_location_key[code: ai/review_schema.py:1249-1252]).
- A chained triple gives 3 distinct outputs over 6 orders; the fix(review): findings are lost between the model reply and the report #512 SQL-injection pair merges into 2 different findings over 2 orders; the recorded
Acceptance criteria
- Fingerprint v2 for a result with a region = sha256 of:
- tool and rule id;
- repo-relative path;
- the enclosing qualified symbol from the pre-analysis outline (
<module>at module level); - a window hash over the first 100 non-whitespace characters starting at the flagged line.
- An occurrence index is added only among results still equal on all of these.
- A result without a region takes its identity from SARIF
logicalLocations:kind/namespace/name[/container]for Kubernetes objects, andpurl@versionfor advisories. - Stability tests:
- a non-identical line and an identical line inserted above each leave every other fingerprint unchanged;
- two distinct sites give two fingerprints;
- inserting a tenth DaemonSet leaves the other nine objects' fingerprints unchanged.
-
deduplicateanddevops scankeep all 3 rows of a fixture with 3 BLE001 hits in one file. - A tool's own
partialFingerprintsare kept as a property, not as identity. -
correlation_keyuses (path or logical location, overlapping region, CWE) [code: normalization.py:162-169]. - A fingerprint suppression still matches after an edit above the line.
- Fingerprint pins move here from test(security): pin the finding fingerprint and run-store digest to literal values #855: golden fingerprint pins and the rule that a change to the fingerprint inputs bumps the key are written against v2, not v1. test(security): pin the finding fingerprint and run-store digest to literal values #855 keeps its
run_store.digestpins and its golden SARIF; this item updates the golden's fingerprints when it bumps the key. - fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one #1045 (a P0 child that lands first) writes its symbol identity for symbol-located findings (kube-linter, Trivy, Pluto, Popeye, Dive) in this item's
logicalLocationsform (kind/namespace/name), so those findings change identity once. fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one #1045 keeps its own fingerprint bullet. - Order independence (from feat(review): order-independent review finding consolidation with a permutation test #608). A test that fails before this item runs
deduplicateandcorrelateoveritertools.permutationsof four fixtures, carried from feat(review): order-independent review finding consolidation with a permutation test #608 and re-expressed as normalized results with the same paths, lines and messages: the chained triple, a chain whose bridging finding sorts first, the fix(review): findings are lost between the model reply and the report #512 SQL-injection pair, and the recorded_watchersession. It asserts one distinct set of (fingerprint, location, severity, sorted tools) and, separately, one distinct output sequence. A test comparing entry counts does not count:_watcherhas 3 entries in every order, and only the anchor and output order move. - Complete linkage. Input is pre-sorted by a total key (parsed path and start line, then rule id, then tool, then fingerprint). A finding joins a cluster only when the correlation key (path or logical location, overlapping region, CWE) holds against every original member, and members are merged after clustering. The bridging-first chain leaves 2 clusters in every order.
- Deterministic picks. The representative and every scalar are chosen by highest severity, then narrowest parsed region, then the total key; list fields are sorted; the output order has location and rule tie-breaks.
_watcherkeepsk8s/informer.py:44-112in every order, and parsed locations sorta.py:9beforea.py:10. - Stdlib only (
itertools, no networkx). - (person-run) Offline replay: the finding lists reaching
deduplicateandcorrelatein one feat(review): synthetic defect corpora for review evaluation #415 corpus run are captured, and the number of lists with more than one output across permutations is counted before and after, recorded in the task file. - (person-run)
devops scanrow counts oversrc/before and after, plus the number of identities that needed an occurrence index, recorded in the task file. - Tests run offline with fakes and recorded tool output: no network, no real scanner, no model; each test under 1 s.
-
changelog.d/<n>.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited. -
uv run devops cipasses.
Key questions
- Why symbol + window? (proposed) Line text alone collides on 77% of BLE001 results, and a window collides on 3%. The symbol keeps identities stable when code moves within a file.
- Renaming a function? (proposed) Its findings get new identities. That is acceptable in a change review, and rule + path-glob suppressions are unaffected.
- Migrate stored fingerprints? (proposed) No (pre-1.0).
review scorereads old sessions by cluster keys. - feat(review): order-independent review finding consolidation with a permutation test #608? Decided (owner, 2026-10-03): the review redesign absorbs it. Its problem and criteria are carried here, against the merge that replaces the fold refactor(review): the persona review stage, the legacy segment engine and review-time RAG are deleted, and devops review builds a model client only for the explanation stages #1151 deletes, and feat(review): order-independent review finding consolidation with a permutation test #608 closes as merged into this item.
Strategic alignment
- Milestone: none; the roadmap tooling places it. Blocks: feat(review): every reported finding is admitted with its producer's anchor and a location that exists in the reviewed commit, the review writes findings.sarif, and review.md shows findings and suppressions #871. Absorbs: feat(review): order-independent review finding consolidation with a permutation test #608 (order-independent consolidation; closed as merged into this item). Related: fix(security): kube-linter findings carry their own check, message and manifest file, and scan reports keep each one #1045 (P0 child), feat(review): feedback export counts each review subject once and keeps every human verdict #877 (blocked by this item: its dedup key becomes fingerprint v2), feat(review): publish scanner findings to code scanning #419 (its SARIF upload needs a fingerprint with no line number), test(security): pin the finding fingerprint and run-store digest to literal values #855 (SARIF contract suite).
- Parent: feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137 (phase P1a).
- Evidence tags ([measured: …], [code: path:line], [sourced: …], [estimate], [inference]; "S11" is the single review run of 2026-10-03 and "the loop" the ten runs S12–S21; c-feasibility and c-fidelity are the two design critiques) are explained in feat(review): evidence-first code review — tools find, version-pinned facts ground, models explain and plan, fixes are re-checked #1137.
Update 2026-10-08: refinement
#871 shipped compute_fingerprint_v2 (review/fingerprint.py:26-60) for admission (review/admission.py:154-175), so 'Blocks: #871' no longer applies. Open: devops scan uses v1 (security/normalization.py:156-166); advisories are located at <manifest>:<line> (ai/review/pipeline.py:830), not purl@version; kube-linter and Pluto omit the namespace until #1045. The PR builds on review/fingerprint.py. #1352 takes this item's object form, #771 keys verdicts on it, and #1353's match needs purl@version.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Placed in v0.2.31 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: finding identity v2, URL credential masking, tests that leave no state, the Docker endpoint check and the Argo CD/OTel perimeters. Position 2 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
dan-petty commentedon Oct 9, 2026
Folded in from the #1045 re-scope (2026-10-09)
Trivy and Dive identity moves here from #1045: they are not Kubernetes objects, so their identity is the advisory's
purl@version. Note for this item's refinement: after #1045 only kube-linter carries the namespace (Kind/<namespace>/<name>); Pluto gets it with #1434.fix(security): fingerprint v2 and deterministic correlation (#1141) (#…
dan-petty-bot commentedon Oct 9, 2026
What changed
#1487, merged into
release/v0.2.31as a525a81.11 file(s) changed.
How it was verified
Check runs at 739e319:
Acceptance Criteria of
docs/agent/tasks/task-1141-fingerprint-v2-and-deterministic-correlation.md:test_a_finding_without_a_symbol_keeps_its_fingerprint).logicalLocations:kind/namespace/name[/container]for Kubernetes objects, andpurl@versionfor advisories (test_a_finding_without_a_region_takes_identity_from_logical_locations_or_purl).test_fingerprint_v2_stability_on_unrelated_insertions,test_fingerprint_v2_distinguishes_distinct_sites,test_fingerprint_v2_daemonset_stability,test_fingerprint_suppression_matches_after_edit_above_line).deduplicateanddevops scankeep all 3 rows of a fixture with 3 BLE001 hits in one file (test_deduplicate_and_scan_keep_all_rows_of_ble001_fixture).partialFingerprintsare kept as a property, not as identity (test_a_tools_own_partial_fingerprints_are_kept_as_a_property_not_identity).correlation_keyuses (path or logical location, overlapping region, CWE)."devopsCli/v2".deduplicateandcorrelateproduce identical sets and output sequences overitertools.permutationsacross 4 fixtures: chained triple, bridging-first chain, fix(review): findings are lost between the model reply and the report #512 SQL injection pair, and recorded_watchersession (test_order_independence_across_permutations).test_bridging_first_chain_leaves_two_clusters_in_every_order)._watcherkeepsk8s/informer.py:44-112in every order; parsed locations sorta.py:9beforea.py:10(test_watcher_session_keeps_informer_range_in_every_order,test_cluster_ranking_sorts_parsed_location_numerically).itertools, no networkx).changelog.d/1141.mdrecords the change;CHANGELOG.mdanddocs/ROADMAP.mdare not edited.uv run devops cipasses.deduplicateandcorrelatein one feat(review): synthetic defect corpora for review evaluation #415 corpus run are captured, and the number of lists with more than one output across permutations is counted before and after, recorded in the task file.devops scanrow counts oversrc/before and after, plus the number of identities that needed an occurrence index, recorded in the task file.feat(release): v0.2.31 (#1490)
feat(review): the feedback export counts each review subject once and…