Skip to content

feat(review): feedback export counts each review subject once and keeps every human verdict #877

Closed

Description

@dan-petty

Context & Rationale

export_invalidated_feedback writes one record for every finding in every session directory (src/devops_cli/ai/review/exporter.py:145-153). A re-review, or devops review benchmark (3 sessions by default, src/devops_cli/config/defaults.py:391), writes the same finding once per session. findings.json stores no session id, so FeedbackRecord.session_id falls back to the directory name (exporter.py:82).

Human verdicts are the only labels in the export that a person wrote. They are written by devops review verify (by = "human", src/devops_cli/commands/review.py:1062). #607 records each session's subject and adds one session reader that counts one session per subject: the one with the most human verdicts, then the newest. Exporting only that session would still lose human verdicts recorded on a different session of the same subject.

Scope & Deliverables

Deliverable: export_invalidated_feedback reads sessions through the #607 reader.

  • For each subject, export the counted session's findings.json findings.
  • Then take each human-verdict finding from that subject's other sessions:
    • If _are_findings_duplicate (src/devops_cli/ai/review_schema.py:887) matches it to an exported record, that record takes the human verdict.
    • Otherwise it is exported as its own record.
  • Target-only and unkeyed sessions export all their findings, as today.
  • FeedbackRecord gains subject_key: str | None.

Acceptance criteria: all are tmp_path tests with structural tuple assertions.

  1. Three sessions with one subject and the same two findings export 2 records.
  2. Two sessions of one subject each hold a human verdict on a different finding. The export has 2 records, and both carry the human verdict.
  3. Two sessions of one subject hold different human verdicts on the same finding. The export has 1 record, with the newer verified_at verdict.
  4. A target-only session and an unkeyed session each export all their findings.
  5. devops review export-feedback (CliRunner) prints the deduplicated count.
  6. Each new test runs in under 1 s (uv run pytest tests/test_review_exporter.py --durations=0), and uv run devops ci passes.

Key questions:

  • Merge findings that a machine raised only in the subject's other sessions? (proposed) No. They are repeats of the same subject with model noise, and merging them deterministically needs feat(review): order-independent review finding consolidation with a permutation test #608.
  • Which matcher? (proposed) _are_findings_duplicate, the predicate that consolidation already uses. _is_matching_finding (src/devops_cli/ai/review/verification.py:2090) matches on title substrings only, which is loose across sessions. No new rule.
  • Should the export read candidates.json? (proposed) Not here. The default INVALIDATED export sees few machine invalidations, because the pipeline keeps them out of findings.json (src/devops_cli/ai/review/pipeline.py:2840-2846). Which file holds every finding with every verdict belongs to refactor(review): review session store that owns layout, fingerprints and verdicts #771.
  • When two human verdicts conflict, which wins? (proposed) The newer verified_at.

Constraint:

  • No new match rule.
  • A machine verdict never replaces a human verdict.
  • Tests use no network or model.

Strategic Alignment

Split off #607 during the v0.2.25/v0.2.26 readiness review (2026-10-01): The original #607 body planned three PRs. The export merge is a separate concern with its own merge rules, and it depends on the subject and reader that #607 adds. Keeping it out lets #607 fit one PR.

Update 2026-10-08: refinement

#950 made the exporter read candidates.json and carry subject, but its fingerprint includes the session id (ai/review/exporter.py:68-84), so a subject reviewed three times exports three records. Records group by subject_key (ai/review/history.py:64), and findings match by fingerprint v2 (#1141), not _are_findings_duplicate.

Activity

  1. added
    type/feature
    scope/review
    priority/p2-medium
    on Oct 1, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Review redesign (#1137, 2026-10-03): this item is a phase P2 child (P2-10): human verdicts and the feedback export are keyed by fingerprint v2, and a valid verdict sets CONFIRMED. It is blocked by #1141, because its dedup key becomes fingerprint v2. A person sets the native blocked-by link.

  3. added this to the v0.2.37 milestone on Oct 17, 2026
  4. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Moved to v0.2.37: v0.2.37 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)

  5. removed this from the v0.2.37 milestone on Oct 17, 2026
  6. added a commit that references this issue on Oct 28, 2026
    73d1807
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/p2-mediumscope/reviewtype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions