feat(netflow): singularity alert feed - #96
Merged
Conversation
The dataset dashboard reached the alert feed through a summary card that crowded the chart stack. Remove the card and its feed preload; the Alerts tab remains the sole entry point to the feed page.
flamboh
force-pushed
the
t3code/singularity-feed
branch
2 times, most recently
from
August 22, 2026 09:54
d0f8d7e to
16e6141
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Singularity (MAAD) scores how anomalous each IP address is within a trace's address population, but ATLANTIS had no way to watch a live capture tree and surface those anomalies continuously.
This adds a rolling alert feed: a new long-running
netflow-db feed <dataset>subcommand polls a dataset's nfcapd tree, and for each completed five-minute window unions the distinct IPv4 addresses across members, scores them with a Rust port ofSingularities.hs, and records addresses beyond calibrated alpha thresholds intoalerts.sqlitebeside the dataset's product database (rolling ~7-day retention). The dashboard reads that file per dataset on a new/alertspage.What's in here
singularity.rs: Rust port of MAAD's per-address alpha scoring, plus anetflow-db singularityCLI for stdin/file scoring. Conformance-verified against the Haskell reference on 24 real uOregon windows (7.6M address comparisons, zero violations; max alpha deviation 7.7e-15).feed.rs: the feed loop — registry-driven config, bounded window discovery with a grace rule for incomplete windows, per-window transactional writes, retention pruning,--backfill,--once.high = 2.0,low = 0.3, calibrated on 200 windows spanning 13 months (methodology + sensitivity indocs/agent/singularity-calibration.md). A typical window records ~20 alerts (p10–p90: 14–25). Both tails alert: high alpha = isolated/sparse address-space region, low alpha = deep inside a dense cluster./api/alerts+ a dataset-scoped/datasets/<id>/alertspage (Dashboard | Alerts tabs) — an address-centric feed: one row per anomalous address over a selectable horizon (1h/6h/24h/7d), showing its peak alpha in that horizon, last-seen, times-flagged persistence, and a "new" badge for fresh entrants; sorted by severity (distance past threshold) with a recency toggle, tail filter, and 30 s auto-refresh while visible. Windows are aggregation evidence, not page structure. The alerts DB is opened read-only; presence ofalerts.sqliteis the feature flag. D1 deployments reportfeed.present = false— this is local-driver-only for now.Decisions worth reviewing
netflow.sqlite.How to exercise
./vendor/scripts/compile-nfdump.sh), then runnetflow-db feed <dataset-id> --nfdump target/nfdump/libexec/nfdump --backfill 2h --onceagainst a dataset from
datasets.json. Expect onewindowsrow per completed five-minute window indata/<dataset>/alerts.sqlite, ~14–25 alerts each on uOregon-like traffic.ATLANTIS_DB_DRIVER=sqlite bun run dev:web), open/datasets/<id>/alerts: feed sections newest-first, tail badges with tooltips, "Feed idle"/"Live" status per window age; datasets without a feed show the start-command card.netflow-db singularity <file-of-ipv4s>againstvendor/maadSingularities -1 <file>.Verification
bun run format/lint/typecheckclean;bun run test:db(131 lib tests + integration, incl. 8 feed + 7 singularity) andbun run test:web(87 tests, 15 new) pass.docs/agent/singularity-calibration.md.Built by Claude (Fable 5) orchestrating gpt-5.6-sol (xhigh) implementation subagents via Claude Code.