@principal-ai/subsystems-core 0.38.0 → 0.40.0
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/dist/types/subsystem-model.d.ts +18 -5
- package/dist/types/subsystem-model.d.ts.map +1 -1
- package/dist/types/subsystem-model.js +4 -0
- package/dist/types/subsystem-model.js.map +1 -1
- package/package.json +1 -1
- package/schemas/subsystem-model.schema.json +15 -20
- package/src/types/subsystem-model.test.ts +54 -0
- package/src/types/subsystem-model.ts +21 -6
- package/src/validation.test.ts +2 -2
|
@@ -47,7 +47,7 @@ export type SubsystemStereotype = string;
|
|
|
47
47
|
* Topology relation type — structural / module / type claims between
|
|
48
48
|
* components. Belongs on `relations[]`, not on walkthrough hops.
|
|
49
49
|
*/
|
|
50
|
-
export type SubsystemRelationType = 'extends' | 'inherits' | 'implements' | 'mixes_in' | 'method'
|
|
50
|
+
export type SubsystemRelationType = 'extends' | 'inherits' | 'implements' | 'mixes_in' | 'method';
|
|
51
51
|
/**
|
|
52
52
|
* Walkthrough hop mechanism — runtime seams with a `file:line` site.
|
|
53
53
|
* Belongs on walkthrough steps; graph edges for these are derived.
|
|
@@ -73,10 +73,6 @@ export interface SubsystemDeclarationRef {
|
|
|
73
73
|
lineHash: string;
|
|
74
74
|
graphifyNodeId?: string;
|
|
75
75
|
capturedAt: string;
|
|
76
|
-
revision?: {
|
|
77
|
-
headSha: string;
|
|
78
|
-
dirtyHash?: string | null;
|
|
79
|
-
};
|
|
80
76
|
}
|
|
81
77
|
export interface SubsystemParamInfo {
|
|
82
78
|
name?: string;
|
|
@@ -329,6 +325,12 @@ export interface SubsystemWalkthrough {
|
|
|
329
325
|
* No host paths, provenance, document-level repo, store ids, or verification.
|
|
330
326
|
* Repo identity lives on each component's `purl`.
|
|
331
327
|
*/
|
|
328
|
+
/**
|
|
329
|
+
* A pinned commit for one referenced repo. Keyed by `purlRepoKey` (the purl
|
|
330
|
+
* with its fragment stripped). Commit-only — a dirty tree has no reproducible
|
|
331
|
+
* name and is never recorded as a coordinate.
|
|
332
|
+
*/
|
|
333
|
+
export type PurlCommit = string;
|
|
332
334
|
export interface SubsystemModelDocument {
|
|
333
335
|
/**
|
|
334
336
|
* Optional pointer to the JSON Schema that describes this file. Lets editors
|
|
@@ -342,6 +344,17 @@ export interface SubsystemModelDocument {
|
|
|
342
344
|
relations: SubsystemRelation[];
|
|
343
345
|
/** Runtime walkthroughs (ordered hops with sites). */
|
|
344
346
|
walkthroughs?: SubsystemWalkthrough[];
|
|
347
|
+
/**
|
|
348
|
+
* The commit each referenced repo was at when the model was created. The
|
|
349
|
+
* coordinate system for every `file:line` in the document: without it, a
|
|
350
|
+
* line pointer is ambiguous across commits. Immutable after create.
|
|
351
|
+
*/
|
|
352
|
+
createdAtCommits?: Record<string, PurlCommit>;
|
|
353
|
+
/**
|
|
354
|
+
* The commit each referenced repo was at when a full audit last passed
|
|
355
|
+
* against a clean referenced state. Absent until an audit earns it.
|
|
356
|
+
*/
|
|
357
|
+
verifiedAtCommits?: Record<string, PurlCommit>;
|
|
345
358
|
}
|
|
346
359
|
/**
|
|
347
360
|
* Hydrated model: portable document + store metadata.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subsystem-model.d.ts","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;0CAE0C;AAC1C,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,UAAU,GACV,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,MAAM,GACN,OAAO,GACP,UAAU,GACV,eAAe,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"subsystem-model.d.ts","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;0CAE0C;AAC1C,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,UAAU,GACV,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,MAAM,GACN,OAAO,GACP,UAAU,GACV,eAAe,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,SAAS,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GACT,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,CAAC;AAEb;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GACrC,OAAO,GACP,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,SAAS,GACT,gBAAgB,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,qBAAqB,GACrB,6BAA6B,CAAC;AAElC,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,MAAM,GACN,QAAQ,GACR,MAAM,GACN,aAAa,GACb,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE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CAChC,GAAG,EAAE,sBAAsB,GAC1B,sBAAsB,CAYxB;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,sBAAsB,GAChC,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE;IACpC,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACvC,GAAG,sBAAsB,EAAE,CA4B3B"}
|
|
@@ -53,6 +53,10 @@ function toPortableDocument(doc) {
|
|
|
53
53
|
out.description = doc.description;
|
|
54
54
|
if (doc.walkthroughs)
|
|
55
55
|
out.walkthroughs = doc.walkthroughs;
|
|
56
|
+
if (doc.createdAtCommits)
|
|
57
|
+
out.createdAtCommits = doc.createdAtCommits;
|
|
58
|
+
if (doc.verifiedAtCommits)
|
|
59
|
+
out.verifiedAtCommits = doc.verifiedAtCommits;
|
|
56
60
|
return out;
|
|
57
61
|
}
|
|
58
62
|
exports.toPortableDocument = toPortableDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subsystem-model.js","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;
|
|
1
|
+
{"version":3,"file":"subsystem-model.js","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA6aH;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,KAAc;IACrD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAIT,CAAC;IACF,OAAO,CACL,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,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C,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YACjB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;gBACX,EAAE;gBACF,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,SAAS,EAAE,CAAC,CAAC,YAAY;gBACzB,IAAI,EAAE,CAAC,CAAC,IAAI;aACb,CAAC,CAAC;SACJ;KACF;IACD,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,YAAY,IAAI,EAAE,EAAE;QACtC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE;YAC1B,MAAM,EAAE,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAClE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;gBACjB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;oBACX,EAAE;oBACF,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,SAAS,EAAE,IAAI,CAAC,SAAS;iBAC1B,CAAC,CAAC;aACJ;SACF;KACF;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5B,CAAC;AA/BD,4CA+BC"}
|
package/package.json
CHANGED
|
@@ -44,6 +44,20 @@
|
|
|
44
44
|
"items": {
|
|
45
45
|
"$ref": "#/$defs/walkthrough"
|
|
46
46
|
}
|
|
47
|
+
},
|
|
48
|
+
"createdAtCommits": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "The commit each referenced repo was at when the model was created — the coordinate system for every file:line. Keyed by purl repo key (purl with fragment stripped), value a commit sha. Immutable after create.",
|
|
51
|
+
"additionalProperties": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"verifiedAtCommits": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"description": "The commit each referenced repo was at when a full audit last passed against a clean referenced state. Same keying as createdAtCommits. Absent until an audit earns it.",
|
|
58
|
+
"additionalProperties": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
62
|
},
|
|
49
63
|
"$defs": {
|
|
@@ -100,8 +114,7 @@
|
|
|
100
114
|
"inherits",
|
|
101
115
|
"implements",
|
|
102
116
|
"mixes_in",
|
|
103
|
-
"method"
|
|
104
|
-
"references"
|
|
117
|
+
"method"
|
|
105
118
|
]
|
|
106
119
|
},
|
|
107
120
|
"mechanism": {
|
|
@@ -389,24 +402,6 @@
|
|
|
389
402
|
"capturedAt": {
|
|
390
403
|
"type": "string",
|
|
391
404
|
"description": "ISO timestamp when this ref was recorded."
|
|
392
|
-
},
|
|
393
|
-
"revision": {
|
|
394
|
-
"type": "object",
|
|
395
|
-
"required": [
|
|
396
|
-
"headSha"
|
|
397
|
-
],
|
|
398
|
-
"additionalProperties": false,
|
|
399
|
-
"properties": {
|
|
400
|
-
"headSha": {
|
|
401
|
-
"type": "string"
|
|
402
|
-
},
|
|
403
|
-
"dirtyHash": {
|
|
404
|
-
"type": [
|
|
405
|
-
"string",
|
|
406
|
-
"null"
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
405
|
}
|
|
411
406
|
}
|
|
412
407
|
},
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { toPortableDocument } from "./subsystem-model";
|
|
5
|
+
|
|
6
|
+
const schema = JSON.parse(
|
|
7
|
+
readFileSync(
|
|
8
|
+
resolve(import.meta.dir, "../../schemas/subsystem-model.schema.json"),
|
|
9
|
+
"utf8",
|
|
10
|
+
),
|
|
11
|
+
) as {
|
|
12
|
+
properties: Record<string, unknown>;
|
|
13
|
+
$defs: Record<string, { properties?: Record<string, unknown> }>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
describe("toPortableDocument", () => {
|
|
17
|
+
test("keeps per-purl commit provenance (the coordinate for file:line)", () => {
|
|
18
|
+
const portable = toPortableDocument({
|
|
19
|
+
title: "t",
|
|
20
|
+
components: [],
|
|
21
|
+
relations: [],
|
|
22
|
+
createdAtCommits: { "pkg:github/a/b": "abc" },
|
|
23
|
+
verifiedAtCommits: { "pkg:github/a/b": "def" },
|
|
24
|
+
} as unknown as Parameters<typeof toPortableDocument>[0]);
|
|
25
|
+
expect(portable.createdAtCommits).toEqual({ "pkg:github/a/b": "abc" });
|
|
26
|
+
expect(portable.verifiedAtCommits).toEqual({ "pkg:github/a/b": "def" });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test("still drops store metadata", () => {
|
|
30
|
+
const portable = toPortableDocument({
|
|
31
|
+
title: "t",
|
|
32
|
+
components: [],
|
|
33
|
+
relations: [],
|
|
34
|
+
id: "sg-1",
|
|
35
|
+
createdAt: "now",
|
|
36
|
+
verification: {},
|
|
37
|
+
lastOpenedAt: "now",
|
|
38
|
+
} as unknown as Parameters<typeof toPortableDocument>[0]);
|
|
39
|
+
expect("id" in portable).toBe(false);
|
|
40
|
+
expect("verification" in portable).toBe(false);
|
|
41
|
+
expect("lastOpenedAt" in portable).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("subsystem-model schema", () => {
|
|
46
|
+
test("declares the per-purl commit maps", () => {
|
|
47
|
+
expect(schema.properties.createdAtCommits).toBeDefined();
|
|
48
|
+
expect(schema.properties.verifiedAtCommits).toBeDefined();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("no longer carries per-declaration revision (superseded by the model-level pin)", () => {
|
|
52
|
+
expect(schema.$defs.declarationRef?.properties?.revision).toBeUndefined();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -67,8 +67,7 @@ export type SubsystemRelationType =
|
|
|
67
67
|
| 'inherits'
|
|
68
68
|
| 'implements'
|
|
69
69
|
| 'mixes_in'
|
|
70
|
-
| 'method'
|
|
71
|
-
| 'references';
|
|
70
|
+
| 'method';
|
|
72
71
|
|
|
73
72
|
/**
|
|
74
73
|
* Walkthrough hop mechanism — runtime seams with a `file:line` site.
|
|
@@ -117,10 +116,6 @@ export interface SubsystemDeclarationRef {
|
|
|
117
116
|
lineHash: string;
|
|
118
117
|
graphifyNodeId?: string;
|
|
119
118
|
capturedAt: string;
|
|
120
|
-
revision?: {
|
|
121
|
-
headSha: string;
|
|
122
|
-
dirtyHash?: string | null;
|
|
123
|
-
};
|
|
124
119
|
}
|
|
125
120
|
|
|
126
121
|
export interface SubsystemParamInfo {
|
|
@@ -403,6 +398,13 @@ export interface SubsystemWalkthrough {
|
|
|
403
398
|
* No host paths, provenance, document-level repo, store ids, or verification.
|
|
404
399
|
* Repo identity lives on each component's `purl`.
|
|
405
400
|
*/
|
|
401
|
+
/**
|
|
402
|
+
* A pinned commit for one referenced repo. Keyed by `purlRepoKey` (the purl
|
|
403
|
+
* with its fragment stripped). Commit-only — a dirty tree has no reproducible
|
|
404
|
+
* name and is never recorded as a coordinate.
|
|
405
|
+
*/
|
|
406
|
+
export type PurlCommit = string;
|
|
407
|
+
|
|
406
408
|
export interface SubsystemModelDocument {
|
|
407
409
|
/**
|
|
408
410
|
* Optional pointer to the JSON Schema that describes this file. Lets editors
|
|
@@ -417,6 +419,17 @@ export interface SubsystemModelDocument {
|
|
|
417
419
|
relations: SubsystemRelation[];
|
|
418
420
|
/** Runtime walkthroughs (ordered hops with sites). */
|
|
419
421
|
walkthroughs?: SubsystemWalkthrough[];
|
|
422
|
+
/**
|
|
423
|
+
* The commit each referenced repo was at when the model was created. The
|
|
424
|
+
* coordinate system for every `file:line` in the document: without it, a
|
|
425
|
+
* line pointer is ambiguous across commits. Immutable after create.
|
|
426
|
+
*/
|
|
427
|
+
createdAtCommits?: Record<string, PurlCommit>;
|
|
428
|
+
/**
|
|
429
|
+
* The commit each referenced repo was at when a full audit last passed
|
|
430
|
+
* against a clean referenced state. Absent until an audit earns it.
|
|
431
|
+
*/
|
|
432
|
+
verifiedAtCommits?: Record<string, PurlCommit>;
|
|
420
433
|
}
|
|
421
434
|
|
|
422
435
|
/**
|
|
@@ -469,6 +482,8 @@ export function toPortableDocument(
|
|
|
469
482
|
if (doc.$schema) out.$schema = doc.$schema;
|
|
470
483
|
if (doc.description) out.description = doc.description;
|
|
471
484
|
if (doc.walkthroughs) out.walkthroughs = doc.walkthroughs;
|
|
485
|
+
if (doc.createdAtCommits) out.createdAtCommits = doc.createdAtCommits;
|
|
486
|
+
if (doc.verifiedAtCommits) out.verifiedAtCommits = doc.verifiedAtCommits;
|
|
472
487
|
return out;
|
|
473
488
|
}
|
|
474
489
|
|
package/src/validation.test.ts
CHANGED
|
@@ -29,7 +29,7 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
29
29
|
test('accepts a consistent document', () => {
|
|
30
30
|
const d = doc({
|
|
31
31
|
components: [comp('a'), comp('b')],
|
|
32
|
-
relations: [{ id: 'r1', from: 'a', to: 'b', relationType: '
|
|
32
|
+
relations: [{ id: 'r1', from: 'a', to: 'b', relationType: 'method' }],
|
|
33
33
|
walkthroughs: [
|
|
34
34
|
{
|
|
35
35
|
id: 'w1',
|
|
@@ -53,7 +53,7 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
53
53
|
const problems = validateSubsystemModelCrossField(
|
|
54
54
|
doc({
|
|
55
55
|
components: [comp('a')],
|
|
56
|
-
relations: [{ id: 'r1', from: 'a', to: 'ghost', relationType: '
|
|
56
|
+
relations: [{ id: 'r1', from: 'a', to: 'ghost', relationType: 'method' }],
|
|
57
57
|
}),
|
|
58
58
|
);
|
|
59
59
|
expect(problems).toHaveLength(1);
|