Skip to content

feat(findings): retention & hygiene — stale project roots, scan blow-up bounds, recurring aggregation #725

Closed

Description

@ajianaz

What

Retention & hygiene policy for the findings/reviews tables:

  • Stale project pruning: projects has 339 rows for ~20 active repos — every worktree/tmp clone ever indexed stays forever. Prune or mark projects whose root_path no longer exists, and cascade/detach their findings.
  • Bound full-repo scans: cap findings stored per scan run (configurable) and/or default --min-severity for full-repo scans. Evidence: a single Oct cora scan on gaira created 5,557 open findings = 96% of all open findings (open totals: scan 5,607 vs review 44).
  • Recurring-finding aggregation: 11,026 findings → 10,559 distinct fingerprints (only ~4% dedup). Same-class issues re-open per run instead of counting once with a last_seen/recurrence counter.
  • Optional: auto-dismiss info findings open longer than N days.

Why

cora findings list and cora debt drown in one-shot scan noise and zombie project roots — the history feels useless not because the data is worthless but because the actionable signal (44 open review findings) is buried under 5.6k scan findings pointing at paths that mostly no longer exist (e.g. /opt/data/tmp/* worktrees). retention_days exists for the legacy JSON snapshots but nothing equivalent guards the DB tables.

Testing

  • Seed DB with stale project roots → pruned, findings cascaded per chosen policy, no orphan review rows breaking debt trends.
  • Scan with cap → run stored, count bounded, summary/coverage still accurate.
  • After hygiene on gaira: findings list returns an actionable set (tens, not thousands), and historical trends remain queryable via --since.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:highscope:core

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions