Skip to content

detect: a window on a quiet source closes (VEJAS_IDLE_CLOSE_SECS) - #4

Merged
cpoder merged 1 commit into
masterfrom
idle-close
Sep 23, 2026
Merged

cpoder merged 1 commit into
masterfrom
idle-close

Conversation

@cpoder

@cpoder cpoder commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Why

Since v0.3.2, a detect unit closes a window on the next event of its source past the window's end. A source that goes quiet sends no such event. A brute force on VPN logons, or on one application's log, was therefore raised only when that source spoke again.

What changes

  • Engine at varpulis main 92f07b9 (#286). The engine gains an idle grace: once a type has sent nothing for the grace, its event time moves on with the wall clock, minus the grace. Its clock is also kept in the snapshot.
  • The unit sets that grace from VEJAS_IDLE_CLOSE_SECS: 60 s by default, and 0 turns it off. It does so after restoring its snapshot.
  • The unit ticks the program on every idle poll (the 500 ms receive timeout) and publishes what the tick closes.
    • Those emits stand for no message, so there is nothing to ack. A crash before the next snapshot replays the events and closes the windows again.
    • Tick emits count in vejas_emits_published, not as processed events.
  • One helper (emit_subject) works out the emit subject for both paths.
  • e2e/detect D7. The scenario is three VPN failures, then silence, with a 5 s window and VEJAS_IDLE_CLOSE_SECS=1. The alert arrives with n = 3. Against the published v0.3.2 binary (VEJAS_BIN), D7 fails: nothing is ever raised. D4 now lists four units.
  • Docs and changelog. detects.md documents VEJAS_IDLE_CLOSE_SECS, and the CHANGELOG entry sits under Unreleased.

Checks run locally

  • cargo test: 43 passed.
  • e2e/detect/run.sh: all invariants hold.
  • e2e/detect-demo/run.sh: every beat holds.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N3K1TGnWTvwYzt9rKuJXES

A detect unit sets the engine's idle grace (varpulis #286, main 92f07b9)
from VEJAS_IDLE_CLOSE_SECS, 60 seconds by default, 0 turns it off, after
restoring its snapshot, and ticks the program on every idle poll (the
500 ms receive timeout), publishing what the tick closes: those emits
stand for no message, so nothing is acked, and a crash before the next
snapshot replays and closes them again. Tick emits count in
vejas_emits_published (metrics::observe_tick_emits), not as processed
events. The emit subject is worked out by one helper for both paths.

e2e/detect D7: three VPN failures, then silence, with a 5 s window and
VEJAS_IDLE_CLOSE_SECS=1: the alert arrives with n = 3; the v0.3.2
runtime never raises it. D4 lists four units.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3K1TGnWTvwYzt9rKuJXES
@cpoder
cpoder merged commit 8bc2361 into master Sep 23, 2026
3 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