Skip to content

feat(review): order-independent review finding consolidation with a permutation test #608

Closed as not planned

Description

@dan-petty

Context & Rationale

Follow-up to #512. consolidate_duplicate_findings (src/devops_cli/ai/review_schema.py:1029) is a greedy first-match fold over _are_findings_duplicate (:866), which is not transitive. _merge_two_findings (:932) keeps the first argument's title and location, joins personas and list fields in arrival order, takes the first non-empty category and relocated_from, and gives description and fix length ties to it. sort_findings (:1048) has no total tie-break. Worker completion order never reaches the fold (ai/agents/pipeline.py:264, ai/review/pool.py:126); model emission, persona and segment order do (ai/review/pipeline.py:1838, :2405; ai/review/runner.py:457; ai/review/verification.py:1581 via ReviewResult.merge). Verification reads the folded list (pipeline.py:2165), so the kept anchor decides what gets checked. No test reorders the input. vibes' CRDT has the same blind spot: its one commutativity test swaps a single pair and passes.

Scope & Deliverables

  • Context & Rationale*: Follow-up to fix(review): findings are lost between the model reply and the report #512. consolidate_duplicate_findings (src/devops_cli/ai/review_schema.py:1029) is a greedy first-match fold over _are_findings_duplicate (:866), which is not transitive. _merge_two_findings (:932) keeps the first argument's title and location, joins personas and list fields in arrival order, takes the first non-empty category and relocated_from, and gives description and fix length ties to it. sort_findings (:1048) has no total tie-break. Worker completion order never reaches the fold (ai/agents/pipeline.py:264, ai/review/pool.py:126); model emission, persona and segment order do (ai/review/pipeline.py:1838, :2405; ai/review/runner.py:457; ai/review/verification.py:1581 via ReviewResult.merge). Verification reads the folded list (pipeline.py:2165), so the kept anchor decides what gets checked. No test reorders the input. vibes' CRDT has the same blind spot: its one commutativity test swaps a single pair and passes.
  • Deliverable*: First, a test that fails today: run the fold over itertools.permutations of four fixtures (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, the recorded _watcher session) and assert one distinct set of (title, location, severity, sorted personas) and, separately, one distinct sequence. Then pre-sort by a total key (parsed file and start line, lower-cased title, persona, full dump). Join a cluster only when _are_findings_duplicate holds against every original member (complete linkage), and merge after clustering. Keep the title and location with the highest severity, then the narrowest parsed span, then the key, so _watcher keeps k8s/informer.py:44-112. Sort list fields, pick scalars by the same key, and add location and title tie-breaks to sort_findings. Stdlib only. Measure by offline replay: capture the lists reaching the fold in one feat(review): synthetic defect corpora for review evaluation #415 corpus run and count those with more than one output under the old and new fold.
  • Constraint*: A canonical order alone makes an over-merge deterministic, not rare: with the bridging finding first, the 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. Connected components (networkx) merge the chain by definition. Conservatism comes from complete linkage; determinism from the order. A test comparing entry counts passes on _watcher, where the count is 3 in every order and only the anchor and output order move. Sorting raw location strings puts a.py:10 before a.py:9, the same string comparison as the vibes CRDT pos sort. FindingCluster.representative (security/normalization.py:237) is no model: same tool and rank keep the first seen.
  • Measured*: uv run --no-sync python scratchpad/probe/consolidate_probe.py: a chained triple gives 3 distinct outputs over 6 orders. uv run --no-sync python scratchpad/probe/l302_perm_probe.py: the fix(review): findings are lost between the model reply and the report #512 pair merges into 2 different findings over 2 orders. uv run --no-sync python scratchpad/probe/l302_perm_probe2.py: _watcher gives 12 sequences but 2 entry sets over 24 orders. uv run --no-sync python scratchpad/probe/v436_value_probe.py: bridging-first, the pre-sorted fold leaves 1 entry; complete linkage leaves 2.
  • Source*: vibes examples/ast-crdt-collaborative-editor/ast_crdt.py, vibes examples/ast-crdt-collaborative-editor/test_ast_crdt.py, vibes patterns/ast-crdts-for-real-time-agent-collaboration.md, vibes observations/systems/37-real-time-ast-crdts-and-concurrent-multi-agent-swarms.md

Strategic Alignment

  • Milestone: v0.2.23 (devops ai Review Quality, LLM Routing & Multi-Language Validation)
  • Roadmap Reference: docs/ROADMAP.md

Activity

  1. added this to the v0.2.23 milestone on Sep 25, 2026
  2. added
    type/feature
    scope/review
    priority/p2-medium
    on Sep 25, 2026
  3. modified the milestones: v0.2.23, v0.2.24 on Sep 28, 2026
  4. removed this from the v0.2.23 milestone on Oct 1, 2026
  5. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Moved from the shipped v0.2.23 to the backlog. It is still valid (checked 2026-10-01), and P2 items don't displace P1 work in the planned releases.

  6. added
    priority/p1-high
    type/bug
    and removed
    type/feature
    priority/p2-medium
    on Oct 2, 2026
  7. added this to the v0.2.28 milestone on Oct 2, 2026
  8. dan-petty commented on Oct 2, 2026

    @dan-petty
    OwnerAuthor

    Grooming (2026-10-02): Priority p2-medium → p1-high. Reproduced order-dependent loss of review findings and a nondeterministic report. This is the same defect class as #512 (P0), and data-loss defects are at least P1.

    Placed in v0.2.28, one of its slots held for P1 work that surfaced after it was planned. Value High, effort Medium. Ready.

    Checked against the code at the release/v0.2.25 tip.

  9. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Merged into #1141 (the review redesign absorbs it, owner 2026-10-03): #1151 deletes consolidate_duplicate_findings, and this item's order-dependent, defect-losing merge problem, its permutation test over the four fixtures, complete linkage and deterministic picks are now #1141's criteria against the deduplicate and correlate that replace it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions