archctx-contracts 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fixtures/valid/archctx-capabilities.json +1 -1
- package/fixtures/valid/native-context-export.json +2 -1
- package/fixtures/valid/product-version-manifest.json +5 -5
- package/package.json +1 -1
- package/schemas/repo/constraint.schema.json +1 -0
- package/schemas/runtime/changeset-receipt.schema.json +28 -0
- package/schemas/runtime/changeset.schema.json +20 -2
- package/schemas/runtime/native-context-export.schema.json +56 -2
- package/schemas/runtime/projection-manifest.schema.json +25 -12
- package/schemas/runtime/projection-publish-run.schema.json +5 -1
- package/schemas/runtime/ref-impact.schema.json +578 -0
- package/src/architecture.ts +4 -1
- package/src/changeset-receipt.ts +11 -0
- package/src/failure.ts +44 -5
- package/src/index.ts +3 -0
- package/src/layers.ts +6 -0
- package/src/native-context.ts +9 -2
- package/src/ports.ts +21 -1
- package/src/product-version.ts +1 -1
- package/src/projection-manifest.ts +33 -8
- package/src/projection-writer.ts +2 -1
- package/src/ref-impact.ts +22 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "archcontext.capabilities/v1",
|
|
3
|
-
"package": { "name": "archctx", "version": "0.9.
|
|
3
|
+
"package": { "name": "archctx", "version": "0.9.4" },
|
|
4
4
|
"protocols": {
|
|
5
5
|
"projectionRequest": "archcontext.projection-request/v1",
|
|
6
6
|
"projectionResult": "archcontext.projection-result/v2",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"schemaVersion": "archcontext.product-version-manifest/v1",
|
|
3
3
|
"product": {
|
|
4
4
|
"name": "archctx",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.4",
|
|
6
6
|
"distribution": "one-package"
|
|
7
7
|
},
|
|
8
8
|
"packageManager": "bun@1.4.3",
|
|
@@ -12,25 +12,25 @@
|
|
|
12
12
|
"surfaces": {
|
|
13
13
|
"cli": {
|
|
14
14
|
"packageName": "@archcontext/surfaces",
|
|
15
|
-
"version": "0.9.
|
|
15
|
+
"version": "0.9.4",
|
|
16
16
|
"entrypoint": "archctx"
|
|
17
17
|
},
|
|
18
18
|
"daemon": {
|
|
19
19
|
"packageName": "@archcontext/local-runtime",
|
|
20
|
-
"version": "0.9.
|
|
20
|
+
"version": "0.9.4",
|
|
21
21
|
"entrypoint": "archctx daemon start",
|
|
22
22
|
"rpcSchemaVersion": "archcontext.runtime-rpc/v2"
|
|
23
23
|
},
|
|
24
24
|
"mcp": {
|
|
25
25
|
"packageName": "@archcontext/surfaces",
|
|
26
|
-
"version": "0.9.
|
|
26
|
+
"version": "0.9.4",
|
|
27
27
|
"entrypoint": "archctx mcp",
|
|
28
28
|
"transport": "stdio"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"schemas": {
|
|
32
32
|
"schemaSetVersion": "2026-06-25.al0-ledger",
|
|
33
|
-
"contractsPackageVersion": "0.9.
|
|
33
|
+
"contractsPackageVersion": "0.9.4",
|
|
34
34
|
"reviewChallenge": "archcontext.review-challenge/v2",
|
|
35
35
|
"attestation": "archcontext.attestation/v2",
|
|
36
36
|
"deviceIdentity": "archcontext.device-identity/v1",
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://archctx.repoharness.com/schemas/runtime/changeset-receipt.schema.json",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": ["schemaVersion", "journalId", "changeSetId", "baseModelDigest", "resultModelDigest", "files", "hashAlgorithm", "approvalAuthenticity"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "archcontext.changeset-receipt/v1" },
|
|
9
|
+
"journalId": { "type": "string", "minLength": 1 },
|
|
10
|
+
"changeSetId": { "type": "string", "minLength": 1 },
|
|
11
|
+
"baseModelDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
12
|
+
"resultModelDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
13
|
+
"hashAlgorithm": { "const": "sha256-canonical-json-body" },
|
|
14
|
+
"approvalAuthenticity": { "const": "unverified" },
|
|
15
|
+
"files": {
|
|
16
|
+
"type": "array", "maxItems": 10000,
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object", "additionalProperties": false,
|
|
19
|
+
"required": ["path", "operation", "bodyHash"],
|
|
20
|
+
"properties": {
|
|
21
|
+
"path": { "type": "string", "minLength": 1 },
|
|
22
|
+
"operation": { "enum": ["write", "delete"] },
|
|
23
|
+
"bodyHash": { "type": "string", "pattern": "^(sha256:[a-f0-9]{64}|missing)$" }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -202,12 +202,30 @@
|
|
|
202
202
|
"fields": {
|
|
203
203
|
"type": "object",
|
|
204
204
|
"additionalProperties": false,
|
|
205
|
-
"
|
|
206
|
-
|
|
205
|
+
"anyOf": [
|
|
206
|
+
{
|
|
207
|
+
"required": [
|
|
208
|
+
"content.decisions"
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"required": [
|
|
213
|
+
"model.layers"
|
|
214
|
+
]
|
|
215
|
+
}
|
|
207
216
|
],
|
|
208
217
|
"properties": {
|
|
209
218
|
"content.decisions": {
|
|
210
219
|
"const": "docs/adr"
|
|
220
|
+
},
|
|
221
|
+
"model.layers": {
|
|
222
|
+
"type": "array",
|
|
223
|
+
"minItems": 1,
|
|
224
|
+
"uniqueItems": true,
|
|
225
|
+
"items": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
228
|
+
}
|
|
211
229
|
}
|
|
212
230
|
}
|
|
213
231
|
}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"model",
|
|
16
16
|
"capabilityProfiles",
|
|
17
17
|
"contracts",
|
|
18
|
-
"documents"
|
|
18
|
+
"documents",
|
|
19
|
+
"decisions"
|
|
19
20
|
],
|
|
20
21
|
"properties": {
|
|
21
22
|
"schemaVersion": {
|
|
@@ -134,6 +135,7 @@
|
|
|
134
135
|
"$ref": "../repo/architecture-flow.schema.json"
|
|
135
136
|
}
|
|
136
137
|
},
|
|
138
|
+
"layers": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" } },
|
|
137
139
|
"sourcePaths": {
|
|
138
140
|
"type": "object",
|
|
139
141
|
"additionalProperties": false,
|
|
@@ -273,6 +275,57 @@
|
|
|
273
275
|
"items": {
|
|
274
276
|
"$ref": "#/$defs/document"
|
|
275
277
|
}
|
|
278
|
+
},
|
|
279
|
+
"decisions": {
|
|
280
|
+
"type": "array",
|
|
281
|
+
"items": {
|
|
282
|
+
"type": "object",
|
|
283
|
+
"additionalProperties": false,
|
|
284
|
+
"required": [
|
|
285
|
+
"id",
|
|
286
|
+
"title",
|
|
287
|
+
"status",
|
|
288
|
+
"decidedAt",
|
|
289
|
+
"appliesTo",
|
|
290
|
+
"supersedes",
|
|
291
|
+
"path"
|
|
292
|
+
],
|
|
293
|
+
"properties": {
|
|
294
|
+
"id": {
|
|
295
|
+
"type": "string"
|
|
296
|
+
},
|
|
297
|
+
"title": {
|
|
298
|
+
"type": "string"
|
|
299
|
+
},
|
|
300
|
+
"path": {
|
|
301
|
+
"type": "string"
|
|
302
|
+
},
|
|
303
|
+
"status": {
|
|
304
|
+
"type": [
|
|
305
|
+
"string",
|
|
306
|
+
"null"
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
"decidedAt": {
|
|
310
|
+
"type": [
|
|
311
|
+
"string",
|
|
312
|
+
"null"
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
"appliesTo": {
|
|
316
|
+
"type": "array",
|
|
317
|
+
"items": {
|
|
318
|
+
"type": "string"
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"supersedes": {
|
|
322
|
+
"type": "array",
|
|
323
|
+
"items": {
|
|
324
|
+
"type": "string"
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
276
329
|
}
|
|
277
330
|
},
|
|
278
331
|
"$defs": {
|
|
@@ -477,7 +530,8 @@
|
|
|
477
530
|
"relation",
|
|
478
531
|
"flow",
|
|
479
532
|
"contract",
|
|
480
|
-
"document"
|
|
533
|
+
"document",
|
|
534
|
+
"decision"
|
|
481
535
|
]
|
|
482
536
|
},
|
|
483
537
|
"requirement": {
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
},
|
|
333
333
|
"sourceStamps": {
|
|
334
334
|
"type": "object",
|
|
335
|
-
"description": "entity-summary targets only: the content digest of every declared source footprint this target documents, by node id.
|
|
335
|
+
"description": "entity-summary and runtime topology targets only: the content digest of every declared source footprint this target documents, by node id. A footprint belongs to its node's nearest ancestor-or-self with an entity-summary target, so it is stamped on exactly one entity-summary row; a runtime topology node's footprint is stamped on every runtime topology row instead, and those rows carry identical stamps (ADR-0049).",
|
|
336
336
|
"additionalProperties": {
|
|
337
337
|
"$ref": "#/$defs/digest"
|
|
338
338
|
}
|
|
@@ -360,24 +360,37 @@
|
|
|
360
360
|
"properties": {
|
|
361
361
|
"type": {
|
|
362
362
|
"not": {
|
|
363
|
-
"
|
|
363
|
+
"enum": [
|
|
364
|
+
"entity-summary",
|
|
365
|
+
"diagram-runtime-topology",
|
|
366
|
+
"runtime-topology-summary"
|
|
367
|
+
]
|
|
364
368
|
}
|
|
365
369
|
}
|
|
366
370
|
}
|
|
367
371
|
},
|
|
368
372
|
"then": {
|
|
369
373
|
"not": {
|
|
370
|
-
"
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
374
|
+
"required": [
|
|
375
|
+
"sourceStamps"
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"if": {
|
|
382
|
+
"properties": {
|
|
383
|
+
"type": {
|
|
384
|
+
"not": {
|
|
385
|
+
"const": "entity-summary"
|
|
380
386
|
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"then": {
|
|
391
|
+
"not": {
|
|
392
|
+
"required": [
|
|
393
|
+
"scale"
|
|
381
394
|
]
|
|
382
395
|
}
|
|
383
396
|
}
|
|
@@ -52,7 +52,11 @@
|
|
|
52
52
|
"properties": {
|
|
53
53
|
"code": { "type": "string", "pattern": "^AC_[A-Z0-9_]+$" },
|
|
54
54
|
"reasonCode": { "type": "string", "minLength": 1 },
|
|
55
|
-
"message": { "type": "string" }
|
|
55
|
+
"message": { "type": "string" },
|
|
56
|
+
"severity": { "enum": ["notice", "warning", "error", "critical"] },
|
|
57
|
+
"retryable": { "type": "boolean" },
|
|
58
|
+
"action": { "type": "string", "minLength": 1 },
|
|
59
|
+
"details": { "type": "object", "description": "Safe metadata validated by the registered failure contract; no raw exception diagnostics." }
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
62
|
{ "type": "null" }
|
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://archctx.repoharness.com/schemas/runtime/ref-impact.schema.json",
|
|
4
|
+
"title": "RefImpactV1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schemaVersion",
|
|
9
|
+
"base",
|
|
10
|
+
"head",
|
|
11
|
+
"depth",
|
|
12
|
+
"changedPaths",
|
|
13
|
+
"unownedPaths",
|
|
14
|
+
"touchedNodes",
|
|
15
|
+
"touchedFlowSteps",
|
|
16
|
+
"dependents",
|
|
17
|
+
"dependencyCoverage",
|
|
18
|
+
"modelDelta",
|
|
19
|
+
"limits",
|
|
20
|
+
"truncated"
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"schemaVersion": {
|
|
24
|
+
"const": "archcontext.ref-impact/v1"
|
|
25
|
+
},
|
|
26
|
+
"base": {
|
|
27
|
+
"oneOf": [
|
|
28
|
+
{
|
|
29
|
+
"type": "null"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"oneOf": [
|
|
33
|
+
{
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": [
|
|
37
|
+
"source",
|
|
38
|
+
"commitSha",
|
|
39
|
+
"treeOid",
|
|
40
|
+
"validation"
|
|
41
|
+
],
|
|
42
|
+
"properties": {
|
|
43
|
+
"source": {
|
|
44
|
+
"const": "ref"
|
|
45
|
+
},
|
|
46
|
+
"commitSha": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
49
|
+
},
|
|
50
|
+
"treeOid": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
53
|
+
},
|
|
54
|
+
"validation": {
|
|
55
|
+
"const": "immutable-tree"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": [
|
|
63
|
+
"source",
|
|
64
|
+
"headSha",
|
|
65
|
+
"headTreeOid",
|
|
66
|
+
"validation"
|
|
67
|
+
],
|
|
68
|
+
"properties": {
|
|
69
|
+
"source": {
|
|
70
|
+
"const": "worktree"
|
|
71
|
+
},
|
|
72
|
+
"headSha": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
75
|
+
},
|
|
76
|
+
"headTreeOid": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
79
|
+
},
|
|
80
|
+
"validation": {
|
|
81
|
+
"const": "stable-read"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"head": {
|
|
90
|
+
"oneOf": [
|
|
91
|
+
{
|
|
92
|
+
"type": "object",
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"required": [
|
|
95
|
+
"source",
|
|
96
|
+
"commitSha",
|
|
97
|
+
"treeOid",
|
|
98
|
+
"validation"
|
|
99
|
+
],
|
|
100
|
+
"properties": {
|
|
101
|
+
"source": {
|
|
102
|
+
"const": "ref"
|
|
103
|
+
},
|
|
104
|
+
"commitSha": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
107
|
+
},
|
|
108
|
+
"treeOid": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
111
|
+
},
|
|
112
|
+
"validation": {
|
|
113
|
+
"const": "immutable-tree"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "object",
|
|
119
|
+
"additionalProperties": false,
|
|
120
|
+
"required": [
|
|
121
|
+
"source",
|
|
122
|
+
"headSha",
|
|
123
|
+
"headTreeOid",
|
|
124
|
+
"validation"
|
|
125
|
+
],
|
|
126
|
+
"properties": {
|
|
127
|
+
"source": {
|
|
128
|
+
"const": "worktree"
|
|
129
|
+
},
|
|
130
|
+
"headSha": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
133
|
+
},
|
|
134
|
+
"headTreeOid": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"pattern": "^(?:[a-f0-9]{40}|[a-f0-9]{64})$"
|
|
137
|
+
},
|
|
138
|
+
"validation": {
|
|
139
|
+
"const": "stable-read"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
"depth": {
|
|
146
|
+
"type": "integer",
|
|
147
|
+
"minimum": 0,
|
|
148
|
+
"maximum": 10
|
|
149
|
+
},
|
|
150
|
+
"changedPaths": {
|
|
151
|
+
"type": "array",
|
|
152
|
+
"items": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": false,
|
|
155
|
+
"required": [
|
|
156
|
+
"path",
|
|
157
|
+
"added",
|
|
158
|
+
"deleted",
|
|
159
|
+
"baseOwners",
|
|
160
|
+
"headOwners",
|
|
161
|
+
"owners",
|
|
162
|
+
"reasonCodes"
|
|
163
|
+
],
|
|
164
|
+
"properties": {
|
|
165
|
+
"path": {
|
|
166
|
+
"type": "string"
|
|
167
|
+
},
|
|
168
|
+
"added": {
|
|
169
|
+
"type": [
|
|
170
|
+
"integer",
|
|
171
|
+
"null"
|
|
172
|
+
],
|
|
173
|
+
"minimum": 0
|
|
174
|
+
},
|
|
175
|
+
"deleted": {
|
|
176
|
+
"type": [
|
|
177
|
+
"integer",
|
|
178
|
+
"null"
|
|
179
|
+
],
|
|
180
|
+
"minimum": 0
|
|
181
|
+
},
|
|
182
|
+
"baseOwners": {
|
|
183
|
+
"type": "array",
|
|
184
|
+
"items": {
|
|
185
|
+
"type": "string"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"headOwners": {
|
|
189
|
+
"type": "array",
|
|
190
|
+
"items": {
|
|
191
|
+
"type": "string"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"owners": {
|
|
195
|
+
"type": "array",
|
|
196
|
+
"items": {
|
|
197
|
+
"type": "string"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"reasonCodes": {
|
|
201
|
+
"type": "array",
|
|
202
|
+
"items": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"maxItems": 1000
|
|
209
|
+
},
|
|
210
|
+
"unownedPaths": {
|
|
211
|
+
"type": "array",
|
|
212
|
+
"items": {
|
|
213
|
+
"type": "string"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"touchedNodes": {
|
|
217
|
+
"type": "array",
|
|
218
|
+
"items": {
|
|
219
|
+
"type": "object",
|
|
220
|
+
"additionalProperties": false,
|
|
221
|
+
"required": [
|
|
222
|
+
"nodeId",
|
|
223
|
+
"pathCount"
|
|
224
|
+
],
|
|
225
|
+
"properties": {
|
|
226
|
+
"nodeId": {
|
|
227
|
+
"type": "string"
|
|
228
|
+
},
|
|
229
|
+
"pathCount": {
|
|
230
|
+
"type": "integer",
|
|
231
|
+
"minimum": 0
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"maxItems": 1000
|
|
236
|
+
},
|
|
237
|
+
"touchedFlowSteps": {
|
|
238
|
+
"oneOf": [
|
|
239
|
+
{
|
|
240
|
+
"type": "object",
|
|
241
|
+
"additionalProperties": false,
|
|
242
|
+
"required": [
|
|
243
|
+
"status",
|
|
244
|
+
"reasonCodes",
|
|
245
|
+
"items"
|
|
246
|
+
],
|
|
247
|
+
"properties": {
|
|
248
|
+
"status": {
|
|
249
|
+
"const": "known"
|
|
250
|
+
},
|
|
251
|
+
"reasonCodes": {
|
|
252
|
+
"type": "array",
|
|
253
|
+
"maxItems": 0
|
|
254
|
+
},
|
|
255
|
+
"items": {
|
|
256
|
+
"type": "array",
|
|
257
|
+
"items": {
|
|
258
|
+
"type": "object",
|
|
259
|
+
"additionalProperties": false,
|
|
260
|
+
"required": [
|
|
261
|
+
"flowId",
|
|
262
|
+
"stepId",
|
|
263
|
+
"outcomeId",
|
|
264
|
+
"reasonCodes"
|
|
265
|
+
],
|
|
266
|
+
"properties": {
|
|
267
|
+
"flowId": {
|
|
268
|
+
"type": "string"
|
|
269
|
+
},
|
|
270
|
+
"stepId": {
|
|
271
|
+
"type": "string"
|
|
272
|
+
},
|
|
273
|
+
"outcomeId": {
|
|
274
|
+
"type": [
|
|
275
|
+
"string",
|
|
276
|
+
"null"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
"reasonCodes": {
|
|
280
|
+
"type": "array",
|
|
281
|
+
"items": {
|
|
282
|
+
"type": "string"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"maxItems": 2000
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"type": "object",
|
|
293
|
+
"additionalProperties": false,
|
|
294
|
+
"required": [
|
|
295
|
+
"status",
|
|
296
|
+
"reasonCodes",
|
|
297
|
+
"items"
|
|
298
|
+
],
|
|
299
|
+
"properties": {
|
|
300
|
+
"status": {
|
|
301
|
+
"const": "unknown"
|
|
302
|
+
},
|
|
303
|
+
"reasonCodes": {
|
|
304
|
+
"type": "array",
|
|
305
|
+
"minItems": 1,
|
|
306
|
+
"items": {
|
|
307
|
+
"type": "string"
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"items": {
|
|
311
|
+
"oneOf": [
|
|
312
|
+
{
|
|
313
|
+
"type": "null"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"type": "array",
|
|
317
|
+
"items": {
|
|
318
|
+
"type": "object",
|
|
319
|
+
"additionalProperties": false,
|
|
320
|
+
"required": [
|
|
321
|
+
"flowId",
|
|
322
|
+
"stepId",
|
|
323
|
+
"outcomeId",
|
|
324
|
+
"reasonCodes"
|
|
325
|
+
],
|
|
326
|
+
"properties": {
|
|
327
|
+
"flowId": {
|
|
328
|
+
"type": "string"
|
|
329
|
+
},
|
|
330
|
+
"stepId": {
|
|
331
|
+
"type": "string"
|
|
332
|
+
},
|
|
333
|
+
"outcomeId": {
|
|
334
|
+
"type": [
|
|
335
|
+
"string",
|
|
336
|
+
"null"
|
|
337
|
+
]
|
|
338
|
+
},
|
|
339
|
+
"reasonCodes": {
|
|
340
|
+
"type": "array",
|
|
341
|
+
"items": {
|
|
342
|
+
"type": "string"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"maxItems": 2000
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
"dependents": {
|
|
356
|
+
"type": "array",
|
|
357
|
+
"items": {
|
|
358
|
+
"type": "object",
|
|
359
|
+
"additionalProperties": false,
|
|
360
|
+
"required": [
|
|
361
|
+
"nodeId",
|
|
362
|
+
"touchedNodeId",
|
|
363
|
+
"relationIds"
|
|
364
|
+
],
|
|
365
|
+
"properties": {
|
|
366
|
+
"nodeId": {
|
|
367
|
+
"type": "string"
|
|
368
|
+
},
|
|
369
|
+
"touchedNodeId": {
|
|
370
|
+
"type": "string"
|
|
371
|
+
},
|
|
372
|
+
"relationIds": {
|
|
373
|
+
"type": "array",
|
|
374
|
+
"items": {
|
|
375
|
+
"type": "string"
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
"maxItems": 5000
|
|
381
|
+
},
|
|
382
|
+
"dependencyCoverage": {
|
|
383
|
+
"type": "object",
|
|
384
|
+
"additionalProperties": false,
|
|
385
|
+
"required": [
|
|
386
|
+
"status",
|
|
387
|
+
"graph",
|
|
388
|
+
"pathSelection"
|
|
389
|
+
],
|
|
390
|
+
"properties": {
|
|
391
|
+
"status": {
|
|
392
|
+
"enum": [
|
|
393
|
+
"complete",
|
|
394
|
+
"partial"
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
"graph": {
|
|
398
|
+
"const": "head"
|
|
399
|
+
},
|
|
400
|
+
"pathSelection": {
|
|
401
|
+
"const": "one-shortest-path-per-node-pair"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
"modelDelta": {
|
|
406
|
+
"oneOf": [
|
|
407
|
+
{
|
|
408
|
+
"type": "object",
|
|
409
|
+
"additionalProperties": false,
|
|
410
|
+
"required": [
|
|
411
|
+
"status",
|
|
412
|
+
"changes",
|
|
413
|
+
"truncated"
|
|
414
|
+
],
|
|
415
|
+
"properties": {
|
|
416
|
+
"status": {
|
|
417
|
+
"const": "known"
|
|
418
|
+
},
|
|
419
|
+
"changes": {
|
|
420
|
+
"type": "array",
|
|
421
|
+
"items": {
|
|
422
|
+
"type": "object",
|
|
423
|
+
"additionalProperties": false,
|
|
424
|
+
"required": [
|
|
425
|
+
"kind",
|
|
426
|
+
"id",
|
|
427
|
+
"change",
|
|
428
|
+
"fields"
|
|
429
|
+
],
|
|
430
|
+
"properties": {
|
|
431
|
+
"kind": {
|
|
432
|
+
"enum": [
|
|
433
|
+
"nodes",
|
|
434
|
+
"relations",
|
|
435
|
+
"flows"
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
"id": {
|
|
439
|
+
"type": "string"
|
|
440
|
+
},
|
|
441
|
+
"change": {
|
|
442
|
+
"enum": [
|
|
443
|
+
"added",
|
|
444
|
+
"removed",
|
|
445
|
+
"changed"
|
|
446
|
+
]
|
|
447
|
+
},
|
|
448
|
+
"fields": {
|
|
449
|
+
"type": "array",
|
|
450
|
+
"items": {
|
|
451
|
+
"type": "string"
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"maxItems": 5000
|
|
457
|
+
},
|
|
458
|
+
"truncated": {
|
|
459
|
+
"type": "boolean"
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"type": "object",
|
|
465
|
+
"additionalProperties": false,
|
|
466
|
+
"required": [
|
|
467
|
+
"status",
|
|
468
|
+
"reasonCode",
|
|
469
|
+
"changes",
|
|
470
|
+
"truncated"
|
|
471
|
+
],
|
|
472
|
+
"properties": {
|
|
473
|
+
"status": {
|
|
474
|
+
"const": "unknown"
|
|
475
|
+
},
|
|
476
|
+
"reasonCode": {
|
|
477
|
+
"const": "paths-only"
|
|
478
|
+
},
|
|
479
|
+
"changes": {
|
|
480
|
+
"type": "null"
|
|
481
|
+
},
|
|
482
|
+
"truncated": {
|
|
483
|
+
"const": false
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
},
|
|
489
|
+
"limits": {
|
|
490
|
+
"type": "object",
|
|
491
|
+
"additionalProperties": false,
|
|
492
|
+
"required": [
|
|
493
|
+
"changedPaths",
|
|
494
|
+
"nodes",
|
|
495
|
+
"relations",
|
|
496
|
+
"flowSteps",
|
|
497
|
+
"dependents",
|
|
498
|
+
"modelChanges",
|
|
499
|
+
"depth",
|
|
500
|
+
"diffBytes",
|
|
501
|
+
"responseBytes",
|
|
502
|
+
"diffLines",
|
|
503
|
+
"diffWork",
|
|
504
|
+
"codeFactFiles",
|
|
505
|
+
"codeFactBytes"
|
|
506
|
+
],
|
|
507
|
+
"properties": {
|
|
508
|
+
"codeFactFiles": { "const": 10000 },
|
|
509
|
+
"codeFactBytes": { "const": 8388608 },
|
|
510
|
+
"changedPaths": {
|
|
511
|
+
"const": 1000
|
|
512
|
+
},
|
|
513
|
+
"nodes": {
|
|
514
|
+
"const": 1000
|
|
515
|
+
},
|
|
516
|
+
"relations": {
|
|
517
|
+
"const": 5000
|
|
518
|
+
},
|
|
519
|
+
"flowSteps": {
|
|
520
|
+
"const": 2000
|
|
521
|
+
},
|
|
522
|
+
"dependents": {
|
|
523
|
+
"const": 5000
|
|
524
|
+
},
|
|
525
|
+
"modelChanges": {
|
|
526
|
+
"const": 5000
|
|
527
|
+
},
|
|
528
|
+
"depth": {
|
|
529
|
+
"const": 10
|
|
530
|
+
},
|
|
531
|
+
"diffBytes": {
|
|
532
|
+
"const": 8388608
|
|
533
|
+
},
|
|
534
|
+
"responseBytes": {
|
|
535
|
+
"const": 8388608
|
|
536
|
+
},
|
|
537
|
+
"diffLines": {
|
|
538
|
+
"const": 100000
|
|
539
|
+
},
|
|
540
|
+
"diffWork": {
|
|
541
|
+
"const": 2000000
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
"truncated": {
|
|
546
|
+
"type": "object",
|
|
547
|
+
"additionalProperties": false,
|
|
548
|
+
"required": [
|
|
549
|
+
"changedPaths",
|
|
550
|
+
"touchedNodes",
|
|
551
|
+
"relations",
|
|
552
|
+
"flowSteps",
|
|
553
|
+
"dependents",
|
|
554
|
+
"modelDelta"
|
|
555
|
+
],
|
|
556
|
+
"properties": {
|
|
557
|
+
"changedPaths": {
|
|
558
|
+
"type": "boolean"
|
|
559
|
+
},
|
|
560
|
+
"touchedNodes": {
|
|
561
|
+
"type": "boolean"
|
|
562
|
+
},
|
|
563
|
+
"relations": {
|
|
564
|
+
"type": "boolean"
|
|
565
|
+
},
|
|
566
|
+
"flowSteps": {
|
|
567
|
+
"type": "boolean"
|
|
568
|
+
},
|
|
569
|
+
"dependents": {
|
|
570
|
+
"type": "boolean"
|
|
571
|
+
},
|
|
572
|
+
"modelDelta": {
|
|
573
|
+
"type": "boolean"
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
package/src/architecture.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface DependencyConstraintV1 {
|
|
|
81
81
|
id: string;
|
|
82
82
|
severity: "error" | "warning";
|
|
83
83
|
scope: { nodes: string[] };
|
|
84
|
-
rule: { type: "forbid-dependency"; targets: string[] };
|
|
84
|
+
rule: { type: "forbid-dependency"; targets: string[] } | { type: "layer-direction"; layers: string[] };
|
|
85
85
|
rationale: string;
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -102,6 +102,7 @@ export const DEPENDENCY_CONSTRAINT_REASON_CODES = [
|
|
|
102
102
|
"code-facts-truncated",
|
|
103
103
|
"code-facts-unavailable",
|
|
104
104
|
"unresolved-import",
|
|
105
|
+
"layer-endpoint-unclassified",
|
|
105
106
|
"workspace-resolution-failed"
|
|
106
107
|
] as const;
|
|
107
108
|
export type DependencyConstraintReasonCode = (typeof DEPENDENCY_CONSTRAINT_REASON_CODES)[number];
|
|
@@ -112,6 +113,8 @@ export interface DependencyConstraintViolationV1 {
|
|
|
112
113
|
toPath: string;
|
|
113
114
|
fromNode: string;
|
|
114
115
|
toNode: string;
|
|
116
|
+
fromLayer?: string;
|
|
117
|
+
toLayer?: string;
|
|
115
118
|
severity: "error" | "warning";
|
|
116
119
|
}
|
|
117
120
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Portable content evidence, not an authenticated approval or ledger acceptance. */
|
|
2
|
+
export interface ChangeSetReceiptV1 {
|
|
3
|
+
schemaVersion: "archcontext.changeset-receipt/v1";
|
|
4
|
+
journalId: string;
|
|
5
|
+
changeSetId: string;
|
|
6
|
+
baseModelDigest: string;
|
|
7
|
+
resultModelDigest: string;
|
|
8
|
+
files: Array<{ path: string; operation: "write" | "delete"; bodyHash: string }>;
|
|
9
|
+
hashAlgorithm: "sha256-canonical-json-body";
|
|
10
|
+
approvalAuthenticity: "unverified";
|
|
11
|
+
}
|
package/src/failure.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { changeSetRecoveryDetailsSnapshot } from "./changeset-recovery";
|
|
2
|
+
import { isNativeError } from "node:util/types";
|
|
3
|
+
import { MODEL_VALIDATION_DIAGNOSTIC_CODES } from "./ports";
|
|
2
4
|
import { PROJECTION_RECOVERY_DETAILS_LIMIT_BYTES, projectionRecoveryDetailsSnapshot } from "./projection-recovery";
|
|
3
5
|
import { ERROR_CATALOG, canonicalize, type ArchContextErrorCode, type Json, type Severity } from "./schema";
|
|
4
6
|
|
|
@@ -6,6 +8,7 @@ import { ERROR_CATALOG, canonicalize, type ArchContextErrorCode, type Json, type
|
|
|
6
8
|
export type FailureCode = ArchContextErrorCode | "RPC_TIMEOUT" | "RPC_ABORTED";
|
|
7
9
|
export const FAILURE_STAGES = Object.freeze(["debt", "complete", "practice-checkpoint", "cli", "mcp", "hook-checkpoint", "failure-metadata", "public-operation", "native-export", "docs-anchors", "flows-check"] as const);
|
|
8
10
|
export type FailureStage = typeof FAILURE_STAGES[number];
|
|
11
|
+
const ERROR_CLASSES = Object.freeze(["Error", "TypeError", "RangeError", "SyntaxError", "ReferenceError", "URIError", "EvalError", "AggregateError", "NonError"]);
|
|
9
12
|
export interface StrictFailure<C extends FailureCode = FailureCode> {
|
|
10
13
|
code: C;
|
|
11
14
|
message: string;
|
|
@@ -35,6 +38,15 @@ export const CODE_FACTS_ISSUE_MESSAGES = Object.freeze({
|
|
|
35
38
|
});
|
|
36
39
|
/** Each reason has a closed fact vocabulary. No source text or recovery binding is a summary fact. */
|
|
37
40
|
const policies: Record<string, Policy> = {
|
|
41
|
+
"code-facts-read-not-ready": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The existing CodeGraph index does not attest to the current source population.", facts: { issues: "codeFactsIssues" }, action: "codegraph-sync", retryable: false },
|
|
42
|
+
"code-facts-snapshot-changed": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "Source or index inputs changed while reading the private snapshot.", action: "retry-read", retryable: true, facts: {} },
|
|
43
|
+
"code-facts-snapshot-limit-exceeded": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The private CodeGraph snapshot exceeds its 512 MiB or 100000 entry limit.", action: "reduce-snapshot-size", retryable: false, facts: {} },
|
|
44
|
+
"code-facts-snapshot-layout-unsupported": { code: "AC_CODE_FACTS_UNAVAILABLE", message: "The repository layout cannot be safely isolated for a zero-write CodeGraph read.", action: "inspect-repository-layout", retryable: false, facts: {} },
|
|
45
|
+
"daemon-root-missing": { code: "AC_RUNTIME_UNAVAILABLE", message: "The daemon start worktree no longer exists. Stop this daemon using its workspace state directory.", action: "stop-targeted-daemon", retryable: false, facts: {} },
|
|
46
|
+
"changeset-receipt-journal-unavailable": { code: "AC_PRECONDITION_FAILED", message: "No committed ChangeSet journal exists for this repository and journal id.", action: "select-committed-journal" },
|
|
47
|
+
"changeset-receipt-transition-unavailable": { code: "AC_PRECONDITION_FAILED", message: "This journal has no recorded model transition; a complete receipt cannot be exported.", action: "inspect-journal-evidence" },
|
|
48
|
+
"changeset-receipt-files-invalid": { code: "AC_PRECONDITION_FAILED", message: "Journal file evidence cannot form a portable receipt.", action: "inspect-journal-evidence" },
|
|
49
|
+
"changeset-receipt-limit-exceeded": { code: "AC_PRECONDITION_FAILED", message: "Journal evidence exceeds the portable receipt size limit.", action: "inspect-journal-evidence" },
|
|
38
50
|
"git-worktree-required": { code: "AC_REPO_NOT_FOUND", message: "This operation requires a Git worktree.", fields: ["checks"] },
|
|
39
51
|
"model-missing": { code: "AC_MODEL_ADOPTION_REQUIRED", message: "Architecture debt requires an adopted model.", fields: ["checks"] },
|
|
40
52
|
"changed-path-invalid": { code: "AC_SCHEMA_INVALID", message: "Changed paths must be an array of repository-relative POSIX paths.", fields: ["checks"] },
|
|
@@ -47,13 +59,14 @@ const policies: Record<string, Policy> = {
|
|
|
47
59
|
"code-facts-not-ready": { code: "AC_CODE_FACTS_NOT_READY", message: "Repository code facts are not ready. Run archctx doctor --json and follow the reported action.", facts: { issues: "codeFactsIssues" } },
|
|
48
60
|
"checkpoint-input-invalid": { code: "AC_SCHEMA_INVALID", message: "Checkpoint arguments violate the declared input schema.", fields: ["issueCount"], action: "correct-command-arguments" },
|
|
49
61
|
"cli-input-invalid": { code: "AC_SCHEMA_INVALID", message: "Command arguments violate the declared input contract.", action: "correct-command-arguments" },
|
|
62
|
+
"constraint-model-invalid": { code: "AC_SCHEMA_INVALID", message: "Dependency constraint declarations are invalid.", facts: { issueCount: "uint" }, action: "repair-constraint-declarations" },
|
|
50
63
|
"complete-input-invalid": { code: "AC_SCHEMA_INVALID", message: "Completion input violates the caller authority contract.", action: "correct-command-arguments" },
|
|
51
64
|
"hook-event-invalid": { code: "AC_SCHEMA_INVALID", message: "Hook event violates the declared input contract.", action: "correct-command-arguments" },
|
|
52
65
|
"egress-policy-denied": { code: "AC_POLICY_VIOLATION", message: "Local policy refused this operation." },
|
|
53
66
|
"runtime-version-unsupported": { code: "AC_RUNTIME_VERSION_UNSUPPORTED", message: "The connected runtime version is unsupported." },
|
|
54
67
|
"rpc-timeout": { code: "RPC_TIMEOUT", message: "The runtime RPC deadline elapsed without a response; a mutation outcome is unknown.", fields: ["method", "timeoutMs", "elapsedMs", "mutationOutcome"], action: "reconcile-before-retry" },
|
|
55
68
|
"rpc-aborted": { code: "RPC_ABORTED", message: "The runtime RPC caller aborted without a response; a mutation outcome is unknown.", fields: ["method", "timeoutMs", "elapsedMs", "mutationOutcome"], action: "reconcile-before-retry" },
|
|
56
|
-
"failure-unclassified": { code: "AC_UNCLASSIFIED_FAILURE", message: "The operation failed without a classified cause. Run archctx doctor --json before retrying.", action: "inspect-diagnostics" },
|
|
69
|
+
"failure-unclassified": { code: "AC_UNCLASSIFIED_FAILURE", message: "The operation failed without a classified cause. Run archctx doctor --json before retrying.", action: "inspect-diagnostics", fields: ["errorClass"] },
|
|
57
70
|
};
|
|
58
71
|
// C1 policies are selected at explicit producer branches, never from diagnostic text.
|
|
59
72
|
Object.assign(policies, {
|
|
@@ -140,7 +153,8 @@ Object.assign(policies, {
|
|
|
140
153
|
"apply-profile-changed": {"code": "AC_PRECONDITION_FAILED", "message": "ChangeSet worktree digest profile changed before apply.", "facts": {}},
|
|
141
154
|
"apply-worktree-changed": {"code": "AC_PRECONDITION_FAILED", "message": "Worktree digest changed before apply.", "facts": {"expectedWorktreeDigest": "sha256", "actualWorktreeDigest": "sha256"}},
|
|
142
155
|
"apply-head-changed": {"code": "AC_PRECONDITION_FAILED", "message": "ChangeSet HEAD changed before apply.", "facts": {"expectedHeadSha": "head", "actualHeadSha": "head"}},
|
|
143
|
-
"apply-model-invalid": {
|
|
156
|
+
"apply-model-invalid": { code: "AC_PRECONDITION_FAILED", message: "ChangeSet base model is invalid.", retryable: false, action: "repair-model", facts: { issueCount: "uint", diagnostics: "modelValidationDiagnostics", omittedIssueCount: "uint" } },
|
|
157
|
+
"plan-model-invalid": { code: "AC_PRECONDITION_FAILED", message: "ChangeSet base model is invalid.", retryable: false, action: "repair-model", facts: { issueCount: "uint", diagnostics: "modelValidationDiagnostics", omittedIssueCount: "uint" } },
|
|
144
158
|
"apply-model-changed": {"code": "AC_PRECONDITION_FAILED", "message": "ChangeSet model digest changed before apply.", "facts": {"expectedModelDigest": "sha256", "actualModelDigest": "sha256"}},
|
|
145
159
|
"apply-preimage-changed": {"code": "AC_PRECONDITION_FAILED", "message": "Projection preimage changed before apply.", "facts": {"issueCount": "uint"}},
|
|
146
160
|
"projection-input-invalid": {"code": "AC_SCHEMA_INVALID", "message": "Projection input invalid.", "facts": {}},
|
|
@@ -309,6 +323,7 @@ function ownData(input: unknown, key: string): unknown {
|
|
|
309
323
|
|
|
310
324
|
function fact(key: string, value: unknown): Json | undefined {
|
|
311
325
|
if (key === "stage") return typeof value === "string" && (FAILURE_STAGES as readonly string[]).includes(value) ? value : undefined;
|
|
326
|
+
if (key === "errorClass") return typeof value === "string" && ERROR_CLASSES.includes(value) ? value : undefined;
|
|
312
327
|
if (key === "checks") {
|
|
313
328
|
if (!Array.isArray(value)) return undefined;
|
|
314
329
|
const length = Object.getOwnPropertyDescriptor(value, "length")?.value;
|
|
@@ -428,6 +443,20 @@ function localFactValue(rule: string, value: unknown): Json {
|
|
|
428
443
|
}
|
|
429
444
|
if (rule === "commandSuggestion" && (value === null || (typeof value === "string" && bytes(value) <= 1024 && /^archctx (recommendations |refactor verify )[^\r\n]*$/.test(value)))) return value;
|
|
430
445
|
if (rule === "publicConfirmationToken" && typeof value === "string" && bytes(value) <= 1024 && /^public:github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+:[a-f0-9]{40}:[A-Za-z0-9_.:-]+$/.test(value)) return value;
|
|
446
|
+
if (rule === "modelValidationDiagnostics") {
|
|
447
|
+
if (!Array.isArray(value)) throw new Error("Invalid model diagnostics budget");
|
|
448
|
+
const length = Object.getOwnPropertyDescriptor(value, "length")?.value;
|
|
449
|
+
if (!Number.isSafeInteger(length) || length > 8 || Reflect.ownKeys(value).length !== length + 1) throw new Error("Invalid model diagnostics budget");
|
|
450
|
+
return Array.from({ length }, (_, index) => {
|
|
451
|
+
const entry = Object.getOwnPropertyDescriptor(value, String(index));
|
|
452
|
+
if (!entry || !("value" in entry)) throw new Error("Model diagnostics must use own data");
|
|
453
|
+
const fields = dataRecord(entry.value);
|
|
454
|
+
const path = fields.path?.value, code = fields.code?.value;
|
|
455
|
+
if (Object.keys(fields).length !== 2 || typeof path !== "string" || bytes(path) > 256 || path.startsWith("/") || path.includes("\\") || path.split("/").includes("..") || path.length === 0
|
|
456
|
+
|| !MODEL_VALIDATION_DIAGNOSTIC_CODES.includes(code as any)) throw new Error("Invalid model diagnostic");
|
|
457
|
+
return { path, code: code as string };
|
|
458
|
+
});
|
|
459
|
+
}
|
|
431
460
|
if (rule === "diagnosticPaths" || rule === "diagnosticCommands") {
|
|
432
461
|
if (!Array.isArray(value)) throw new Error("Diagnostics must be an own list");
|
|
433
462
|
const length=Object.getOwnPropertyDescriptor(value,"length")?.value;
|
|
@@ -727,8 +756,18 @@ function failureFromData<C extends FailureCode = FailureCode>(input: unknown): S
|
|
|
727
756
|
action: action as string | undefined, severity: severity as Severity | undefined, retryable: retryable as boolean | undefined
|
|
728
757
|
});
|
|
729
758
|
}
|
|
730
|
-
export function unclassifiedFailure(stage?: FailureStage): StrictFailure<"AC_UNCLASSIFIED_FAILURE"> {
|
|
731
|
-
|
|
759
|
+
export function unclassifiedFailure(stage?: FailureStage, error?: unknown): StrictFailure<"AC_UNCLASSIFIED_FAILURE"> {
|
|
760
|
+
const errorClass = error === undefined ? undefined
|
|
761
|
+
: !isNativeError(error) ? "NonError"
|
|
762
|
+
: error instanceof TypeError ? "TypeError"
|
|
763
|
+
: error instanceof RangeError ? "RangeError"
|
|
764
|
+
: error instanceof SyntaxError ? "SyntaxError"
|
|
765
|
+
: error instanceof ReferenceError ? "ReferenceError"
|
|
766
|
+
: error instanceof URIError ? "URIError"
|
|
767
|
+
: error instanceof EvalError ? "EvalError"
|
|
768
|
+
: error instanceof AggregateError ? "AggregateError"
|
|
769
|
+
: "Error";
|
|
770
|
+
return knownFailure("AC_UNCLASSIFIED_FAILURE", "failure-unclassified", { ...(stage ? { stage } : {}), ...(errorClass ? { errorClass } : {}) });
|
|
732
771
|
}
|
|
733
772
|
export function failureEnvelope<C extends FailureCode>(requestId: string, failure: StrictFailure<C>): FailureEnvelope<C> {
|
|
734
773
|
// Revalidate/copy even typed metadata so caller mutation cannot bypass the closed contract.
|
|
@@ -755,7 +794,7 @@ export class FailureError<C extends FailureCode = ArchContextErrorCode> extends
|
|
|
755
794
|
}
|
|
756
795
|
export function toEnvelope(requestId: string, error: unknown, stage: FailureStage): FailureEnvelope {
|
|
757
796
|
try {
|
|
758
|
-
return failureEnvelope(requestId, error instanceof FailureError ? ownData(error, "failure") as StrictFailure : unclassifiedFailure(stage));
|
|
797
|
+
return failureEnvelope(requestId, error instanceof FailureError ? ownData(error, "failure") as StrictFailure : unclassifiedFailure(stage, error));
|
|
759
798
|
} catch {
|
|
760
799
|
return failureEnvelope(requestId, unclassifiedFailure("failure-metadata"));
|
|
761
800
|
}
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,8 @@ export * from "./external-docs";
|
|
|
6
6
|
export * from "./github-governance";
|
|
7
7
|
export * from "./ledger";
|
|
8
8
|
export * from "./native-context";
|
|
9
|
+
export * from "./ref-impact";
|
|
10
|
+
export * from "./changeset-receipt";
|
|
9
11
|
export * from "./ownership-dependencies";
|
|
10
12
|
export * from "./ports";
|
|
11
13
|
export * from "./practices";
|
|
@@ -21,3 +23,4 @@ export * from "./failure";
|
|
|
21
23
|
export * from "./validator";
|
|
22
24
|
|
|
23
25
|
export * from "./changeset-recovery";
|
|
26
|
+
export * from "./layers";
|
package/src/layers.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Explicit ordered layer authority; no path, parent or name inference. */
|
|
2
|
+
export function orderedLayerIssues(layers: unknown, nodes: readonly { id?: unknown; layer?: unknown }[] = []): string[] {
|
|
3
|
+
if (layers === undefined) return [];
|
|
4
|
+
if (!Array.isArray(layers) || layers.length === 0 || layers.some(layer => typeof layer !== "string" || !/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(layer)) || new Set(layers).size !== layers.length) return ["architecture-layer-order-invalid"];
|
|
5
|
+
return nodes.filter(node => node.layer !== undefined && !layers.includes(node.layer)).map(node => `architecture-node-layer-undeclared: ${String(node.id)} (${String(node.layer)})`);
|
|
6
|
+
}
|
package/src/native-context.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FailureError, knownFailure, toEnvelope, unclassifiedFailure } from "./failure";
|
|
2
2
|
import { canonicalize, errorEnvelope, type ArchContextErrorCode, type Json, type JsonEnvelope } from "./schema";
|
|
3
|
+
import { orderedLayerIssues } from "./layers";
|
|
3
4
|
import { runtimeTopologyModelIssues } from "./runtime-topology";
|
|
4
5
|
import { jsonSchemaResolver, validateJsonSchema, type JsonSchemaResolver } from "./validator";
|
|
5
6
|
|
|
@@ -27,6 +28,7 @@ export const NATIVE_CONTEXT_REASONS = [
|
|
|
27
28
|
export type NativeContextReasonCode = (typeof NATIVE_CONTEXT_REASONS)[number];
|
|
28
29
|
export type NativeModelRecord = Record<string, Json>;
|
|
29
30
|
export interface NativeContextModel {
|
|
31
|
+
layers?: string[];
|
|
30
32
|
nodes: NativeModelRecord[];
|
|
31
33
|
relations: NativeModelRecord[];
|
|
32
34
|
flows: NativeModelRecord[];
|
|
@@ -34,7 +36,7 @@ export interface NativeContextModel {
|
|
|
34
36
|
}
|
|
35
37
|
export interface NativeContextInput {
|
|
36
38
|
path: string;
|
|
37
|
-
role: "manifest" | "node" | "relation" | "flow" | "contract" | "document";
|
|
39
|
+
role: "manifest" | "node" | "relation" | "flow" | "contract" | "document" | "decision";
|
|
38
40
|
requirement: "required" | "declared" | "optional";
|
|
39
41
|
presence: "present" | "missing";
|
|
40
42
|
mode: "100644" | "100755" | null;
|
|
@@ -89,6 +91,10 @@ export interface NativeContextContract {
|
|
|
89
91
|
export type NativeContextSnapshot =
|
|
90
92
|
| { source: "ref"; commitSha: string; treeOid: string; validation: "immutable-tree" }
|
|
91
93
|
| { source: "worktree"; headSha: string; headTreeOid: string; validation: "stable-read" };
|
|
94
|
+
export interface NativeContextDecision {
|
|
95
|
+
id: string; title: string; status: string | null; decidedAt: string | null;
|
|
96
|
+
appliesTo: string[]; supersedes: string[]; path: string;
|
|
97
|
+
}
|
|
92
98
|
export interface NativeContextExportV1 {
|
|
93
99
|
schemaVersion: typeof NATIVE_CONTEXT_SCHEMA_VERSION;
|
|
94
100
|
profile: typeof NATIVE_CONTEXT_PROFILE;
|
|
@@ -101,6 +107,7 @@ export interface NativeContextExportV1 {
|
|
|
101
107
|
capabilityProfiles: NativeCapabilityProfile[];
|
|
102
108
|
contracts: NativeContextContract[];
|
|
103
109
|
documents: NativeContextDocument[];
|
|
110
|
+
decisions: NativeContextDecision[];
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
const PATH_REASONS = new Set<NativeContextReasonCode>(["native-context-path-unsafe", "native-context-entry-kind-unsupported", "native-context-ref-unsafe"]);
|
|
@@ -165,7 +172,7 @@ export function nativeAllowedNodeKinds(schemas: NativeContextSchemas): string[]
|
|
|
165
172
|
|
|
166
173
|
/** Complete native shape/reference validation; optional paths bind parsed records, never IDs. */
|
|
167
174
|
export function nativeContextModelIssues(model: NativeContextModel, schemas: NativeContextSchemas, recordPaths?: ReadonlyMap<NativeModelRecord, string>): NativeModelIssue[] {
|
|
168
|
-
const issues: NativeModelIssue[] =
|
|
175
|
+
const issues: NativeModelIssue[] = orderedLayerIssues(model.layers, model.nodes).map(invariant => ({ entityId: "manifest", field: "model.layers", invariant }));
|
|
169
176
|
const add = (record: NativeModelRecord | string, field: string, invariant: string) => {
|
|
170
177
|
const entityId = typeof record === "string" ? record : typeof record.id === "string" ? record.id : "(undeclared)";
|
|
171
178
|
const path = typeof record === "string" ? undefined : recordPaths?.get(record);
|
package/src/ports.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { digestJson, type Json } from "./schema";
|
|
1
|
+
import { digestJson, isRepoRelativePosixPath, type Json } from "./schema";
|
|
2
2
|
import type {
|
|
3
3
|
AgentJobV1,
|
|
4
4
|
ArchitectureEventSource,
|
|
@@ -142,9 +142,18 @@ export interface LocalStorePort {
|
|
|
142
142
|
saveReviewResult(reviewId: string, result: unknown): Promise<void>;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
export const MODEL_VALIDATION_DIAGNOSTIC_CODES = ["missing-file", "schema-version-missing", "node-schema-invalid"] as const;
|
|
146
|
+
export interface ModelValidationDiagnostic {
|
|
147
|
+
path: string;
|
|
148
|
+
code: typeof MODEL_VALIDATION_DIAGNOSTIC_CODES[number];
|
|
149
|
+
/** Validation-owned error identity; never emitted in the public failure projection. */
|
|
150
|
+
error: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
145
153
|
export interface ModelValidationResult {
|
|
146
154
|
valid: boolean;
|
|
147
155
|
errors: string[];
|
|
156
|
+
diagnostics?: ModelValidationDiagnostic[];
|
|
148
157
|
/**
|
|
149
158
|
* The subset of `errors` that are cross-file references resolving to nothing, such as an ADR
|
|
150
159
|
* `appliesTo` id with no node. Omitted when empty.
|
|
@@ -152,11 +161,22 @@ export interface ModelValidationResult {
|
|
|
152
161
|
referenceErrors?: string[];
|
|
153
162
|
/** Node schema errors with their file paths. Only a write to that node can repair them. */
|
|
154
163
|
nodeSchemaErrors?: { path: string; error: string }[];
|
|
164
|
+
/** Errors specifically repairable by replacing manifest model.layers; after validation remains strict. */
|
|
165
|
+
layerOrderErrors?: string[];
|
|
155
166
|
/** Problems that do not invalidate the model, such as an ignored legacy setting. Omitted when empty. */
|
|
156
167
|
warnings?: string[];
|
|
157
168
|
modelDigest: string;
|
|
158
169
|
}
|
|
159
170
|
|
|
171
|
+
/** Projects only authority-supplied locations, never text parsed from validation errors. */
|
|
172
|
+
export function modelValidationFailureDetails(result: ModelValidationResult, blockingErrors: readonly string[]) {
|
|
173
|
+
const blocking = new Set(blockingErrors);
|
|
174
|
+
const records = [...result.diagnostics ?? [], ...(result.nodeSchemaErrors ?? []).map(issue => ({ ...issue, code: "node-schema-invalid" as const }))];
|
|
175
|
+
const diagnostics = records.filter(issue => blocking.has(issue.error) && isRepoRelativePosixPath(issue.path) && new TextEncoder().encode(JSON.stringify(issue.path)).length <= 256)
|
|
176
|
+
.slice(0, Math.min(8, blockingErrors.length)).map(({ path, code }) => ({ path, code }));
|
|
177
|
+
return { issueCount: blockingErrors.length, diagnostics, omittedIssueCount: blockingErrors.length - diagnostics.length };
|
|
178
|
+
}
|
|
179
|
+
|
|
160
180
|
export interface ModelStorePort {
|
|
161
181
|
loadManifest(workspace: WorkspaceRef): Promise<unknown>;
|
|
162
182
|
loadModel(workspace: WorkspaceRef): Promise<unknown[]>;
|
package/src/product-version.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ARCHCONTEXT_PRODUCT_NAME = "archctx";
|
|
2
|
-
export const ARCHCONTEXT_PRODUCT_VERSION = "0.9.
|
|
2
|
+
export const ARCHCONTEXT_PRODUCT_VERSION = "0.9.4";
|
|
3
3
|
export const ARCHCONTEXT_PACKAGE_MANAGER = "bun@1.4.3";
|
|
4
4
|
export const ARCHCONTEXT_NODE_RANGE = ">=22.22 <26";
|
|
5
5
|
export const LOCAL_RUNTIME_RPC_SCHEMA_VERSION = "archcontext.runtime-rpc/v2";
|
|
@@ -36,7 +36,7 @@ export const SUPERSEDED_ARCHITECTURE_DOCS_PROJECTION_MANIFEST_SCHEMA_VERSIONS =
|
|
|
36
36
|
export const PROJECTION_MANIFEST_UPGRADE_REQUIRED = "projection-manifest-upgrade-required" as const;
|
|
37
37
|
/** The reason code of a current-format manifest that fails its contract; restore it from Git. */
|
|
38
38
|
export const PROJECTION_MANIFEST_INVALID = "projection-manifest-invalid" as const;
|
|
39
|
-
/** The reason code of a declared source footprint that no
|
|
39
|
+
/** The reason code of a declared source footprint that no stamping target carries a stamp for. */
|
|
40
40
|
export const PROJECTION_FOOTPRINT_UNCOVERED = "projection-footprint-uncovered" as const;
|
|
41
41
|
export const ARCHITECTURE_DOCS_PROJECTION_PROVENANCE_SCHEMA_VERSION = "archcontext.architecture-docs-projection-provenance/v3" as const;
|
|
42
42
|
export const ARCHITECTURE_DOCS_LAYOUT_VERSION_V1 = "archcontext.docs-layout/v1" as const;
|
|
@@ -130,9 +130,11 @@ export interface ArchitectureDocsProjectionManifestTargetV3 {
|
|
|
130
130
|
/** `digestJson({ targetId, body })` of the generated body: the region of a `mixed` target, the whole file of a `generated` one. */
|
|
131
131
|
outputDigest: string;
|
|
132
132
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
133
|
+
* The content digest of every declared source footprint this target documents, by node id. On an
|
|
134
|
+
* `entity-summary` row a footprint belongs to its node's nearest ancestor-or-self that has an
|
|
135
|
+
* entity-summary target, so it is stamped on exactly one such row. A runtime topology node's
|
|
136
|
+
* footprint (ADR-0049) is stamped on every runtime topology row instead, and those rows carry
|
|
137
|
+
* identical stamps. No other target type carries stamps.
|
|
136
138
|
*/
|
|
137
139
|
sourceStamps?: Record<string, string>;
|
|
138
140
|
/** Present exactly when `sourceStamps` stamps the target's own node: the scale buckets its document prints (#264). */
|
|
@@ -181,6 +183,11 @@ const TARGET_TYPES: Record<ProjectionTargetType, true> = {
|
|
|
181
183
|
"runtime-topology-summary": true,
|
|
182
184
|
"agent-context": true
|
|
183
185
|
};
|
|
186
|
+
/** The whole-model targets that render the runtime topology and carry its nodes' stamps (ADR-0049). */
|
|
187
|
+
export const RUNTIME_TOPOLOGY_TARGET_TYPES = ["diagram-runtime-topology", "runtime-topology-summary"] as const satisfies readonly ProjectionTargetType[];
|
|
188
|
+
export function isRuntimeTopologyTargetType(type: unknown): type is (typeof RUNTIME_TOPOLOGY_TARGET_TYPES)[number] {
|
|
189
|
+
return typeof type === "string" && (RUNTIME_TOPOLOGY_TARGET_TYPES as readonly string[]).includes(type);
|
|
190
|
+
}
|
|
184
191
|
const SCOPE_KINDS: Record<ProjectionTargetScopeKind, true> = { repository: true, entity: true, relation: true, decision: true, diagram: true, changelog: true };
|
|
185
192
|
const OWNERSHIPS: Record<ProjectionTargetOwnership, true> = { generated: true, mixed: true };
|
|
186
193
|
const FORMATS: Record<ProjectionTargetFormat, true> = { markdown: true, mermaid: true, "structurizr-json": true, likec4: true };
|
|
@@ -213,6 +220,7 @@ export function architectureDocsProjectionManifestIssues(value: unknown): string
|
|
|
213
220
|
}
|
|
214
221
|
const paths = new Set<string>();
|
|
215
222
|
const stampOwners = new Map<string, string>();
|
|
223
|
+
let topologyStamps: { targetId: string; stamps: string } | undefined;
|
|
216
224
|
for (const [targetId, row] of Object.entries(targets)) {
|
|
217
225
|
const prefix = `manifest.targets[${JSON.stringify(targetId)}]`;
|
|
218
226
|
if (!isNonEmptyString(targetId)) issues.push("manifest.targets keys must be non-empty targetIds");
|
|
@@ -222,7 +230,20 @@ export function architectureDocsProjectionManifestIssues(value: unknown): string
|
|
|
222
230
|
if (paths.has(path)) issues.push(`${prefix}.path is recorded by another target`);
|
|
223
231
|
paths.add(path);
|
|
224
232
|
}
|
|
225
|
-
|
|
233
|
+
const stamps = record(record(row)?.sourceStamps) ?? {};
|
|
234
|
+
if (isRuntimeTopologyTargetType(record(row)?.type)) {
|
|
235
|
+
// Every topology row renders the same topology, so all of them carry one stamp set.
|
|
236
|
+
const serialized = JSON.stringify(Object.keys(stamps).sort(compareStrings).map((nodeId) => [nodeId, stamps[nodeId]]));
|
|
237
|
+
if (topologyStamps === undefined) topologyStamps = { targetId, stamps: serialized };
|
|
238
|
+
else if (topologyStamps.stamps !== serialized) issues.push(`${prefix}.sourceStamps must equal the sourceStamps of ${topologyStamps.targetId}`);
|
|
239
|
+
for (const nodeId of Object.keys(stamps)) {
|
|
240
|
+
const owner = stampOwners.get(nodeId);
|
|
241
|
+
if (owner !== undefined && !isRuntimeTopologyTargetType(record(targets[owner])?.type)) issues.push(`${prefix}.sourceStamps.${nodeId} is already stamped on ${owner}`);
|
|
242
|
+
else if (owner === undefined) stampOwners.set(nodeId, targetId);
|
|
243
|
+
}
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
for (const nodeId of Object.keys(stamps)) {
|
|
226
247
|
const owner = stampOwners.get(nodeId);
|
|
227
248
|
if (owner !== undefined) issues.push(`${prefix}.sourceStamps.${nodeId} is already stamped on ${owner}`);
|
|
228
249
|
else stampOwners.set(nodeId, targetId);
|
|
@@ -319,7 +340,10 @@ export function architectureSemanticStateFromCapabilities(capabilities: readonly
|
|
|
319
340
|
};
|
|
320
341
|
}
|
|
321
342
|
|
|
322
|
-
/**
|
|
343
|
+
/**
|
|
344
|
+
* Every stamp the rows record, by node id. A valid manifest stamps each node on one entity-summary
|
|
345
|
+
* row, or with one digest on every runtime topology row.
|
|
346
|
+
*/
|
|
323
347
|
export function architectureDocsProjectionManifestSourceStamps(manifest: ArchitectureDocsProjectionManifestV3): Record<string, string> {
|
|
324
348
|
const stamps: Record<string, string> = {};
|
|
325
349
|
for (const row of Object.values(manifest.targets)) Object.assign(stamps, row.sourceStamps ?? {});
|
|
@@ -502,9 +526,10 @@ function manifestTargetIssues(value: unknown, prefix: string): string[] {
|
|
|
502
526
|
if (typeof target.ownership !== "string" || !Object.hasOwn(OWNERSHIPS, target.ownership)) issues.push(`${prefix}.ownership is unsupported`);
|
|
503
527
|
if (typeof target.format !== "string" || !Object.hasOwn(FORMATS, target.format)) issues.push(`${prefix}.format is unsupported`);
|
|
504
528
|
if (!isDigest(target.outputDigest)) issues.push(`${prefix}.outputDigest must be a SHA-256 digest`);
|
|
505
|
-
if (
|
|
506
|
-
issues.push(`${prefix}.sourceStamps
|
|
529
|
+
if (target.sourceStamps !== undefined && target.type !== "entity-summary" && !isRuntimeTopologyTargetType(target.type)) {
|
|
530
|
+
issues.push(`${prefix}.sourceStamps are only allowed on entity-summary and runtime topology targets`);
|
|
507
531
|
}
|
|
532
|
+
if (target.scale !== undefined && target.type !== "entity-summary") issues.push(`${prefix}.scale is only allowed on entity-summary targets`);
|
|
508
533
|
if (target.sourceStamps !== undefined) {
|
|
509
534
|
const stamps = record(target.sourceStamps);
|
|
510
535
|
if (!stamps || Object.keys(stamps).length === 0) issues.push(`${prefix}.sourceStamps must be a non-empty object keyed by node id`);
|
package/src/projection-writer.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProjectionHumanActionReasonCode } from "./projection";
|
|
2
|
+
import type { Json } from "./schema";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Projection writer mode (issue #379, ADR-0048): `archctx projection publish` keeps one rolling
|
|
@@ -64,7 +65,7 @@ export interface ProjectionPublishRunV1 {
|
|
|
64
65
|
/** `ProjectionResultV2.status` of the apply this run made, or null without one. */
|
|
65
66
|
projectionStatus: string | null;
|
|
66
67
|
humanActions: ProjectionPublishHumanActionV1[];
|
|
67
|
-
error: { code: string; reasonCode?: string; message: string } | null;
|
|
68
|
+
error: { code: string; reasonCode?: string; message: string; severity?: "notice" | "warning" | "error" | "critical"; retryable?: boolean; action?: string; details?: { [key: string]: Json } } | null;
|
|
68
69
|
startedAt: string;
|
|
69
70
|
finishedAt: string;
|
|
70
71
|
/** Base tips evaluated in this run; above 1 when the base moved while the run worked. */
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NativeContextSnapshot } from "./native-context";
|
|
2
|
+
export const REF_IMPACT_SCHEMA_VERSION = "archcontext.ref-impact/v1" as const;
|
|
3
|
+
export const REF_IMPACT_LIMITS = Object.freeze({ changedPaths: 1000, nodes: 1000, relations: 5000, flowSteps: 2000, dependents: 5000, modelChanges: 5000, depth: 10, diffLines: 100_000, diffWork: 2_000_000, diffBytes: 8 * 1024 * 1024, responseBytes: 8 * 1024 * 1024, codeFactFiles: 10_000, codeFactBytes: 8 * 1024 * 1024 });
|
|
4
|
+
export interface RefImpactModelChange { kind: string; id: string; change: "added" | "removed" | "changed"; fields: string[] }
|
|
5
|
+
/** Items also identify uncertain steps via selector-evidence-unavailable; inspect reasons before claiming a touch. */
|
|
6
|
+
export interface RefImpactFlowStep { flowId: string; stepId: string; outcomeId: string | null; reasonCodes: string[] }
|
|
7
|
+
/** No timestamps, workspace paths, source bodies or live session state. */
|
|
8
|
+
export interface RefImpactV1 {
|
|
9
|
+
schemaVersion: typeof REF_IMPACT_SCHEMA_VERSION;
|
|
10
|
+
base: NativeContextSnapshot | null;
|
|
11
|
+
head: NativeContextSnapshot;
|
|
12
|
+
depth: number;
|
|
13
|
+
changedPaths: Array<{ path: string; added: number | null; deleted: number | null; baseOwners: string[]; headOwners: string[]; owners: string[]; reasonCodes: string[] }>;
|
|
14
|
+
unownedPaths: string[];
|
|
15
|
+
touchedNodes: Array<{ nodeId: string; pathCount: number }>;
|
|
16
|
+
touchedFlowSteps: { status: "known" | "unknown"; reasonCodes: string[]; items: RefImpactFlowStep[] | null };
|
|
17
|
+
dependents: Array<{ nodeId: string; touchedNodeId: string; relationIds: string[] }>;
|
|
18
|
+
dependencyCoverage: { status: "complete" | "partial"; graph: "head"; pathSelection: "one-shortest-path-per-node-pair" };
|
|
19
|
+
modelDelta: { status: "known"; changes: RefImpactModelChange[]; truncated: boolean } | { status: "unknown"; reasonCode: "paths-only"; changes: null; truncated: false };
|
|
20
|
+
limits: typeof REF_IMPACT_LIMITS;
|
|
21
|
+
truncated: { changedPaths: boolean; touchedNodes: boolean; relations: boolean; flowSteps: boolean; dependents: boolean; modelDelta: boolean };
|
|
22
|
+
}
|