mod: Ext 12 — temporal burst detection, 292/292
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Reports gain an :at tick (deterministic, supplied). mod/decide-temporal counts reports about a subject within [now-window, now], asserts burst_count/2, and a (:burst-at-least K) rule fires only on a real burst. 3 reports at 10/11/12 → hide; 3 at 1/2/12 (window 5) → keep, while the plain count rule escalates both. Fifth report field threaded through rebuild helpers, non-breaking. +15 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
;; lib/mod/schema.sx — report representation + Prolog fact generation.
|
||||
;;
|
||||
;; A report is a dict {:id :by :about :reason :evidence :attrs :signals}.
|
||||
;; A report is a dict {:id :by :about :reason :evidence :attrs :signals :at}.
|
||||
;; :evidence — accumulated {:kind :val} entries (human review, scanners)
|
||||
;; :attrs — attribute names ("verified") for negation-as-failure conditions
|
||||
;; :signals — weighted {:kind :weight} entries for aggregate scoring rules
|
||||
;; :at — integer timestamp/tick (deterministic; supplied, not clock-read)
|
||||
;; The engine derives keyword classifications from the reason text and projects
|
||||
;; the report, its classifications, evidence, attributes, and signals into Prolog
|
||||
;; facts that policy clauses match against.
|
||||
|
||||
(define mod/mk-report (fn (id by about reason) {:attrs (list) :id id :signals (list) :by by :evidence (list) :about about :reason reason}))
|
||||
(define mod/mk-report (fn (id by about reason) {:attrs (list) :id id :signals (list) :by by :evidence (list) :about about :at 0 :reason reason}))
|
||||
|
||||
(define mod/report-id (fn (r) (get r :id)))
|
||||
(define mod/report-by (fn (r) (get r :by)))
|
||||
@@ -27,6 +28,10 @@
|
||||
mod/report-signals
|
||||
(fn (r) (let ((s (get r :signals))) (if (nil? s) (list) s))))
|
||||
|
||||
(define
|
||||
mod/report-at
|
||||
(fn (r) (let ((t (get r :at))) (if (nil? t) 0 t))))
|
||||
|
||||
(define mod/mk-evidence (fn (kind val) {:val val :kind kind}))
|
||||
(define mod/evidence-kind (fn (e) (get e :kind)))
|
||||
(define mod/evidence-val (fn (e) (get e :val)))
|
||||
@@ -35,25 +40,51 @@
|
||||
(define mod/signal-kind (fn (s) (get s :kind)))
|
||||
(define mod/signal-weight (fn (s) (get s :weight)))
|
||||
|
||||
(define mod/report* (fn (r evs attrs sigs) {:attrs attrs :id (mod/report-id r) :signals sigs :by (mod/report-by r) :evidence evs :about (mod/report-about r) :reason (mod/report-reason r)}))
|
||||
(define mod/report* (fn (r evs attrs sigs at) {:attrs attrs :id (mod/report-id r) :signals sigs :by (mod/report-by r) :evidence evs :about (mod/report-about r) :at at :reason (mod/report-reason r)}))
|
||||
|
||||
(define
|
||||
mod/with-evidence
|
||||
(fn
|
||||
(r evs)
|
||||
(mod/report* r evs (mod/report-attrs r) (mod/report-signals r))))
|
||||
(mod/report*
|
||||
r
|
||||
evs
|
||||
(mod/report-attrs r)
|
||||
(mod/report-signals r)
|
||||
(mod/report-at r))))
|
||||
|
||||
(define
|
||||
mod/with-attrs
|
||||
(fn
|
||||
(r attrs)
|
||||
(mod/report* r (mod/report-evidence r) attrs (mod/report-signals r))))
|
||||
(mod/report*
|
||||
r
|
||||
(mod/report-evidence r)
|
||||
attrs
|
||||
(mod/report-signals r)
|
||||
(mod/report-at r))))
|
||||
|
||||
(define
|
||||
mod/with-signals
|
||||
(fn
|
||||
(r sigs)
|
||||
(mod/report* r (mod/report-evidence r) (mod/report-attrs r) sigs)))
|
||||
(mod/report*
|
||||
r
|
||||
(mod/report-evidence r)
|
||||
(mod/report-attrs r)
|
||||
sigs
|
||||
(mod/report-at r))))
|
||||
|
||||
(define
|
||||
mod/with-at
|
||||
(fn
|
||||
(r at)
|
||||
(mod/report*
|
||||
r
|
||||
(mod/report-evidence r)
|
||||
(mod/report-attrs r)
|
||||
(mod/report-signals r)
|
||||
at)))
|
||||
|
||||
(define
|
||||
mod/attach-evidence
|
||||
|
||||
Reference in New Issue
Block a user