Skip to content

Corpus coverage for off-hours-activity: per-case benchmark settings + attack/benign pair - #504

Merged
blitzcrieg1 merged 6 commits into
blitzcrieg1:masterfrom
rumangsanya:feat/off-hours-corpus-36
Nov 27, 2026
Merged

blitzcrieg1 merged 6 commits into
blitzcrieg1:masterfrom
rumangsanya:feat/off-hours-corpus-36

Conversation

@rumangsanya

Copy link
Copy Markdown
Contributor

Closes #36 (the remaining half: host-subagent-swarm was already covered). Corpus-only task under the bounty program (#454), claimed on the issue. Contributor from #486.

Why a harness change is included

off-hours-activity was the last published rule with no corpus case, and it could not have one: the rule is opt-in (settings.detect_off_hours) and the benchmark never enabled it, so any case would have recorded a miss. This PR adds per-case settings to the corpus manifest:

  • A case may declare settings: in corpus.yaml; the benchmark applies them for that case's replay only and restores them afterwards, even on error.
  • Keys are allowlisted to the three this rule needs (detect_off_hours, business_tz, business_hours) — a manifest cannot reach arbitrary settings and quietly disable the rule it claims to exercise. A test pins this.

The two cases

  • Attack (attack_off_hours_impact.jsonl, expect [off-hours-activity]): an unscheduled autonomous agent deletes data at 02:30 UTC on a Tuesday. The case pins business_tz: UTC and a 09–18 window and stamps its events in UTC, so it is reproducible on any host timezone — the trap the issue warns about. The run is approved in-session first, so autonomous-unapproved-write stays quiet and the case pins off-hours alone.
  • Benign (benign_human_night_maintenance.jsonl, expect []): the same hour and the same deletions with a human driving, under the same settings pin — the rule was awake and stayed quiet, because it governs autonomous agents, not people on a night shift. The cron exclusion is deliberately not the benign pair: a cron session at that hour would legitimately trip autonomous-unapproved-write, so it cannot be an expect-nothing case; the exclusion itself is pinned by the rule's unit tests.

One existing test fixed

test_the_corpus_exercises_a_meaningful_share_of_the_rules bounded covered rule ids by len(REGISTRY) — session rule functions only. Covered ids also include the host rule and the experimental (registered, unpublished) autonomous-unapproved-write; the two counts agreed at 18 only by coincidence, and covering a 19th rule broke the bound. It is now a subset check against the canonical id sets (BUILTIN_RULE_IDS | EXPERIMENTAL_RULE_IDS).

Numbers (README refreshed)

  cases            114 (58 attack, 56 benign)
  rules covered    19
  expected firings 62
  detected         62
  missed           0
  false positives  0

Tests collected 3034 → 3037 (+3: settings parsing/pin, the pin gating the opt-in rule, and the allowlist rejection). The detection benchmark, detection rules and README-claims test files are fully green, and ruff is clean. A bare local venv shows identical pre-existing failures on master and on this branch (missing optional extras); CI is the arbiter for the full suite.

(This PR replaces #503, which was built on an unsynced fork master and conflicted on README.md and corpus.yaml; the content is identical, rebased onto current master.)

@blitzcrieg1
blitzcrieg1 force-pushed the feat/off-hours-corpus-36 branch from 2297533 to f3d2ad0 Compare November 27, 2026 17:44
@blitzcrieg1
blitzcrieg1 merged commit 26af82b into blitzcrieg1:master Nov 27, 2026
10 checks passed
blitzcrieg1 added a commit that referenced this pull request Nov 27, 2026
Generated by Mistral Vibe.

Co-authored-by: Mistral Vibe <[email protected]>
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.

Two published rules have no benchmark corpus case: host-subagent-swarm-burst and off-hours-activity

2 participants