1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Subscriber-side event filter for the unified harness bus (ADR-0005).
//!
//! Why: The global bus broadcasts *everything* to *every* subscriber. A given
//! consumer (a task-scoped SSE stream, a single-harness relay, a
//! hook-only aggregator) usually wants a slice of that firehose. Rather
//! than running N filtered channels, subscribers filter in their own recv
//! loop with a small predicate. Phase 0 deliberately avoids adding a
//! Stream dependency: `Filter::matches` is the lightweight primitive
//! consumers will call inside `recv_with_lag` loops in later phases.
//! What: A `Filter` of optional constraints (source, session, domains) plus a
//! `matches` predicate that ANDs the present constraints. An empty /
//! default filter matches everything.
//! Test: `super::tests::filter_*` cover each axis, combinations, and the
//! default-matches-all case.
use HarnessEvent;
use HarnessSource;
/// A conjunctive (AND) filter over `HarnessEvent`s.
///
/// Why: Subscribers express "only events from harness X, for session Y, in
/// domains Z" without bespoke matching logic at each call site. Optional
/// fields make every constraint opt-in: `None` means "don't constrain on
/// this axis", so `Filter::default()` is the match-all filter.
/// What: `source` constrains the originating harness; `session` constrains the
/// correlation key (an event with no session never matches a session
/// constraint); `domains` constrains the payload domain string
/// (`"lifecycle"`, `"hook"`, `"ping"`). `&'static str` is used for
/// `domains` because the legal domain set is fixed and known at compile
/// time, avoiding allocation for the common constants.
/// Test: `super::tests::filter_default_matches_all` and the per-axis cases.