feat(ttp): E.1.11 RuleStore contract — base ABC, factory, filesystem + database stubs

Adds decnet/ttp/store/ subpackage:
- base.py: RuleState frozen dataclass, RuleChange NamedTuple, RuleStore ABC
- factory.py: get_rule_store() reading DECNET_TTP_RULE_STORE_TYPE
- impl/filesystem.py: FilesystemRuleStore with sys.platform=='linux'
  fail-fast guard, allowlist filename regex, raw inotify mask bits
  (lib import deferred to E.3 so contract phase compiles without the
  asyncinotify dep installed)
- impl/database.py: DatabaseRuleStore stub (no platform guard)

TTPRule + TTPRuleState SQLModels were already shipped at E.1.1; this
commit closes the type-only TYPE_CHECKING forward-ref in
rule_engine.py via real runtime imports through the new package.
This commit is contained in:
2026-05-01 07:25:09 -04:00
parent b6e31e64e9
commit bcd1f14cd3
7 changed files with 434 additions and 0 deletions

View File

@@ -2374,6 +2374,8 @@ unrelated events.
**E.1.11 — RuleStore contract**
(`decnet/ttp/store/{base.py, factory.py, impl/}`)
**Status:** ✅ done.
- `class RuleState` frozen dataclass: state literal
("enabled" | "disabled" | "clipped"), `confidence_max`,
`expires_at`, `reason`, `set_by`, `set_at`. Default constructor