feat(engine): timing & anomaly detection rules#25
Merged
Conversation
Add contract rules 11-16, completing the 16-rule taxonomy. Mirrors the toolkit's `core/detection.ts` thresholds. - SUSPICIOUS_SESSION_DURATION — transaction session < 60s or > 24h. - SLOW_RESPONSE — Call→matching-response gap over 10s. - HEARTBEAT_INTERVAL_VIOLATION — consecutive heartbeat gap deviating >50% from the expected interval. - METER_VALUE_ANOMALY — negative or non-monotonic meter readings. - UNRESPONSIVE_CSMS — a Call with no matching CallResult/CallError. - REPEATED_BOOT_NOTIFICATION — 2+ BootNotifications within 5 minutes. detectFailures now runs all 16 rules in contract order; each rule is tested at its threshold boundary. The conformance harness over the 15 shared scenarios lands next. Closes #21
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.
What & why
Third slice of S2 — Detection + conformance: contract rules 11–16, the
timing & anomaly batch — completing the full 16-rule taxonomy. Mirrors the
toolkit's
core/detection.tsthresholds exactly.Rules added
SUSPICIOUS_SESSION_DURATIONSLOW_RESPONSEHEARTBEAT_INTERVAL_VIOLATIONMETER_VALUE_ANOMALYUNRESPONSIVE_CSMSREPEATED_BOOT_NOTIFICATIONdetectFailuresnow runs all 16 rules in contract order.Testing
native test -Dplatform=null→ 49/49 pass (6 new tests, each firing on itsthreshold boundary and staying silent otherwise, driven through the real
pipeline — isolated so only the rule under test can fire).
native check --strictandzig fmt --checkclean.The conformance harness (#22) will lock all 16 rules against the 15 shared
scenario goldens.
Closes #21