Skip to content

Add risk windows, exposure series and trust-center projections (long tail, part 2) - #44

Merged
therandomsecurityguy merged 1 commit into
mainfrom
dac/predictive-long-tail-2
Oct 28, 2026
Merged

therandomsecurityguy merged 1 commit into
mainfrom
dac/predictive-long-tail-2

Conversation

@therandomsecurityguy

Copy link
Copy Markdown
Owner

Summary

Completion item 5, part 2 of 2 — this completes the predictive completion plan (~/Documents/Testing/plans/2026-10-27-predictive-completion.md). 30 files, +847/−61.

Per-issue risk windows

  • New slo.ts: SLA window per severity (critical 7d, high 30, medium 90, low 180); age/burn/state/days-to-breach derived deterministically from createdAt
  • Open issues expose it on read (GET /issues, /issues/:id — nothing stored); list marks burning/breached, Status card states the window

Two new trend series

  • sloBurning: findings past 80% of their window, by severity + breached count — derived from the open issues the snapshot already reads (no extra query)
  • exposedByType: internet-exposed vertices by label — one bounded label-only read, cap 2000 + truncation flag (the cost objection answered by bound)
  • Both flow through the trends route with sanitized samples (25-type cap, label-shaped keys) and appear on the Trends page

Trust-center projections

  • While the record is OK, the publishable response attaches compact projections (metric id, per-day slope, confidence, basis/horizon, 30-day value) for open findings, backlog risk, SLO burn — one shared forecaster with the trends route (services/trend-forecast.ts)
  • Sync maps fixed metric ids to reviewed labels (public wording never comes from API text), drops unknown/out-of-range values; the sanitization tripwires scan the whole fragment; page renders "Where the posture is heading"
  • STALE/MISSING publishes nothing; unreadable trends omit projections without failing the response

Why this is safe

  • Every new number is derived from data already read or bounded by an explicit cap with a truncation flag — no unbounded query
  • Projections ride the existing publishable gate (OK only) and cross the sanitization tripwires; the only public wording is fixed in the sync layer
  • No new write surface, no identifiers; ASN attribution remains deliberately deferred with its reason recorded (external dataset + licensing)

Test plan

  • npx jest --runInBand — 20 projects / 1878 tests passed (new: SLO math + boundaries, runner sloBurning/exposure series, trends sample sanitizers, publishable projections gating + fail-closed, sync label mapping + junk rejection, render section, UI list/detail)
  • npm run typecheck; full workspace lint; npm run format:check
  • npm run ci:build; npm run package:lambdas; terraform fmt unchanged; chart untouched

Completion item 5 part 2 (the long tail) from the re-review
(~/Documents/Testing/plans/2026-10-27-predictive-completion.md), which
completes the plan.

Per-issue risk windows:
- New engine module slo.ts: an SLA window per severity (critical 7d,
  high 30, medium 90, low 180) with age, burn, state (ok/burning at 80%/
  breached) and days-to-breach derived deterministically from createdAt.
- Open issues expose it on read — GET /issues and /issues/:id compute it
  from the row, nothing stored — the list marks burning and breached
  findings and the Status card states the window.

Two new trend series (snapshotTrends):
- sloBurning: findings past 80% of their window, split by severity plus
  the breached count — derived from the open issues the snapshot already
  reads, no extra query.
- exposedByType: internet-exposed vertices grouped by label — one
  bounded label-only read capped at 2000 with an explicit truncation
  flag, answering the cost objection with a bound instead of a skip.
- Both flow through the trends route with sanitized samples (25-type
  cap, label-shaped keys) and appear on the Trends page.

Trust-center projections:
- While the reconciliation record is OK, the publishable response
  attaches compact series projections (metric id, per-day slope,
  confidence, basis/horizon, 30-day value) for open findings, backlog
  risk and SLO burn, sharing one forecaster with the trends route
  (extracted to services/trend-forecast.ts).
- The sync layer maps fixed metric ids to reviewed public labels, drops
  unknown metrics and out-of-range values, and the sanitization
  tripwires still scan the whole fragment; the page renders "Where the
  posture is heading". STALE/MISSING publishes nothing; unreadable
  trends omit projections without failing the response.

Why this is safe: every new number is derived from data already read
(creation dates) or bounded by an explicit cap with a truncation flag;
projections ride the existing publishable gate (OK only) and cross the
sanitization tripwires, whose only public wording comes from fixed
labels in the sync layer, never from an API response; no new write
surface and no identifiers.
@therandomsecurityguy
therandomsecurityguy merged commit 7a3abb5 into main Oct 28, 2026
5 checks passed
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