secubox-deb/docs
CyberMind 3435cfa069
feat(scripts): add check-dashboard-cache.py lint + CI (closes #147) (#148)
Anti-regression for the double-cache pattern documented in CLAUDE.md
(« Performance Patterns — Double Caching »). Catches the bug class that
caused PR #146 (secubox-waf 17 % sustained CPU under SOC polling)
before it lands.

What's added
============
- scripts/check-dashboard-cache.py — AST-based audit. Walks every
  packages/secubox-*/api/main.py, flags hot dashboard routes
  (/stats, /alerts, /summary, /dashboard, /metrics, /overview,
  /events, /history, /recent, /bans, /sessions, /connections)
  whose handler body does per-request I/O (open, read_text,
  read_bytes, subprocess.run, Popen) AND doesn't go through a cache
  (module-level _cache instance + .get() call, OR
  asyncio.create_task(refresh_*) at startup).
    * --check : exit 1 on unjustified violations (CI mode)
    * --report : human-readable table (default)
    * --json : machine-readable

- .cache-lint-allowlist.toml — TOML allowlist for justified
  exceptions. Each entry needs a daemon + route + justification
  (issue link expected). Seeded with the 4 current legacy cases:
  secubox-waf (covered by PR #146 — will drop the entries when
  merged), secubox-config-advisor /history (admin drill-in, not
  polled), secubox-netdiag /connections (real-time TCP state),
  secubox-tor /summary (small file read, follow-up cleanup).

- .github/workflows/dashboard-cache-check.yml — mirror of
  license-check.yml. Runs the lint + the self-tests on PRs that
  touch packages/**/api/main.py, the lint script, the allowlist,
  or the workflow itself.

- docs/CACHE-PATTERN.md — short remediation guide. Three accepted
  shapes (read-through, background-refresh, pure in-memory), code
  example, allowlist syntax, references to the canonical
  implementations (secubox-crowdsec for read-through, secubox-system
  for background-refresh).

Tests (14/14 pass)
==================
- StatsCache pattern detection (compliant cases)
- Non-compliant detection: open, subprocess.run, multiple I/O ops
- Pure in-memory handler = compliant
- Background-refresh task = compliant
- Non-hot route (/health) not audited
- @router.get treated like @app.get
- Allowlist suppresses by exact (daemon, route) key
- Allowlist doesn't cross-pollinate across routes
- Missing allowlist file = no error
- CLI --check exits 1 on unjustified
- CLI --check exits 0 when clean
- CLI --json output well-formed
- **Real repo audit with seeded allowlist passes --check**
  (sanity gate: catches regression if anyone removes an allowlist
  entry without fixing the daemon)

Baseline against the real packages/ tree
========================================
122 daemons audited, 118 compliant, 4 with findings (all
allowlisted). When PR #146 merges, the secubox-waf entries can be
removed from the allowlist — the next lint run will then prove the
fix is wired correctly.

Follow-up
=========
- Drop secubox-waf allowlist entries when #146 merges.
- Per-daemon follow-up issues for the remaining 3 (config-advisor,
  netdiag, tor) — not blocking, allowlist documents the rationale.
- Consider extending HOT_ROUTES to /health / /status once the small
  daemons that call `systemctl is-active` adopt a 10 s cache.

Co-authored-by: CyberMind-FR <gandalf@Gk2.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 08:21:20 +02:00
..
architecture feat(build): Add kiosk mode + VirtualBox setup + Profile Generator architecture 2026-04-29 09:16:36 +02:00
assets feat(ci): Unified sync-all workflow + eyemote visual banner 2026-05-10 09:28:00 +02:00
design feat(eye-remote): Add recovery boot protocols + unified design charter 2026-04-29 13:01:43 +02:00
errata docs(wiki): Add financing model pages + errata BPI-R4 2026-05-03 18:46:42 +02:00
eye-remote docs(eye-remote): add U-Boot boot commands documentation 2026-04-23 11:32:07 +02:00
hardware feat(eye-remote): Add recovery boot protocols + unified design charter 2026-04-29 13:01:43 +02:00
reference feat(led): Add 3-tier LED HealthBump system with kernel timer triggers 2026-05-08 08:29:08 +02:00
references/gst docs(session106): Add GitHub Issues workflow + GST references 2026-05-06 14:52:44 +02:00
reports docs: Update report with Gitea fix (7.6GB → 2.1GB) 2026-04-30 12:02:15 +02:00
screenshots docs: Add Eye Remote Multigadget skill and wiki 2026-05-10 09:12:42 +02:00
superpowers feat(eye-remote): multi-gadget DHCP on eye-br0 — Phase 1 (#161) 2026-05-17 06:04:54 +02:00
wiki feat(ci): Unified sync-all workflow + eyemote visual banner 2026-05-10 09:28:00 +02:00
AI-BUILD-PROMPT.md docs: Add Eye Remote Multigadget skill and wiki 2026-05-10 09:12:42 +02:00
CACHE-PATTERN.md feat(scripts): add check-dashboard-cache.py lint + CI (closes #147) (#148) 2026-05-18 08:21:20 +02:00
FAQ-BUSYBOX-RESCUE.md feat(kernel): Add complete nftables support + busybox rescue docs 2026-05-08 18:27:30 +02:00
LED-HEALTHBUMP.md feat(led): HealthBump v2.1.0 with activity detection and K2000 party 2026-05-08 11:15:09 +02:00
LIVE-USB.md Add Live USB documentation and wiki pages 2026-03-24 17:59:07 +01:00
MODULES.md Add comprehensive module documentation 2026-03-24 12:25:27 +01:00
OPENWRT-CRT-THEME.md Add OpenWrt implementation prompts for mesh daemon and CRT theme 2026-03-25 08:41:15 +01:00
OPENWRT-DEBIAN-COMPARISON.md Add OpenWRT vs Debian comparison and update migration status 2026-03-26 07:27:31 +01:00
OPENWRT-MASTERLINK.md Add OpenWRT Master-Link client implementation guide 2026-03-26 13:38:38 +01:00
OPENWRT-MESH-DAEMON.md Add OpenWrt implementation prompts for mesh daemon and CRT theme 2026-03-25 08:41:15 +01:00
PROMPT-BUSYBOX-TECHTIP.md feat(kernel): Add complete nftables support + busybox rescue docs 2026-05-08 18:27:30 +02:00
SCREENSHOTS-VM.md Update all module screenshots and documentation 2026-03-26 07:22:52 +01:00
SECUBOX-DEV-METHODOLOGY.md docs(methodology): Emancipate SecuBox-Dev methodology as standalone guide 2026-05-03 07:08:24 +02:00
TOOLS.md docs: Add TOOLS.md and missing README files 2026-04-26 20:38:29 +02:00
UI-GUIDE.md Add UI documentation with module list and theme guide 2026-03-26 07:20:23 +01:00