Skip to content

feat(truth): emit derived rollups + per-project open_high_critical#77

Merged
saagpatel merged 1 commit into
mainfrom
refactor/truth-rollups
Jun 20, 2026
Merged

feat(truth): emit derived rollups + per-project open_high_critical#77
saagpatel merged 1 commit into
mainfrom
refactor/truth-rollups

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

What

First half of the T3-3 cross-repo drift fix. PortfolioCommandCenter currently re-implements this auditor's risk/security logic in three places (openHighCritical in TS, a Rust tally in lib.rs, and decisionModel). This PR makes the auditor emit the derived rollups into portfolio-truth-latest.json so PCC can read them and delete its mirrors (PR-B, separate repo).

Changes (additive — schema 0.6.0 → 0.7.0)

  • New top-level rollups block: risk_tier_counts (elevated/moderate/baseline/deferred), security (scanned_count, repos_with_open_high_critical, total_open_high, total_open_critical), decision (decision_needed_count, default_attention_count).
  • Per-project security.open_high_critical: the existing @property is now included in to_dict().
  • PortfolioTruthRollups is computed in __post_init__ from the project list, so it can never drift from the source data.

Backward-compatible: only adds keys; existing readers are untouched.

Verification

  • ruff check src/ tests/ — clean
  • uv run pytest -q2493 passed, 2 skipped
  • New test pins the rollups + open_high_critical contract.

Cross-repo sequencing

This is PR-A. After merge, regenerate portfolio-truth-latest.json (audit run) so the live file is 0.7.0, then PR-B in PortfolioCommandCenter consumes the new fields and deletes the duplicated openHighCritical + simplifies the Rust history tally (prefer rollups, fallback compute for pre-0.7.0 snapshots).

Add a top-level `rollups` block (risk-tier counts, security high+critical
totals, decision counts) and the per-project `security.open_high_critical`
field to portfolio-truth-latest.json, so downstream consumers read the
auditor's derived risk/security logic instead of re-implementing it — the
#1 cross-tool drift risk.

- New PortfolioTruthRollups dataclass, computed in __post_init__ from the
  project list so it can never drift from the source data
- SecurityFields.to_dict now includes the open_high_critical property
- Schema 0.6.0 -> 0.7.0 (additive, backward-compatible)

Verified: ruff check clean; 2493 passed, 2 skipped.
@saagpatel saagpatel merged commit 8daeece into main Jun 20, 2026
3 checks passed
@saagpatel saagpatel deleted the refactor/truth-rollups branch June 20, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant