forked from ChelseaKR/outcome-receipts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow-artifact.schema.json
More file actions
413 lines (413 loc) · 10.5 KB
/
Copy pathworkflow-artifact.schema.json
File metadata and controls
413 lines (413 loc) · 10.5 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/ChelseaKR/outcome-receipts/blob/main/docs/schema/workflow-artifact.schema.json",
"title": "Outcome Receipts workflow artifact",
"description": "Versioned contract for deterministic evidence-workflow artifacts. Where an artifact embeds a receipt verbatim (an equity-review group, a migration or restatement before/after, a contract milestone's observed/threshold/financial), that object is a receipt from the receipts manifest and follows docs/schema/receipts.schema.json: a figure withheld by small-cell suppression carries suppressed: true with null for value, row_count, slice_hash, and column_names. A consumer must branch on suppressed and must not read, plot, or sum a withheld receipt as zero. `receipts verify-workflow` fails an artifact in which any object declaring suppressed: true still carries a number in one of those fields.",
"type": "object",
"required": [
"schema_version",
"kind",
"relationship"
],
"properties": {
"schema_version": {
"const": "1.0"
},
"kind": {
"enum": [
"restatement",
"migration_equivalence",
"requirement_change",
"contract_evidence",
"federated_rollup",
"equity_review"
]
},
"relationship": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"enum": [
"supersedes",
"compares_to",
"supports_contract",
"rolls_up",
"slices"
]
},
"bundle_digest": {
"$ref": "#/$defs/digest"
}
},
"additionalProperties": false
},
"approved_by": {
"$ref": "#/$defs/nonEmptyString"
},
"current_spec_digest": {
"$ref": "#/$defs/digest"
},
"current_manifest_digest": {
"$ref": "#/$defs/digest"
},
"before_spec_digest": {
"$ref": "#/$defs/digest"
},
"after_spec_digest": {
"$ref": "#/$defs/digest"
},
"prior_document_digest": {
"$ref": "#/$defs/digest"
},
"current_document_digest": {
"$ref": "#/$defs/digest"
},
"contract_digest": {
"$ref": "#/$defs/digest"
},
"plan_digest": {
"$ref": "#/$defs/digest"
},
"spec_digest": {
"$ref": "#/$defs/digest"
},
"reason": {
"$ref": "#/$defs/nonEmptyString"
},
"contract_id": {
"$ref": "#/$defs/nonEmptyString"
},
"controlling_text": {
"$ref": "#/$defs/nonEmptyString"
},
"policy_citation": {
"$ref": "#/$defs/nonEmptyString"
},
"legal_determination": {
"const": "not_made"
},
"period": {
"$ref": "#/$defs/nonEmptyString"
},
"population_overlap": {
"enum": [
"disjoint",
"not_deduplicated"
]
},
"suppression_policy_id": {
"$ref": "#/$defs/nonEmptyString"
},
"dimension": {
"$ref": "#/$defs/nonEmptyString"
},
"purpose": {
"$ref": "#/$defs/nonEmptyString"
},
"controlling_policy": {
"$ref": "#/$defs/nonEmptyString"
},
"consent_basis": {
"$ref": "#/$defs/nonEmptyString"
},
"category_provenance": {
"$ref": "#/$defs/nonEmptyString"
},
"changed": {
"type": "array"
},
"added": {
"type": "array"
},
"removed": {
"type": "array"
},
"unchanged": {
"type": "array"
},
"metrics": {
"description": "One record per metric compared across the two specs. A metric withheld by small-cell suppression on either side is classified indeterminate rather than aborting the artifact: neither side publishes its value, so neither equivalence nor change can be asserted about it.",
"type": "array",
"items": {
"type": "object",
"required": ["metric_id", "status", "before", "after"],
"properties": {
"metric_id": { "$ref": "#/$defs/nonEmptyString" },
"status": {
"description": "equivalent: both sides publish the same value. changed: both publish, and they differ. indeterminate: at least one side is withheld, so no comparison is possible. The same word contract_evidence uses for the same reason.",
"enum": ["equivalent", "changed", "indeterminate"]
},
"delta_status": {
"description": "Why no delta receipt is present. Required when status is indeterminate, absent otherwise.",
"enum": ["suppressed"]
},
"delta_receipt": {
"description": "The SQL-grounded difference between the two sides. Present exactly when status is equivalent or changed; a composed receipt over a withheld cell is refused, so an indeterminate metric carries none.",
"$ref": "#/$defs/composedReceipt"
}
},
"allOf": [
{
"if": {
"properties": { "status": { "const": "indeterminate" } },
"required": ["status"]
},
"then": {
"required": ["delta_status"],
"not": { "required": ["delta_receipt"] }
},
"else": { "required": ["delta_receipt"] }
}
]
}
},
"requirements": {
"type": "array"
},
"milestones": {
"type": "array",
"minItems": 1
},
"inputs": {
"type": "array",
"minItems": 2
},
"rollup_receipt": {
"$ref": "#/$defs/composedReceipt"
},
"groups": {
"description": "One record per allowlisted subgroup: a label and the subgroup's receipt, embedded verbatim from the receipts manifest. A group whose receipt carries suppressed: true is withheld, not empty.",
"type": "array",
"minItems": 2
},
"interpretation_limits": {
"description": "What this artifact does not establish. When any group is withheld by suppression, the limits state that explicitly; `receipts verify-workflow` fails an equity review that withholds a group without saying so.",
"type": "array",
"items": {
"$ref": "#/$defs/nonEmptyString"
}
}
},
"oneOf": [
{
"properties": {
"kind": {
"const": "restatement"
},
"relationship": {
"properties": {
"type": {
"const": "supersedes"
}
},
"required": [
"bundle_digest"
]
}
},
"required": [
"reason",
"approved_by",
"current_spec_digest",
"current_manifest_digest",
"changed",
"added",
"removed",
"unchanged"
]
},
{
"properties": {
"kind": {
"const": "migration_equivalence"
},
"relationship": {
"properties": {
"type": {
"const": "compares_to"
}
}
}
},
"required": [
"approved_by",
"before_spec_digest",
"after_spec_digest",
"metrics"
]
},
{
"properties": {
"kind": {
"const": "requirement_change"
},
"relationship": {
"properties": {
"type": {
"const": "compares_to"
}
}
}
},
"required": [
"prior_document_digest",
"current_document_digest",
"requirements"
]
},
{
"properties": {
"kind": {
"const": "contract_evidence"
},
"relationship": {
"properties": {
"type": {
"const": "supports_contract"
}
}
}
},
"required": [
"contract_id",
"contract_digest",
"controlling_text",
"policy_citation",
"approved_by",
"milestones",
"legal_determination"
]
},
{
"properties": {
"kind": {
"const": "federated_rollup"
},
"relationship": {
"properties": {
"type": {
"const": "rolls_up"
}
}
}
},
"required": [
"plan_digest",
"period",
"population_overlap",
"suppression_policy_id",
"approved_by",
"inputs",
"rollup_receipt"
]
},
{
"properties": {
"kind": {
"const": "equity_review"
},
"relationship": {
"properties": {
"type": {
"const": "slices"
}
}
}
},
"required": [
"spec_digest",
"plan_digest",
"dimension",
"purpose",
"controlling_policy",
"consent_basis",
"category_provenance",
"approved_by",
"groups",
"interpretation_limits"
]
}
],
"$defs": {
"digest": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"nonEmptyString": {
"type": "string",
"minLength": 1
},
"composedReceipt": {
"type": "object",
"required": [
"provenance_type",
"metric_id",
"operation",
"query",
"inputs",
"input_digest",
"value",
"display",
"unit",
"computed_at"
],
"properties": {
"provenance_type": {
"const": "receipt_composed"
},
"metric_id": {
"$ref": "#/$defs/nonEmptyString"
},
"operation": {
"enum": [
"sum",
"delta"
]
},
"query": {
"$ref": "#/$defs/nonEmptyString"
},
"inputs": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"metric_id",
"receipt_digest"
],
"properties": {
"metric_id": {
"$ref": "#/$defs/nonEmptyString"
},
"receipt_digest": {
"$ref": "#/$defs/digest"
}
},
"additionalProperties": false
}
},
"input_digest": {
"$ref": "#/$defs/digest"
},
"value": {
"type": "number"
},
"display": {
"type": "string"
},
"unit": {
"$ref": "#/$defs/nonEmptyString"
},
"computed_at": {
"$ref": "#/$defs/nonEmptyString"
}
},
"additionalProperties": false
}
},
"additionalProperties": true
}