@@ -73,7 +73,7 @@ import type { Dashboard } from '@objectstack/spec/ui';
7373export const LegalDashboard : Dashboard = {
7474 name : 'legal_workbench' ,
7575 label : 'Legal Workbench' ,
76- description : 'Intake queue, review load, negotiation stalls, pipeline shape and stage durations for the legal team.' ,
76+ description : 'Intake queue, review load and SLA breaches , negotiation stalls, pipeline shape and stage durations for the legal team.' ,
7777
7878 columns : 12 ,
7979 gap : 4 ,
@@ -152,49 +152,27 @@ export const LegalDashboard: Dashboard = {
152152 } ,
153153 {
154154 /**
155- * The review-ageing tile, at a FIXED 30-day threshold written into its
156- * own title — which is the brick §09 prescribes here, not a degraded
157- * stand-in for one. §09 places the per-type「超 SLA」 outside the V1.0
158- * delivery surface (维护者裁定 2026-09-09, PR #40 `1127e52`; §09 as
159- * merged, PR #70 `30fd863`) and asks in its place for exactly this: a
160- * fixed threshold, self-declared in the brick's title.
155+ * DESIGN.md §09's「审查超 SLA」 — contracts in review past their OWN
156+ * type's review SLA (`clm_contract_type.review_sla_days`: 2, 3, 5 or 10
157+ * days across the nine seeded types). It replaces the fixed 30-day tile
158+ * that stood in this slot while the per-type comparison could not be
159+ * written (decision #31: 2B held the stand-in, ruling C kept the goal).
161160 *
162- * The SLA is PER TYPE (`clm_contract_type.review_sla_days`: 2, 3, 5 or
163- * 10 days across the nine seeded types), and a breach is a row-wise
164- * comparison of `review_started_at` against "now minus that type's SLA".
165- * 18.2.0 added the now-anchored comparand
166- * (`{ $now: true, addDays: { $field } }`, objectstack#25808), but its
167- * offset reads a numeric column of the SAME record only. Measured on
168- * 18.2.0 as the head of legal, `addDays: { $field:
169- * 'contract_type.review_sla_days' }` answers `400 INVALID_FILTER` — as a
170- * runtime filter "the addDays offset … is a dotted path, and SQL
171- * push-down compiles same-table column references only", and as a
172- * measure filter the same code with the reason withheld — while
173- * `os validate` passes it. The same anchor with a literal `-30` answers
174- * 200. So the per-type breach is still not expressible, and this tile
175- * stays.
176- *
177- * ⛔ The remaining route — a persisted `review_due_at` stamped by a daily
178- * job, the §12 gap-#7 shape — is closed for this metric, and not merely
179- * unbuilt: §09 forbids filling the per-type breach from an
180- * application-side job because that replicates a platform rule inside the
181- * application, and decision #31 ruled the same way on the notification
182- * side (1C + 2B, 2026-09-09 — see `legal-review-sla.flow.ts`, whose F3
183- * reminder fires on this same fixed 30 days so the tile and the reminder
184- * cannot tell two stories).
185- *
186- * So the threshold is FIXED, stated in the title, and above every seeded
187- * SLA: a review older than 30 days is late under any of the nine. The
188- * title says "Over 30 Days" and not "Over SLA" precisely so the tile
189- * cannot be read as the per-type breach it is not.
161+ * The count is `review_over_sla_count` on `contract_metrics`, one
162+ * definition for this tile and the per-type chart below. It compares
163+ * `review_started_at` with the platform's `$now` anchor shifted by the
164+ * contract's own `review_sla_days_offset`, which the engine stores from
165+ * the contract type on every write (platform 18.3.0; the anchor's offset
166+ * reads a column of the same record only, objectstack#25808 / #26601).
167+ * Nothing in the app stamps it: no hook, no job (§09's ⛔ on app-side
168+ * stamping holds).
190169 */
191- id : 'review_ageing ' ,
192- title : 'In Review Over 30 Days ' ,
193- description : 'A fixed 30-day threshold, not each contract type\'s own review SLA.' ,
170+ id : 'review_over_sla ' ,
171+ title : 'In Review Over SLA ' ,
172+ description : 'Contracts in review for longer than their contract type\'s review SLA.' ,
194173 type : 'metric' ,
195174 dataset : 'contract_metrics' ,
196- values : [ 'contract_count' ] ,
197- filter : { status : 'in_review' , review_started_at : { $lt : '{30_days_ago}' } } ,
175+ values : [ 'review_over_sla_count' ] ,
198176 colorVariant : 'danger' ,
199177 layout : { x : 6 , y : 0 , w : 3 , h : 2 } ,
200178 } ,
@@ -279,7 +257,7 @@ export const LegalDashboard: Dashboard = {
279257 * The criterion that does discriminate, and the one this filter now
280258 * states: WHETHER LEGAL HAS WORK TO DO ON THE STAGE. This is a work-queue
281259 * board — its first five widgets are `awaiting_intake`, `in_review`,
282- * `review_ageing `, `negotiation_stalled` and `approval_turnaround`, each
260+ * `review_over_sla `, `negotiation_stalled` and `approval_turnaround`, each
283261 * one a queue or a turnaround. `draft` … `signing` are contracts legal is
284262 * moving; `active`, `expired`, `terminated`, `cancelled` and `rejected`
285263 * are contracts legal has finished moving. Legal's work on an in-force
@@ -462,5 +440,33 @@ export const LegalDashboard: Dashboard = {
462440 values : [ 'avg_days_to_activation' ] ,
463441 layout : { x : 9 , y : 6 , w : 3 , h : 2 } ,
464442 } ,
443+
444+ // ─── Row 4: 超 SLA by contract type ──────────────────────────────────
445+ {
446+ /**
447+ * The over-SLA count split by contract type: each type is judged
448+ * against its own SLA, so this is where a reader sees WHICH SLA is being
449+ * missed. A type with no contract over its SLA is not drawn — measured:
450+ * selected alone, the measure's filter narrows the rows, so such a type
451+ * returns no row rather than a zero. Largest count first, like the
452+ * pipeline chart, so no label decides the order in any locale.
453+ */
454+ // `chart-config-missing` suppressed for the reason measured on
455+ // `stage_funnel` above: a dataset-bound widget derives its series from
456+ // `dimensions` and `values`.
457+ id : 'review_over_sla_by_type' ,
458+ title : 'In Review Over SLA by Contract Type' ,
459+ description : 'Contracts in review for longer than their type\'s review SLA, per contract type. A type with none over its SLA is not shown.' ,
460+ type : 'horizontal-bar' ,
461+ dataset : 'contract_metrics' ,
462+ dimensions : [ 'contract_type_name' ] ,
463+ values : [ 'review_over_sla_count' ] ,
464+ options : {
465+ sortBy : 'review_over_sla_count' ,
466+ sortOrder : 'desc' ,
467+ } ,
468+ suppressWarnings : [ 'chart-config-missing' ] ,
469+ layout : { x : 0 , y : 8 , w : 12 , h : 4 } ,
470+ } ,
465471 ] ,
466472} ;
0 commit comments