-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathvalidation-conformance.ledger.ts
More file actions
71 lines (68 loc) · 2.59 KB
/
Copy pathvalidation-conformance.ledger.ts
File metadata and controls
71 lines (68 loc) · 2.59 KB
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
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
//
// ADR-0060 P2 — Validation-Rule Conformance ledger (the third instance of the
// reusable pattern). One row per `validations` union rule type, each pinned to
// its runtime enforcement site and a proof. ADR-0020 wired this whole union into
// the write path (engine insert/update → rule-validator.ts), turning every rule
// type from declaration into enforcement; this ledger makes that a CHECKED fact
// and — via the ratchet — makes a NEW rule type with no enforcement a build break
// (the exact pre-ADR-0020 `state_machine` disease).
import type { ConformanceRow } from '@objectstack/verify';
const RULE_VALIDATOR = 'packages/objectql/src/validation/rule-validator.ts';
const PROOF = 'packages/objectql/src/validation/rule-validator.test.ts';
export const VALIDATION_SURFACE: ConformanceRow[] = [
{
id: 'rule-state-machine',
summary: 'state_machine — legal status-transition guard (ADR-0020 D3)',
surface: 'validation.zod.ts:state_machine',
state: 'enforced',
enforcement: `${RULE_VALIDATOR} checkStateMachine — engine insert/update path rejects an illegal from→to transition`,
covers: ['state_machine'],
proof: PROOF,
},
{
id: 'rule-script',
summary: 'script — arbitrary CEL failure predicate',
surface: 'validation.zod.ts:script',
state: 'enforced',
enforcement: `${RULE_VALIDATOR} checkPredicate — CEL predicate; TRUE = violation`,
covers: ['script'],
proof: PROOF,
},
{
id: 'rule-cross-field',
summary: 'cross_field — multi-field CEL invariant',
surface: 'validation.zod.ts:cross_field',
state: 'enforced',
enforcement: `${RULE_VALIDATOR} checkPredicate — evaluated against the merged record (prior ∪ change)`,
covers: ['cross_field'],
proof: PROOF,
},
{
id: 'rule-format',
summary: 'format — value-shape rule (regex/builtin)',
surface: 'validation.zod.ts:format',
state: 'enforced',
enforcement: `${RULE_VALIDATOR} checkFormat`,
covers: ['format'],
proof: PROOF,
},
{
id: 'rule-json-schema',
summary: 'json_schema — structural validation of a JSON field',
surface: 'validation.zod.ts:json_schema',
state: 'enforced',
enforcement: `${RULE_VALIDATOR} checkJsonSchema`,
covers: ['json_schema'],
proof: PROOF,
},
{
id: 'rule-conditional',
summary: 'conditional — when/then predicate rule',
surface: 'validation.zod.ts:conditional',
state: 'enforced',
enforcement: `${RULE_VALIDATOR} checkConditional`,
covers: ['conditional'],
proof: PROOF,
},
];