netsec-scan: a seed is silent for its whole span, --dry-run included

The seeding guard only ran in on_batch for the archive path, so a cold
start still announced the entire retained window whenever the tick was a
--dry-run (11-14 egress-new-dst lines: history reported as news, all of it
inside the window the line itself quoted). The guard also lived *after*
the flow rules had already produced findings, and it was skipped entirely
for dry runs.

- absorption now happens in on_batch and is keyed on 'seeded' alone, so it
  covers the cold start, every resume tick of a budget-limited seed, and
  --dry-run (history is not news in a dry run either);
- each seeding tick explains its silence on stderr: 'seed: N tuple(s)
  absorbed, 0 reported; window Xh from <stamp>, N file(s)', including the
  still-pending count when the budget stopped the pass;
- the warm-state archive pass gets the same one-line summary;
- state.seed.absorbed records the count, and absorb() reports whether a
  fingerprint was new so the number is the baseline's growth, not a loop
  counter.

tests/test_seed.py pins all four: cold start, dry-run cold start, resume
tick while unseeded, and single-fire from a seeded state (the guard must
not turn into a permanently silent sensor).
This commit is contained in:
Sirius DevOps 2026-11-27 02:17:16 -05:00
commit bde343c75f
4 changed files with 244 additions and 48 deletions

View file

@ -195,6 +195,9 @@ def _window_label(hours: float) -> str:
return "%.1fd" % (hours / 24.0)
window_label = _window_label # public name: the seed summary prints it too
def rule_egress_first_seen(flows: Iterable[Flow], seen: Dict[str, dict],
counts: Dict[str, dict], now: datetime,
window_h: Optional[float] = None, tick: int = 0) -> List[Finding]: