@principal-ai/subsystems-core 0.49.1 → 0.50.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/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js.map +1 -1
- package/dist/storage/topic-types.d.ts +19 -0
- package/dist/storage/topic-types.d.ts.map +1 -1
- package/dist/storage/topic-types.js.map +1 -1
- package/dist/storage/topicStore.d.ts +1 -1
- package/dist/storage/topicStore.d.ts.map +1 -1
- package/dist/storage/topicStore.js +6 -31
- package/dist/storage/topicStore.js.map +1 -1
- package/dist/types/subsystem-model.d.ts +50 -24
- package/dist/types/subsystem-model.d.ts.map +1 -1
- package/dist/types/subsystem-model.js +1 -2
- package/dist/types/subsystem-model.js.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +43 -11
- package/dist/validation.js.map +1 -1
- package/package.json +1 -1
- package/schemas/subsystem-model.schema.json +69 -13
- package/src/node.ts +1 -0
- package/src/storage/topic-types.ts +20 -0
- package/src/storage/topicStore.test.ts +26 -5
- package/src/storage/topicStore.ts +10 -36
- package/src/types/subsystem-model.test.ts +5 -0
- package/src/types/subsystem-model.ts +52 -24
- package/src/validation.test.ts +65 -5
- package/src/validation.ts +57 -13
package/dist/node.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from './types';
|
|
|
10
10
|
export { TopicStore, PRINCIPAL_DIR, TOPICS_DIR, LEGACY_TOPICS_BLOB, } from './storage/topicStore';
|
|
11
11
|
export type { TopicIndexEntry, TopicCreate, TopicUpdate, MigrationResult, } from './storage/topicStore';
|
|
12
12
|
export { publishedFromDraft } from './storage/topic-types';
|
|
13
|
-
export type { DraftTopic, PublishedTopic, PublishProjection, TopicStatus, TopicAsset, TopicCreator, } from './storage/topic-types';
|
|
13
|
+
export type { DraftTopic, PublishedTopic, PublishProjection, TopicStatus, TopicAsset, TopicCreator, TopicSubsystemModelRef, } from './storage/topic-types';
|
|
14
14
|
export { OpenCodeEventStore, defaultOpenCodeDBPath } from './opencode/OpenCodeEventStore';
|
|
15
15
|
export type { OpenCodeRawEvent, OpenCodeSessionEvents, OpenCodeEventRetriever, OpenCodeStoreOptions, SessionSummary, SessionListResult, } from './opencode/types';
|
|
16
16
|
export { listAgentSessions, detectAgent, fetchRawEvents } from './opencode/agent-sessions';
|
package/dist/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,UAAU,EACV,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC1F,YAAY,EACV,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3F,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,4BAA4B,EAC5B,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AAExB,4DAA4D;AAC5D,mDAK8B;AAJ5B,wGAAA,UAAU,OAAA;AACV,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,gHAAA,kBAAkB,OAAA;AAQpB,qDAA2D;AAAlD,iHAAA,kBAAkB,OAAA;
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AAExB,4DAA4D;AAC5D,mDAK8B;AAJ5B,wGAAA,UAAU,OAAA;AACV,2GAAA,aAAa,OAAA;AACb,wGAAA,UAAU,OAAA;AACV,gHAAA,kBAAkB,OAAA;AAQpB,qDAA2D;AAAlD,iHAAA,kBAAkB,OAAA;AAW3B,mDAAmD;AACnD,oEAA0F;AAAjF,wHAAA,kBAAkB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAUlD,iEAAiE;AACjE,4DAA2F;AAAlF,mHAAA,iBAAiB,OAAA;AAAE,6GAAA,WAAW,OAAA;AAAE,gHAAA,cAAc,OAAA;AAOvD,mDAAmD;AACnD,oDAAoE;AAA3D,mHAAA,wBAAwB,OAAA;AAWjC,sEAAsE;AACtE,gDAO6B;AAN3B,wHAAA,4BAA4B,OAAA;AAC5B,2GAAA,eAAe,OAAA;AACf,sHAAA,0BAA0B,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAChB,+GAAA,mBAAmB,OAAA;AACnB,yHAAA,6BAA6B,OAAA"}
|
|
@@ -92,6 +92,20 @@ export interface TopicCreator {
|
|
|
92
92
|
githubId: number;
|
|
93
93
|
githubLogin: string;
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* A topic's reference to a subsystem model it concerns, optionally narrowed to
|
|
97
|
+
* specific runtime trails (flows) within that model.
|
|
98
|
+
*
|
|
99
|
+
* The link lives on the **topic** side, in the local store id namespace, and
|
|
100
|
+
* never on the model: a subsystem-model document is a portable, host-free
|
|
101
|
+
* artifact (shared/published) that must not embed local topic or store ids.
|
|
102
|
+
*/
|
|
103
|
+
export interface TopicSubsystemModelRef {
|
|
104
|
+
/** Store-assigned model id, e.g. "sg-1781...". */
|
|
105
|
+
modelId: string;
|
|
106
|
+
/** Specific runtime trails (flows) within the model, if narrower than the whole. */
|
|
107
|
+
trailIds?: string[];
|
|
108
|
+
}
|
|
95
109
|
/**
|
|
96
110
|
* Locally-authored topic — the shape desktop persists to
|
|
97
111
|
* `~/.principal/topics/<id>.json` and edits.
|
|
@@ -130,6 +144,11 @@ export interface DraftTopic {
|
|
|
130
144
|
status?: TopicStatus;
|
|
131
145
|
/** Local image attachments, referenced from the description via `asset://<id>`. */
|
|
132
146
|
assets?: TopicAsset[];
|
|
147
|
+
/**
|
|
148
|
+
* Subsystem models this topic concerns, as local store ids. Local-only: not
|
|
149
|
+
* carried on publish, since the referenced models are a local artifact.
|
|
150
|
+
*/
|
|
151
|
+
subsystemModels?: TopicSubsystemModelRef[];
|
|
133
152
|
}
|
|
134
153
|
/**
|
|
135
154
|
* Server-authoritative topic — the shape the server returns and mobile reads.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic-types.d.ts","sourceRoot":"","sources":["../../src/storage/topic-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,KAAK,EACH,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,CAAC;IACjG,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,SAAS,CAAC,EAAE;QACV,gEAAgE;QAChE,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,oDAAoD;QACpD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,wEAAwE;QACxE,GAAG,CAAC,EAAE;YACJ,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC;YACvC,8CAA8C;YAC9C,KAAK,EAAE,MAAM,CAAC;YACd,wCAAwC;YACxC,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;KACH,CAAC;CACH;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,GAAG,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ACtE,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB;;;OAGG;IACH,eAAe,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,SAAS,EAAE,YAAY,CAAC;IACxB,uEAAuE;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8DAA8D;IAC9D,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;CAClC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,YAAY,CAAC;IACxB,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;CAClC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,iBAAiB,GAC5B,cAAc,CAgBhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic-types.js","sourceRoot":"","sources":["../../src/storage/topic-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;
|
|
1
|
+
{"version":3,"file":"topic-types.js","sourceRoot":"","sources":["../../src/storage/topic-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAuLH;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB,CAChC,KAAiB,EACjB,UAA6B;IAE7B,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,CAAC,EAAE,4DAA4D,CAAC,CAAC;KAChG;IACD,OAAO;QACL,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW;QACX,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/D,UAAU,EAAE,UAAU,CAAC,UAAU;KAClC,CAAC;AACJ,CAAC;AAnBD,gDAmBC"}
|
|
@@ -66,7 +66,7 @@ export interface MigrationResult {
|
|
|
66
66
|
* Fields a caller may set when updating a topic. `id` and `createdAt` are set
|
|
67
67
|
* once at creation and cannot be changed by an update.
|
|
68
68
|
*/
|
|
69
|
-
export type TopicUpdate = Partial<Pick<DraftTopic, 'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos'>>;
|
|
69
|
+
export type TopicUpdate = Partial<Pick<DraftTopic, 'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos' | 'subsystemModels'>>;
|
|
70
70
|
/**
|
|
71
71
|
* Fields a caller may set when creating a topic. `id`, `createdAt`,
|
|
72
72
|
* `updatedAt` are filled in when omitted; passing `id` lets a caller control
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topicStore.d.ts","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7D,gEAAgE;AAChE,eAAO,MAAM,aAAa,QAAgC,CAAC;AAC3D,gCAAgC;AAChC,eAAO,MAAM,UAAU,QAAgC,CAAC;AACxD,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,QAAgD,CAAC;AAKhF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"topicStore.d.ts","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7D,gEAAgE;AAChE,eAAO,MAAM,aAAa,QAAgC,CAAC;AAC3D,gCAAgC;AAChC,eAAO,MAAM,UAAU,QAAgC,CAAC;AACxD,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,QAAgD,CAAC;AAKhF;;;;GAI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AAc,CAAS;IACxC,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,UAAU,CAAoC;IAEtD;;;;OAIG;gBACS,OAAO,GAAE,MAAmB,EAAE,cAAc,GAAE,MAA2B;IAQrF;;;;;;;;;OASG;IACG,SAAS,CAAC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAUrE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAOtD;;;;;OAKG;IACG,IAAI,CAAC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAKrE,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAkBpD,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAclE,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAa/C;;;;;;;;;;OAUG;IACG,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC;YAmEzC,QAAQ;YAQR,YAAY;IAQ1B,4EAA4E;YAC9D,UAAU;YAaV,SAAS;YAUT,cAAc;YAWd,UAAU;YASV,SAAS;IAkBvB,2EAA2E;YAC7D,YAAY;IA2B1B,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -50,11 +50,6 @@ const descriptionPreview = (description) => {
|
|
|
50
50
|
return trimmed;
|
|
51
51
|
return `${trimmed.slice(0, DESCRIPTION_PREVIEW_MAX - 1)}…`;
|
|
52
52
|
};
|
|
53
|
-
/** Strip the removed topic-to-trail field from data written by older versions. */
|
|
54
|
-
const withoutLegacyTrailIds = (topic) => {
|
|
55
|
-
const { trailIds: _trailIds, ...canonical } = topic;
|
|
56
|
-
return canonical;
|
|
57
|
-
};
|
|
58
53
|
const buildEntry = (topic, sizeBytes) => ({
|
|
59
54
|
id: topic.id,
|
|
60
55
|
title: topic.title || 'Untitled topic',
|
|
@@ -252,14 +247,13 @@ class TopicStore {
|
|
|
252
247
|
}
|
|
253
248
|
/** Write a topic file and upsert its index entry. Does not generate ids. */
|
|
254
249
|
async writeTopic(topic, idx) {
|
|
255
|
-
const
|
|
256
|
-
const fileName = `${sanitizeSegment(canonicalTopic.id)}.json`;
|
|
250
|
+
const fileName = `${sanitizeSegment(topic.id)}.json`;
|
|
257
251
|
const file = (0, node_path_1.join)(this.baseDir, fileName);
|
|
258
252
|
await (0, promises_1.mkdir)((0, node_path_1.dirname)(file), { recursive: true });
|
|
259
|
-
const serialized = JSON.stringify(
|
|
253
|
+
const serialized = JSON.stringify(topic, null, 2);
|
|
260
254
|
await (0, promises_1.writeFile)(file, serialized, 'utf8');
|
|
261
|
-
const entry = buildEntry(
|
|
262
|
-
const at = idx.entries.findIndex((e) => e.id ===
|
|
255
|
+
const entry = buildEntry(topic, Buffer.byteLength(serialized, 'utf8'));
|
|
256
|
+
const at = idx.entries.findIndex((e) => e.id === topic.id);
|
|
263
257
|
if (at >= 0)
|
|
264
258
|
idx.entries[at] = entry;
|
|
265
259
|
else
|
|
@@ -269,17 +263,7 @@ class TopicStore {
|
|
|
269
263
|
async readTopic(fileName) {
|
|
270
264
|
try {
|
|
271
265
|
const raw = await (0, promises_1.readFile)((0, node_path_1.join)(this.baseDir, fileName), 'utf8');
|
|
272
|
-
|
|
273
|
-
const topic = withoutLegacyTrailIds(parsed);
|
|
274
|
-
if ('trailIds' in parsed) {
|
|
275
|
-
try {
|
|
276
|
-
await (0, promises_1.writeFile)((0, node_path_1.join)(this.baseDir, fileName), JSON.stringify(topic, null, 2), 'utf8');
|
|
277
|
-
}
|
|
278
|
-
catch (err) {
|
|
279
|
-
console.warn('[TopicStore] Failed to remove legacy trailIds from', fileName, err);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
return topic;
|
|
266
|
+
return JSON.parse(raw);
|
|
283
267
|
}
|
|
284
268
|
catch (err) {
|
|
285
269
|
console.error('[TopicStore] Failed to read topic', fileName, err);
|
|
@@ -311,16 +295,7 @@ class TopicStore {
|
|
|
311
295
|
const raw = await (0, promises_1.readFile)(this.indexPath, 'utf8');
|
|
312
296
|
const parsed = JSON.parse(raw);
|
|
313
297
|
if (parsed?.version === 1 && Array.isArray(parsed.entries)) {
|
|
314
|
-
|
|
315
|
-
const entries = parsed.entries.map((entry) => {
|
|
316
|
-
hadLegacyTrailCount || (hadLegacyTrailCount = Boolean(entry && typeof entry === 'object' && 'trailCount' in entry));
|
|
317
|
-
const { trailCount: _trailCount, ...canonical } = entry;
|
|
318
|
-
return canonical;
|
|
319
|
-
});
|
|
320
|
-
if (hadLegacyTrailCount) {
|
|
321
|
-
await (0, promises_1.writeFile)(this.indexPath, JSON.stringify({ version: 1, entries }, null, 2), 'utf8');
|
|
322
|
-
}
|
|
323
|
-
return { version: 1, entries };
|
|
298
|
+
return { version: 1, entries: parsed.entries };
|
|
324
299
|
}
|
|
325
300
|
}
|
|
326
301
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topicStore.js","sourceRoot":"","sources":["../../src/storage/topicStore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AAEH,qCAAkC;AAClC,yCAA0C;AAC1C,+CAA+F;AAG/F,gEAAgE;AACnD,QAAA,aAAa,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,YAAY,CAAC,CAAC;AAC3D,gCAAgC;AACnB,QAAA,UAAU,GAAG,IAAA,gBAAI,EAAC,qBAAa,EAAE,QAAQ,CAAC,CAAC;AACxD,wDAAwD;AAC3C,QAAA,kBAAkB,GAAG,IAAA,gBAAI,EAAC,IAAA,iBAAO,GAAE,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,cAAc,GAAG,a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AAE,CAAC,CAAC;YAC/C,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;QACL,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF;AA1SD,gCA0SC"}
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Ontology: construct = what a node is, framework + stereotype = which
|
|
15
15
|
* framework pattern it plays, role = where it sits, process = where it runs,
|
|
16
|
-
* module = which source file/module the export belongs to
|
|
17
|
-
* proposed = not yet in source (design / migration placeholder).
|
|
16
|
+
* module = which source file/module the export belongs to.
|
|
18
17
|
* Package (repo) frames are derived from component `purl` when a graph spans
|
|
19
18
|
* multiple repos — there is no separate `package` field.
|
|
20
19
|
* `symbol` is the code identity; `name` is the display label.
|
|
@@ -265,19 +264,10 @@ export interface SubsystemComponent {
|
|
|
265
264
|
logo?: string;
|
|
266
265
|
purpose?: string;
|
|
267
266
|
role?: SubsystemComponentRole;
|
|
268
|
-
/**
|
|
269
|
-
* Design / migration placeholder — participates in edges and flows but is
|
|
270
|
-
* not a live source declaration yet. Verification skips source checks until
|
|
271
|
-
* promoted (`proposed` cleared, `file` + `symbol` filled). Orthogonal to
|
|
272
|
-
* `construct` (intended shape) and `role` (topology).
|
|
273
|
-
*/
|
|
274
|
-
proposed?: boolean;
|
|
275
267
|
/**
|
|
276
268
|
* The claim was real but its source is gone — deleted or renamed upstream.
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
* `proposed`, so a model carrying deprecations is no longer wedged on
|
|
280
|
-
* unfixable `missing_file` findings.
|
|
269
|
+
* Verification skips source checks so a model carrying deprecations is no
|
|
270
|
+
* longer wedged on unfixable `missing_file` findings.
|
|
281
271
|
*
|
|
282
272
|
* This is a transitional marker, not a resting state. A cleanup pass removes
|
|
283
273
|
* the component and repairs the trails that referenced it; the field exists so
|
|
@@ -349,6 +339,35 @@ export interface SubsystemComponentEdge {
|
|
|
349
339
|
to: string;
|
|
350
340
|
mechanism: SubsystemEdgeMechanism;
|
|
351
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* The construct that contains a seam site. The site is always in the step's
|
|
344
|
+
* own file/repo (`step.file` / `step.purl`), so it carries only the construct
|
|
345
|
+
* identity and its full declaration range.
|
|
346
|
+
*/
|
|
347
|
+
export interface SubsystemSiteConstruct {
|
|
348
|
+
/** Caller construct symbol (e.g. `MaintenanceModelList`, `Registry.start`). */
|
|
349
|
+
symbol: string;
|
|
350
|
+
/** Full declaration range of the construct, not just the seam line. */
|
|
351
|
+
span: SubsystemSourceSpan;
|
|
352
|
+
/** Declaration shape, when known (function, method, class, …). */
|
|
353
|
+
construct?: SubsystemConstruct;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* The construct a seam reaches. Unlike `site`, the target can live in another
|
|
357
|
+
* repo, so it carries its own purl + file. `span` is the target declaration
|
|
358
|
+
* range when it resolves; it can be absent for externals or unresolved targets.
|
|
359
|
+
*/
|
|
360
|
+
export interface SubsystemTargetConstruct {
|
|
361
|
+
/** File-anchored purl of the target repo/file. */
|
|
362
|
+
purl: string;
|
|
363
|
+
file: string;
|
|
364
|
+
/** Callee construct symbol (e.g. `mergeProvenance`, `Store.add`). */
|
|
365
|
+
symbol: string;
|
|
366
|
+
/** Full declaration range of the target, when resolvable. */
|
|
367
|
+
span?: SubsystemSourceSpan;
|
|
368
|
+
/** Declaration shape, when known. */
|
|
369
|
+
construct?: SubsystemConstruct;
|
|
370
|
+
}
|
|
352
371
|
export interface SubsystemTrailStep {
|
|
353
372
|
/** Source component alias. */
|
|
354
373
|
from: string;
|
|
@@ -359,11 +378,26 @@ export interface SubsystemTrailStep {
|
|
|
359
378
|
file: string;
|
|
360
379
|
/**
|
|
361
380
|
* The step's source span — the call-site range and its content hash. The
|
|
362
|
-
* trail-step counterpart of a component's `declarationSpan`,
|
|
363
|
-
*
|
|
364
|
-
*
|
|
381
|
+
* trail-step counterpart of a component's `declarationSpan`, but
|
|
382
|
+
* **hand-authored**: nothing derives it (construct spans come from graphify
|
|
383
|
+
* + tree-sitter; step spans do not). `file` + `symbol` locate the frame; the
|
|
384
|
+
* span pins that frame's exact seam range. Absent means the seam is
|
|
385
|
+
* unverified and the Trails view has no line to highlight.
|
|
365
386
|
*/
|
|
366
387
|
span?: SubsystemSourceSpan;
|
|
388
|
+
/**
|
|
389
|
+
* The construct containing the seam site, with its full declaration range.
|
|
390
|
+
* Required when `mechanism` is `calls`: the caller frame must be housed by
|
|
391
|
+
* the `from` component. For `uses` and data/event seams it is the via-site
|
|
392
|
+
* evidence and remains optional.
|
|
393
|
+
*/
|
|
394
|
+
site?: SubsystemSiteConstruct;
|
|
395
|
+
/**
|
|
396
|
+
* The construct the seam reaches. Distinct from `to` (a component alias):
|
|
397
|
+
* the target can be a method on a modeled component, or a construct that is
|
|
398
|
+
* not a node at all. Optional; populated from accepted call-site evidence.
|
|
399
|
+
*/
|
|
400
|
+
target?: SubsystemTargetConstruct;
|
|
367
401
|
/**
|
|
368
402
|
* File-anchored purl of the seam site (e.g.
|
|
369
403
|
* `pkg:github/owner/name#path/to/file.ts`), mirroring component `purl`.
|
|
@@ -377,14 +411,6 @@ export interface SubsystemTrailStep {
|
|
|
377
411
|
* mechanism + filename fallback.
|
|
378
412
|
*/
|
|
379
413
|
symbol: string;
|
|
380
|
-
/**
|
|
381
|
-
* Planned seam — the step describes intended behavior through code that is
|
|
382
|
-
* not written yet. Orthogonal to (and redundant with) the endpoints' own
|
|
383
|
-
* `proposed` flags: a step is proposed when it says so OR either endpoint
|
|
384
|
-
* is proposed. Verification skips source checks either way, and viewers
|
|
385
|
-
* tint it exactly like a proposed node.
|
|
386
|
-
*/
|
|
387
|
-
proposed?: boolean;
|
|
388
414
|
/**
|
|
389
415
|
* Free-text note anchored to this step's site line. Optional — informative
|
|
390
416
|
* only, never verified against source; viewers surface it via the codeview's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subsystem-model.d.ts","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"subsystem-model.d.ts","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;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,uBAAuB,GAC/B,OAAO,GACP,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,SAAS,GACT,gBAAgB,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG,UAAU,GAAG,UAAU,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,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,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CAAC;IACnB,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAOxF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,sBAAsB,GAC1B,sBAAsB,CAWxB;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,sBAAsB,GAChC,MAAM,CAER;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE;IAAE,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAAE,GAC1D,oBAAoB,EAAE,CAcxB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE;IAAE,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAAE,GAC1D,oBAAoB,EAAE,CAcxB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE;IACpC,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC3B,GAAG,sBAAsB,EAAE,CAgB3B"}
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Ontology: construct = what a node is, framework + stereotype = which
|
|
16
16
|
* framework pattern it plays, role = where it sits, process = where it runs,
|
|
17
|
-
* module = which source file/module the export belongs to
|
|
18
|
-
* proposed = not yet in source (design / migration placeholder).
|
|
17
|
+
* module = which source file/module the export belongs to.
|
|
19
18
|
* Package (repo) frames are derived from component `purl` when a graph spans
|
|
20
19
|
* multiple repos — there is no separate `package` field.
|
|
21
20
|
* `symbol` is the code identity; `name` is the display label.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subsystem-model.js","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"subsystem-model.js","sourceRoot":"","sources":["../../src/types/subsystem-model.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AA6gBH;;;;GAIG;AACH,SAAgB,wBAAwB,CAAC,KAAc;IACrD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAGT,CAAC;IACF,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;AACpE,CAAC;AAPD,4DAOC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,GAA2B;IAE3B,MAAM,GAAG,GAA2B;QAClC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,UAAU,EAAE,GAAG,CAAC,UAAU;KAC3B,CAAC;IACF,IAAI,GAAG,CAAC,OAAO;QAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC3C,IAAI,GAAG,CAAC,WAAW;QAAE,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,WAAW,CAAC;IACvD,IAAI,GAAG,CAAC,MAAM;QAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACxC,IAAI,GAAG,CAAC,gBAAgB;QAAE,GAAG,CAAC,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAC;IACtE,IAAI,GAAG,CAAC,iBAAiB;QAAE,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC;IACzE,OAAO,GAA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C;AAEjC,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,sBAAsB,EAIvB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAgDD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,sBAAsB,GAC1B,0BAA0B,EAAE,CAyI9B"}
|
package/dist/validation.js
CHANGED
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.validateSubsystemModelCrossField = void 0;
|
|
16
16
|
function isUngrounded(c) {
|
|
17
|
-
// Deprecated components are exempt
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
return
|
|
21
|
-
c.proposed === true ||
|
|
22
|
-
c.deprecated === true);
|
|
17
|
+
// Deprecated components are exempt: the file is a historical pointer to
|
|
18
|
+
// source that is gone, so it cannot resolve and its absence is not an
|
|
19
|
+
// inconsistency.
|
|
20
|
+
return c.construct === 'external' || c.deprecated === true;
|
|
23
21
|
}
|
|
24
22
|
/**
|
|
25
23
|
* `file` is a path *inside the repo named by `purl`* — it resolves against that
|
|
@@ -30,8 +28,7 @@ function isUngrounded(c) {
|
|
|
30
28
|
* Such a component is a third-party dependency: model it as `construct:
|
|
31
29
|
* 'external'` with `purl: 'pkg:npm/<package>'` and no file. Applies to externals
|
|
32
30
|
* too — they carry no file by design, so an install path there is dead weight
|
|
33
|
-
* that draws a link nothing can open.
|
|
34
|
-
* grounding rule: its file is a placeholder for something not placed yet.
|
|
31
|
+
* that draws a link nothing can open.
|
|
35
32
|
*
|
|
36
33
|
* The same rule covers trail step files — a seam into an external belongs
|
|
37
34
|
* at the call site in the caller, which *is* in the repo.
|
|
@@ -78,17 +75,16 @@ function validateSubsystemModelCrossField(doc) {
|
|
|
78
75
|
ids.add(c.alias);
|
|
79
76
|
}
|
|
80
77
|
// A grounded component that claims a `module` needs a `file` to ground the
|
|
81
|
-
// frame. Externals
|
|
78
|
+
// frame. Externals carry no file by design.
|
|
82
79
|
const module = typeof c.module === 'string' ? c.module.trim() : '';
|
|
83
80
|
const file = typeof c.file === 'string' ? c.file.trim() : '';
|
|
84
81
|
if (module && !file && !isUngrounded(c)) {
|
|
85
82
|
problems.push({
|
|
86
83
|
path: `/components/${i}/module`,
|
|
87
|
-
message: `component ${JSON.stringify(c.alias)}: module ${JSON.stringify(module)} is set but file is empty — a module frame needs a file to ground it
|
|
84
|
+
message: `component ${JSON.stringify(c.alias)}: module ${JSON.stringify(module)} is set but file is empty — a module frame needs a file to ground it.`,
|
|
88
85
|
});
|
|
89
86
|
}
|
|
90
87
|
if (file &&
|
|
91
|
-
c.proposed !== true &&
|
|
92
88
|
c.deprecated !== true &&
|
|
93
89
|
mentionsNodeModules(file)) {
|
|
94
90
|
problems.push({
|
|
@@ -135,6 +131,42 @@ function validateSubsystemModelCrossField(doc) {
|
|
|
135
131
|
const spanProblem = spanRangeProblem(step.span, `/trails/${ti}/steps/${si}/span`, `trail ${JSON.stringify(w.id)}: step ${si}`);
|
|
136
132
|
if (spanProblem)
|
|
137
133
|
problems.push(spanProblem);
|
|
134
|
+
// The site construct is the enclosing frame; the seam line must live
|
|
135
|
+
// inside it. The schema can enforce each range but not containment.
|
|
136
|
+
const siteSpanProblem = spanRangeProblem(step.site?.span, `/trails/${ti}/steps/${si}/site/span`, `trail ${JSON.stringify(w.id)}: step ${si} site`);
|
|
137
|
+
if (siteSpanProblem)
|
|
138
|
+
problems.push(siteSpanProblem);
|
|
139
|
+
if (step.span &&
|
|
140
|
+
step.site?.span &&
|
|
141
|
+
!(step.site.span.startLine <= step.span.startLine &&
|
|
142
|
+
step.span.endLine <= step.site.span.endLine)) {
|
|
143
|
+
problems.push({
|
|
144
|
+
path: `/trails/${ti}/steps/${si}/site/span`,
|
|
145
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} site span ${step.site.span.startLine}-${step.site.span.endLine} does not contain the seam span ${step.span.startLine}-${step.span.endLine}.`,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// The target is a construct in its own file, so its span and purl
|
|
149
|
+
// fragment are checked independently of the step's site file.
|
|
150
|
+
const targetSpanProblem = spanRangeProblem(step.target?.span, `/trails/${ti}/steps/${si}/target/span`, `trail ${JSON.stringify(w.id)}: step ${si} target`);
|
|
151
|
+
if (targetSpanProblem)
|
|
152
|
+
problems.push(targetSpanProblem);
|
|
153
|
+
if (step.target &&
|
|
154
|
+
typeof step.target.purl === 'string' &&
|
|
155
|
+
step.target.purl.includes('#')) {
|
|
156
|
+
const fragment = step.target.purl.split('#').slice(1).join('#');
|
|
157
|
+
if (fragment !== step.target.file) {
|
|
158
|
+
problems.push({
|
|
159
|
+
path: `/trails/${ti}/steps/${si}/target/purl`,
|
|
160
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} target purl fragment ${JSON.stringify(fragment)} does not match target file ${JSON.stringify(step.target.file)}`,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (step.target && mentionsNodeModules(step.target.file)) {
|
|
165
|
+
problems.push({
|
|
166
|
+
path: `/trails/${ti}/steps/${si}/target/file`,
|
|
167
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} target file ${JSON.stringify(step.target.file)} points into node_modules — model the dependency as an external instead.`,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
138
170
|
});
|
|
139
171
|
});
|
|
140
172
|
return problems;
|
package/dist/validation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],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AAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAChE,IAAI,QAAQ,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;oBACjC,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc;wBAC7C,OAAO,EAAE,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,yBAAyB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,+BAA+B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;qBACrK,CAAC,CAAC;iBACJ;aACF;YACD,IAAI,IAAI,CAAC,MAAM,IAAI,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBACxD,QAAQ,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc;oBAC7C,OAAO,EAAE,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0EAA0E;iBAC7K,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AA3ID,4EA2IC"}
|
package/package.json
CHANGED
|
@@ -76,13 +76,9 @@
|
|
|
76
76
|
"service"
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
|
-
"proposed": {
|
|
80
|
-
"type": "boolean",
|
|
81
|
-
"description": "Design / migration placeholder — not a live source declaration yet. Verification skips source checks until promoted. Keep a real construct for the intended shape."
|
|
82
|
-
},
|
|
83
79
|
"deprecated": {
|
|
84
80
|
"type": "boolean",
|
|
85
|
-
"description": "The claim was real but its source is gone upstream — deleted or renamed.
|
|
81
|
+
"description": "The claim was real but its source is gone upstream — deleted or renamed. Verification skips source checks, so the component stops blocking verification. Transitional: a cleanup pass removes it and repairs the trails that referenced it."
|
|
86
82
|
},
|
|
87
83
|
"removedIn": {
|
|
88
84
|
"type": "object",
|
|
@@ -189,9 +185,6 @@
|
|
|
189
185
|
"role": {
|
|
190
186
|
"$ref": "#/$defs/role"
|
|
191
187
|
},
|
|
192
|
-
"proposed": {
|
|
193
|
-
"$ref": "#/$defs/proposed"
|
|
194
|
-
},
|
|
195
188
|
"deprecated": {
|
|
196
189
|
"$ref": "#/$defs/deprecated"
|
|
197
190
|
},
|
|
@@ -272,6 +265,59 @@
|
|
|
272
265
|
"$ref": "#/$defs/sourceSpan",
|
|
273
266
|
"description": "The seam's source span — the call-site range and its content hash. The trail-step counterpart of a component's declarationSpan; captured by verify tooling. `file` + `symbol` locate the frame."
|
|
274
267
|
},
|
|
268
|
+
"site": {
|
|
269
|
+
"type": "object",
|
|
270
|
+
"description": "The construct containing the seam site, with its full declaration range. Required for `calls`: the caller frame must be housed by the `from` component. For `uses` and data/event seams it is the via-site evidence and is optional. Same file/repo as the step.",
|
|
271
|
+
"additionalProperties": false,
|
|
272
|
+
"required": ["symbol", "span"],
|
|
273
|
+
"properties": {
|
|
274
|
+
"symbol": {
|
|
275
|
+
"type": "string",
|
|
276
|
+
"minLength": 1,
|
|
277
|
+
"description": "Caller/via construct symbol (e.g. `MaintenanceModelList`, `Registry.start`)."
|
|
278
|
+
},
|
|
279
|
+
"span": {
|
|
280
|
+
"$ref": "#/$defs/sourceSpan",
|
|
281
|
+
"description": "Full declaration range of the site construct, not just the seam line."
|
|
282
|
+
},
|
|
283
|
+
"construct": {
|
|
284
|
+
"$ref": "#/$defs/construct",
|
|
285
|
+
"description": "Declaration shape of the site construct, when known."
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"target": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"description": "The construct the seam reaches. Distinct from `to` (a component alias): the target can be a method on a modeled component, or a construct that is not a node at all.",
|
|
292
|
+
"additionalProperties": false,
|
|
293
|
+
"required": ["purl", "file", "symbol"],
|
|
294
|
+
"properties": {
|
|
295
|
+
"purl": {
|
|
296
|
+
"type": "string",
|
|
297
|
+
"minLength": 1,
|
|
298
|
+
"description": "File-anchored purl of the target repo/file."
|
|
299
|
+
},
|
|
300
|
+
"file": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"minLength": 1,
|
|
303
|
+
"pattern": "^(?!.*(^|/)node_modules(/|$)).*$",
|
|
304
|
+
"description": "Repo-root-relative target file."
|
|
305
|
+
},
|
|
306
|
+
"symbol": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"minLength": 1,
|
|
309
|
+
"description": "Callee construct symbol (e.g. `mergeProvenance`, `Store.add`)."
|
|
310
|
+
},
|
|
311
|
+
"span": {
|
|
312
|
+
"$ref": "#/$defs/sourceSpan",
|
|
313
|
+
"description": "Full declaration range of the target construct, when resolvable."
|
|
314
|
+
},
|
|
315
|
+
"construct": {
|
|
316
|
+
"$ref": "#/$defs/construct",
|
|
317
|
+
"description": "Declaration shape of the target, when known."
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
},
|
|
275
321
|
"purl": {
|
|
276
322
|
"type": "string",
|
|
277
323
|
"minLength": 1,
|
|
@@ -282,16 +328,26 @@
|
|
|
282
328
|
"minLength": 1,
|
|
283
329
|
"description": "Frame name for this step — the function/method on the stack at the site. Required; the Trails list shows this instead of a bare mechanism + filename fallback."
|
|
284
330
|
},
|
|
285
|
-
"proposed": {
|
|
286
|
-
"type": "boolean",
|
|
287
|
-
"description": "Planned seam — the step describes intended behavior through code that is not written yet. Verification skips source checks; viewers tint it like a proposed node. A step is proposed when it says so OR either endpoint component is proposed."
|
|
288
|
-
},
|
|
289
331
|
"annotation": {
|
|
290
332
|
"type": "string",
|
|
291
333
|
"minLength": 1,
|
|
292
334
|
"description": "Free-text note anchored to this step's site line. Optional, informative only, never verified against source; viewers surface it in the codeview's annotation column."
|
|
293
335
|
}
|
|
294
|
-
}
|
|
336
|
+
},
|
|
337
|
+
"allOf": [
|
|
338
|
+
{
|
|
339
|
+
"description": "A calls step claims the site is the caller frame, so it must carry the enclosing site construct. Other mechanisms may use site as evidence but are not required to.",
|
|
340
|
+
"if": {
|
|
341
|
+
"required": ["mechanism"],
|
|
342
|
+
"properties": {
|
|
343
|
+
"mechanism": { "const": "calls" }
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"then": {
|
|
347
|
+
"required": ["site"]
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
]
|
|
295
351
|
},
|
|
296
352
|
"trail": {
|
|
297
353
|
"type": "object",
|
package/src/node.ts
CHANGED
|
@@ -94,6 +94,21 @@ export interface TopicCreator {
|
|
|
94
94
|
githubLogin: string;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* A topic's reference to a subsystem model it concerns, optionally narrowed to
|
|
99
|
+
* specific runtime trails (flows) within that model.
|
|
100
|
+
*
|
|
101
|
+
* The link lives on the **topic** side, in the local store id namespace, and
|
|
102
|
+
* never on the model: a subsystem-model document is a portable, host-free
|
|
103
|
+
* artifact (shared/published) that must not embed local topic or store ids.
|
|
104
|
+
*/
|
|
105
|
+
export interface TopicSubsystemModelRef {
|
|
106
|
+
/** Store-assigned model id, e.g. "sg-1781...". */
|
|
107
|
+
modelId: string;
|
|
108
|
+
/** Specific runtime trails (flows) within the model, if narrower than the whole. */
|
|
109
|
+
trailIds?: string[];
|
|
110
|
+
}
|
|
111
|
+
|
|
97
112
|
/**
|
|
98
113
|
* Locally-authored topic — the shape desktop persists to
|
|
99
114
|
* `~/.principal/topics/<id>.json` and edits.
|
|
@@ -132,6 +147,11 @@ export interface DraftTopic {
|
|
|
132
147
|
status?: TopicStatus;
|
|
133
148
|
/** Local image attachments, referenced from the description via `asset://<id>`. */
|
|
134
149
|
assets?: TopicAsset[];
|
|
150
|
+
/**
|
|
151
|
+
* Subsystem models this topic concerns, as local store ids. Local-only: not
|
|
152
|
+
* carried on publish, since the referenced models are a local artifact.
|
|
153
|
+
*/
|
|
154
|
+
subsystemModels?: TopicSubsystemModelRef[];
|
|
135
155
|
}
|
|
136
156
|
|
|
137
157
|
/**
|
|
@@ -80,6 +80,7 @@ describe('CRUD', () => {
|
|
|
80
80
|
title: 'Pub',
|
|
81
81
|
description: 'has a description',
|
|
82
82
|
repos: ['pkg:github/acme/web'],
|
|
83
|
+
subsystemModels: [{ modelId: 'sg-1-abc', trailIds: ['trail-a'] }],
|
|
83
84
|
createdAt: '2026-01-01T00:00:00.000Z',
|
|
84
85
|
updatedAt: '2026-01-02T00:00:00.000Z',
|
|
85
86
|
};
|
|
@@ -89,6 +90,26 @@ describe('CRUD', () => {
|
|
|
89
90
|
});
|
|
90
91
|
expect(published.repos).toEqual(['pkg:github/acme/web']);
|
|
91
92
|
expect(published).not.toHaveProperty('trailIds');
|
|
93
|
+
// Local-only model refs must not travel on publish.
|
|
94
|
+
expect(published).not.toHaveProperty('subsystemModels');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('subsystemModels persist on create and are updatable', async () => {
|
|
98
|
+
const store = makeStore();
|
|
99
|
+
const created = await store.createTopic({
|
|
100
|
+
id: 'topic-models',
|
|
101
|
+
title: 'Model-scoped',
|
|
102
|
+
subsystemModels: [{ modelId: 'sg-1-abc', trailIds: ['trail-a'] }],
|
|
103
|
+
});
|
|
104
|
+
expect(created.subsystemModels).toEqual([{ modelId: 'sg-1-abc', trailIds: ['trail-a'] }]);
|
|
105
|
+
|
|
106
|
+
const reread = await store.getTopic('topic-models');
|
|
107
|
+
expect(reread?.subsystemModels).toEqual([{ modelId: 'sg-1-abc', trailIds: ['trail-a'] }]);
|
|
108
|
+
|
|
109
|
+
const updated = await store.updateTopic('topic-models', {
|
|
110
|
+
subsystemModels: [{ modelId: 'sg-2-def' }],
|
|
111
|
+
});
|
|
112
|
+
expect(updated.subsystemModels).toEqual([{ modelId: 'sg-2-def' }]);
|
|
92
113
|
});
|
|
93
114
|
|
|
94
115
|
test('delete removes the file and the index entry', async () => {
|
|
@@ -156,7 +177,7 @@ describe('index rebuild', () => {
|
|
|
156
177
|
);
|
|
157
178
|
});
|
|
158
179
|
|
|
159
|
-
test('legacy topic files
|
|
180
|
+
test('legacy topic files preserve unknown fields verbatim', async () => {
|
|
160
181
|
const store = makeStore();
|
|
161
182
|
await store.createTopic({
|
|
162
183
|
id: 'topic-legacy',
|
|
@@ -179,8 +200,8 @@ describe('index rebuild', () => {
|
|
|
179
200
|
description: 'Keep this description',
|
|
180
201
|
repos: ['pkg:github/a/b'],
|
|
181
202
|
});
|
|
182
|
-
expect(loaded).
|
|
183
|
-
expect(JSON.parse(readFileSync(topicPath, 'utf8'))).
|
|
203
|
+
expect(loaded).toHaveProperty('trailIds', ['old-trail']);
|
|
204
|
+
expect(JSON.parse(readFileSync(topicPath, 'utf8'))).toHaveProperty('trailIds', ['old-trail']);
|
|
184
205
|
});
|
|
185
206
|
});
|
|
186
207
|
|
|
@@ -212,12 +233,12 @@ describe('migration', () => {
|
|
|
212
233
|
const one = await store.getTopic('topic-1');
|
|
213
234
|
expect(one?.title).toBe('One');
|
|
214
235
|
expect(one?.createdAt).toBe('2026-01-01T00:00:00.000Z');
|
|
215
|
-
expect(one).
|
|
236
|
+
expect(one).toHaveProperty('trailIds', ['a']);
|
|
216
237
|
expect(await store.getTopic('topic-2')).toMatchObject({
|
|
217
238
|
title: 'Two',
|
|
218
239
|
repos: ['pkg:github/a/b'],
|
|
219
240
|
});
|
|
220
|
-
expect(await store.getTopic('topic-2')).
|
|
241
|
+
expect(await store.getTopic('topic-2')).toHaveProperty('trailIds', []);
|
|
221
242
|
expect(existsSync(join(topicsDir, 'topic-1.json'))).toBe(true);
|
|
222
243
|
});
|
|
223
244
|
|
|
@@ -81,12 +81,6 @@ const descriptionPreview = (description?: string): string => {
|
|
|
81
81
|
return `${trimmed.slice(0, DESCRIPTION_PREVIEW_MAX - 1)}…`;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
/** Strip the removed topic-to-trail field from data written by older versions. */
|
|
85
|
-
const withoutLegacyTrailIds = (topic: object): Record<string, unknown> => {
|
|
86
|
-
const { trailIds: _trailIds, ...canonical } = topic as Record<string, unknown>;
|
|
87
|
-
return canonical;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
84
|
const buildEntry = (topic: DraftTopic, sizeBytes: number): TopicIndexEntry => ({
|
|
91
85
|
id: topic.id,
|
|
92
86
|
title: topic.title || 'Untitled topic',
|
|
@@ -122,7 +116,10 @@ export interface MigrationResult {
|
|
|
122
116
|
* once at creation and cannot be changed by an update.
|
|
123
117
|
*/
|
|
124
118
|
export type TopicUpdate = Partial<
|
|
125
|
-
Pick<
|
|
119
|
+
Pick<
|
|
120
|
+
DraftTopic,
|
|
121
|
+
'title' | 'description' | 'status' | 'createdBy' | 'assets' | 'repos' | 'subsystemModels'
|
|
122
|
+
>
|
|
126
123
|
>;
|
|
127
124
|
|
|
128
125
|
/**
|
|
@@ -340,14 +337,13 @@ export class TopicStore {
|
|
|
340
337
|
|
|
341
338
|
/** Write a topic file and upsert its index entry. Does not generate ids. */
|
|
342
339
|
private async writeTopic(topic: DraftTopic, idx: IndexFileV1): Promise<void> {
|
|
343
|
-
const
|
|
344
|
-
const fileName = `${sanitizeSegment(canonicalTopic.id)}.json`;
|
|
340
|
+
const fileName = `${sanitizeSegment(topic.id)}.json`;
|
|
345
341
|
const file = join(this.baseDir, fileName);
|
|
346
342
|
await mkdir(dirname(file), { recursive: true });
|
|
347
|
-
const serialized = JSON.stringify(
|
|
343
|
+
const serialized = JSON.stringify(topic, null, 2);
|
|
348
344
|
await writeFile(file, serialized, 'utf8');
|
|
349
|
-
const entry = buildEntry(
|
|
350
|
-
const at = idx.entries.findIndex((e) => e.id ===
|
|
345
|
+
const entry = buildEntry(topic, Buffer.byteLength(serialized, 'utf8'));
|
|
346
|
+
const at = idx.entries.findIndex((e) => e.id === topic.id);
|
|
351
347
|
if (at >= 0) idx.entries[at] = entry;
|
|
352
348
|
else idx.entries.push(entry);
|
|
353
349
|
await this.persistIndex();
|
|
@@ -356,16 +352,7 @@ export class TopicStore {
|
|
|
356
352
|
private async readTopic(fileName: string): Promise<DraftTopic | null> {
|
|
357
353
|
try {
|
|
358
354
|
const raw = await readFile(join(this.baseDir, fileName), 'utf8');
|
|
359
|
-
|
|
360
|
-
const topic = withoutLegacyTrailIds(parsed) as unknown as DraftTopic;
|
|
361
|
-
if ('trailIds' in parsed) {
|
|
362
|
-
try {
|
|
363
|
-
await writeFile(join(this.baseDir, fileName), JSON.stringify(topic, null, 2), 'utf8');
|
|
364
|
-
} catch (err) {
|
|
365
|
-
console.warn('[TopicStore] Failed to remove legacy trailIds from', fileName, err);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return topic;
|
|
355
|
+
return JSON.parse(raw) as DraftTopic;
|
|
369
356
|
} catch (err) {
|
|
370
357
|
console.error('[TopicStore] Failed to read topic', fileName, err);
|
|
371
358
|
return null;
|
|
@@ -397,20 +384,7 @@ export class TopicStore {
|
|
|
397
384
|
const raw = await readFile(this.indexPath, 'utf8');
|
|
398
385
|
const parsed = JSON.parse(raw) as Partial<IndexFileV1>;
|
|
399
386
|
if (parsed?.version === 1 && Array.isArray(parsed.entries)) {
|
|
400
|
-
|
|
401
|
-
const entries = parsed.entries.map((entry) => {
|
|
402
|
-
hadLegacyTrailCount ||= Boolean(
|
|
403
|
-
entry && typeof entry === 'object' && 'trailCount' in entry
|
|
404
|
-
);
|
|
405
|
-
const { trailCount: _trailCount, ...canonical } = entry as TopicIndexEntry & {
|
|
406
|
-
trailCount?: number;
|
|
407
|
-
};
|
|
408
|
-
return canonical;
|
|
409
|
-
});
|
|
410
|
-
if (hadLegacyTrailCount) {
|
|
411
|
-
await writeFile(this.indexPath, JSON.stringify({ version: 1, entries }, null, 2), 'utf8');
|
|
412
|
-
}
|
|
413
|
-
return { version: 1, entries };
|
|
387
|
+
return { version: 1, entries: parsed.entries };
|
|
414
388
|
}
|
|
415
389
|
} catch (err) {
|
|
416
390
|
const code = (err as NodeJS.ErrnoException).code;
|
|
@@ -60,6 +60,11 @@ describe("subsystem-model schema", () => {
|
|
|
60
60
|
expect(schema.$defs.trailStep?.properties?.line).toBeUndefined();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
+
test("trail steps can carry verifiable site and target constructs", () => {
|
|
64
|
+
expect(schema.$defs.trailStep?.properties?.site).toBeDefined();
|
|
65
|
+
expect(schema.$defs.trailStep?.properties?.target).toBeDefined();
|
|
66
|
+
});
|
|
67
|
+
|
|
63
68
|
test("a store declares its own value type", () => {
|
|
64
69
|
// `additionalProperties: false` on the store declaration, so the field
|
|
65
70
|
// has to be declared here or every typed store would be rejected.
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Ontology: construct = what a node is, framework + stereotype = which
|
|
15
15
|
* framework pattern it plays, role = where it sits, process = where it runs,
|
|
16
|
-
* module = which source file/module the export belongs to
|
|
17
|
-
* proposed = not yet in source (design / migration placeholder).
|
|
16
|
+
* module = which source file/module the export belongs to.
|
|
18
17
|
* Package (repo) frames are derived from component `purl` when a graph spans
|
|
19
18
|
* multiple repos — there is no separate `package` field.
|
|
20
19
|
* `symbol` is the code identity; `name` is the display label.
|
|
@@ -325,19 +324,10 @@ export interface SubsystemComponent {
|
|
|
325
324
|
logo?: string;
|
|
326
325
|
purpose?: string;
|
|
327
326
|
role?: SubsystemComponentRole;
|
|
328
|
-
/**
|
|
329
|
-
* Design / migration placeholder — participates in edges and flows but is
|
|
330
|
-
* not a live source declaration yet. Verification skips source checks until
|
|
331
|
-
* promoted (`proposed` cleared, `file` + `symbol` filled). Orthogonal to
|
|
332
|
-
* `construct` (intended shape) and `role` (topology).
|
|
333
|
-
*/
|
|
334
|
-
proposed?: boolean;
|
|
335
327
|
/**
|
|
336
328
|
* The claim was real but its source is gone — deleted or renamed upstream.
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
* `proposed`, so a model carrying deprecations is no longer wedged on
|
|
340
|
-
* unfixable `missing_file` findings.
|
|
329
|
+
* Verification skips source checks so a model carrying deprecations is no
|
|
330
|
+
* longer wedged on unfixable `missing_file` findings.
|
|
341
331
|
*
|
|
342
332
|
* This is a transitional marker, not a resting state. A cleanup pass removes
|
|
343
333
|
* the component and repairs the trails that referenced it; the field exists so
|
|
@@ -411,6 +401,37 @@ export interface SubsystemComponentEdge {
|
|
|
411
401
|
mechanism: SubsystemEdgeMechanism;
|
|
412
402
|
}
|
|
413
403
|
|
|
404
|
+
/**
|
|
405
|
+
* The construct that contains a seam site. The site is always in the step's
|
|
406
|
+
* own file/repo (`step.file` / `step.purl`), so it carries only the construct
|
|
407
|
+
* identity and its full declaration range.
|
|
408
|
+
*/
|
|
409
|
+
export interface SubsystemSiteConstruct {
|
|
410
|
+
/** Caller construct symbol (e.g. `MaintenanceModelList`, `Registry.start`). */
|
|
411
|
+
symbol: string;
|
|
412
|
+
/** Full declaration range of the construct, not just the seam line. */
|
|
413
|
+
span: SubsystemSourceSpan;
|
|
414
|
+
/** Declaration shape, when known (function, method, class, …). */
|
|
415
|
+
construct?: SubsystemConstruct;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* The construct a seam reaches. Unlike `site`, the target can live in another
|
|
420
|
+
* repo, so it carries its own purl + file. `span` is the target declaration
|
|
421
|
+
* range when it resolves; it can be absent for externals or unresolved targets.
|
|
422
|
+
*/
|
|
423
|
+
export interface SubsystemTargetConstruct {
|
|
424
|
+
/** File-anchored purl of the target repo/file. */
|
|
425
|
+
purl: string;
|
|
426
|
+
file: string;
|
|
427
|
+
/** Callee construct symbol (e.g. `mergeProvenance`, `Store.add`). */
|
|
428
|
+
symbol: string;
|
|
429
|
+
/** Full declaration range of the target, when resolvable. */
|
|
430
|
+
span?: SubsystemSourceSpan;
|
|
431
|
+
/** Declaration shape, when known. */
|
|
432
|
+
construct?: SubsystemConstruct;
|
|
433
|
+
}
|
|
434
|
+
|
|
414
435
|
export interface SubsystemTrailStep {
|
|
415
436
|
/** Source component alias. */
|
|
416
437
|
from: string;
|
|
@@ -421,11 +442,26 @@ export interface SubsystemTrailStep {
|
|
|
421
442
|
file: string;
|
|
422
443
|
/**
|
|
423
444
|
* The step's source span — the call-site range and its content hash. The
|
|
424
|
-
* trail-step counterpart of a component's `declarationSpan`,
|
|
425
|
-
*
|
|
426
|
-
*
|
|
445
|
+
* trail-step counterpart of a component's `declarationSpan`, but
|
|
446
|
+
* **hand-authored**: nothing derives it (construct spans come from graphify
|
|
447
|
+
* + tree-sitter; step spans do not). `file` + `symbol` locate the frame; the
|
|
448
|
+
* span pins that frame's exact seam range. Absent means the seam is
|
|
449
|
+
* unverified and the Trails view has no line to highlight.
|
|
427
450
|
*/
|
|
428
451
|
span?: SubsystemSourceSpan;
|
|
452
|
+
/**
|
|
453
|
+
* The construct containing the seam site, with its full declaration range.
|
|
454
|
+
* Required when `mechanism` is `calls`: the caller frame must be housed by
|
|
455
|
+
* the `from` component. For `uses` and data/event seams it is the via-site
|
|
456
|
+
* evidence and remains optional.
|
|
457
|
+
*/
|
|
458
|
+
site?: SubsystemSiteConstruct;
|
|
459
|
+
/**
|
|
460
|
+
* The construct the seam reaches. Distinct from `to` (a component alias):
|
|
461
|
+
* the target can be a method on a modeled component, or a construct that is
|
|
462
|
+
* not a node at all. Optional; populated from accepted call-site evidence.
|
|
463
|
+
*/
|
|
464
|
+
target?: SubsystemTargetConstruct;
|
|
429
465
|
/**
|
|
430
466
|
* File-anchored purl of the seam site (e.g.
|
|
431
467
|
* `pkg:github/owner/name#path/to/file.ts`), mirroring component `purl`.
|
|
@@ -439,14 +475,6 @@ export interface SubsystemTrailStep {
|
|
|
439
475
|
* mechanism + filename fallback.
|
|
440
476
|
*/
|
|
441
477
|
symbol: string;
|
|
442
|
-
/**
|
|
443
|
-
* Planned seam — the step describes intended behavior through code that is
|
|
444
|
-
* not written yet. Orthogonal to (and redundant with) the endpoints' own
|
|
445
|
-
* `proposed` flags: a step is proposed when it says so OR either endpoint
|
|
446
|
-
* is proposed. Verification skips source checks either way, and viewers
|
|
447
|
-
* tint it exactly like a proposed node.
|
|
448
|
-
*/
|
|
449
|
-
proposed?: boolean;
|
|
450
478
|
/**
|
|
451
479
|
* Free-text note anchored to this step's site line. Optional — informative
|
|
452
480
|
* only, never verified against source; viewers surface it via the codeview's
|
package/src/validation.test.ts
CHANGED
|
@@ -81,7 +81,70 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
81
81
|
expect(problems[0]!.path).toBe('/trails/0/steps/0/purl');
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
test('
|
|
84
|
+
test('flags a site construct that does not contain the seam span', () => {
|
|
85
|
+
const problems = validateSubsystemModelCrossField(
|
|
86
|
+
doc({
|
|
87
|
+
components: [comp('a'), comp('b')],
|
|
88
|
+
trails: [
|
|
89
|
+
{
|
|
90
|
+
id: 'w1',
|
|
91
|
+
title: 'flow',
|
|
92
|
+
steps: [
|
|
93
|
+
{
|
|
94
|
+
from: 'a',
|
|
95
|
+
to: 'b',
|
|
96
|
+
mechanism: 'calls',
|
|
97
|
+
file: 'src/a.ts',
|
|
98
|
+
purl: 'pkg:github/acme/app#src/a.ts',
|
|
99
|
+
symbol: 'a',
|
|
100
|
+
span: { startLine: 20, endLine: 20, contentHash: 'h' },
|
|
101
|
+
site: {
|
|
102
|
+
symbol: 'a',
|
|
103
|
+
span: { startLine: 1, endLine: 10, contentHash: 'h' },
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
expect(problems.some((p) => p.path === '/trails/0/steps/0/site/span')).toBe(true);
|
|
112
|
+
expect(problems.find((p) => p.path === '/trails/0/steps/0/site/span')!.message).toContain(
|
|
113
|
+
'does not contain the seam span',
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('flags a target purl fragment that mismatches the target file', () => {
|
|
118
|
+
const problems = validateSubsystemModelCrossField(
|
|
119
|
+
doc({
|
|
120
|
+
components: [comp('a'), comp('b')],
|
|
121
|
+
trails: [
|
|
122
|
+
{
|
|
123
|
+
id: 'w1',
|
|
124
|
+
title: 'flow',
|
|
125
|
+
steps: [
|
|
126
|
+
{
|
|
127
|
+
from: 'a',
|
|
128
|
+
to: 'b',
|
|
129
|
+
mechanism: 'calls',
|
|
130
|
+
file: 'src/a.ts',
|
|
131
|
+
purl: 'pkg:github/acme/app#src/a.ts',
|
|
132
|
+
symbol: 'a',
|
|
133
|
+
target: {
|
|
134
|
+
purl: 'pkg:github/acme/app#src/b-other.ts',
|
|
135
|
+
file: 'src/b.ts',
|
|
136
|
+
symbol: 'b',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
}),
|
|
143
|
+
);
|
|
144
|
+
expect(problems.some((p) => p.path === '/trails/0/steps/0/target/purl')).toBe(true);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('module implies file, exempting external', () => {
|
|
85
148
|
const bad = validateSubsystemModelCrossField(
|
|
86
149
|
doc({ components: [comp('a', { module: 'src/host', file: '' })] }),
|
|
87
150
|
);
|
|
@@ -93,7 +156,6 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
93
156
|
doc({
|
|
94
157
|
components: [
|
|
95
158
|
comp('ext', { module: 'pkg:npm/x', construct: 'external', file: '' }),
|
|
96
|
-
comp('plan', { module: 'src/host', file: '', proposed: true }),
|
|
97
159
|
comp('ok', { module: 'src/host', file: 'src/host/main.ts' }),
|
|
98
160
|
],
|
|
99
161
|
}),
|
|
@@ -126,7 +188,7 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
126
188
|
expect(problems[2]!.path).toBe('/components/2/file');
|
|
127
189
|
});
|
|
128
190
|
|
|
129
|
-
test('accepts
|
|
191
|
+
test('accepts an external identity and a node_modulesx directory', () => {
|
|
130
192
|
expect(
|
|
131
193
|
validateSubsystemModelCrossField(
|
|
132
194
|
doc({
|
|
@@ -137,8 +199,6 @@ describe('validateSubsystemModelCrossField', () => {
|
|
|
137
199
|
file: '',
|
|
138
200
|
purl: 'pkg:npm/@pierre/diffs',
|
|
139
201
|
}),
|
|
140
|
-
// A planned in-repo component may sit where it will live.
|
|
141
|
-
comp('plan', { file: 'packages/x/node_modules/y/z.ts', proposed: true }),
|
|
142
202
|
// `node_modulesx` is an ordinary directory, not the install root.
|
|
143
203
|
comp('ok', { file: 'packages/node_modulesx/z.ts' }),
|
|
144
204
|
],
|
package/src/validation.ts
CHANGED
|
@@ -25,14 +25,10 @@ export interface SubsystemValidationProblem {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
function isUngrounded(c: SubsystemComponent): boolean {
|
|
28
|
-
// Deprecated components are exempt
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
return
|
|
32
|
-
c.construct === 'external' ||
|
|
33
|
-
c.proposed === true ||
|
|
34
|
-
c.deprecated === true
|
|
35
|
-
);
|
|
28
|
+
// Deprecated components are exempt: the file is a historical pointer to
|
|
29
|
+
// source that is gone, so it cannot resolve and its absence is not an
|
|
30
|
+
// inconsistency.
|
|
31
|
+
return c.construct === 'external' || c.deprecated === true;
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
/**
|
|
@@ -44,8 +40,7 @@ function isUngrounded(c: SubsystemComponent): boolean {
|
|
|
44
40
|
* Such a component is a third-party dependency: model it as `construct:
|
|
45
41
|
* 'external'` with `purl: 'pkg:npm/<package>'` and no file. Applies to externals
|
|
46
42
|
* too — they carry no file by design, so an install path there is dead weight
|
|
47
|
-
* that draws a link nothing can open.
|
|
48
|
-
* grounding rule: its file is a placeholder for something not placed yet.
|
|
43
|
+
* that draws a link nothing can open.
|
|
49
44
|
*
|
|
50
45
|
* The same rule covers trail step files — a seam into an external belongs
|
|
51
46
|
* at the call site in the caller, which *is* in the repo.
|
|
@@ -99,18 +94,17 @@ export function validateSubsystemModelCrossField(
|
|
|
99
94
|
ids.add(c.alias);
|
|
100
95
|
}
|
|
101
96
|
// A grounded component that claims a `module` needs a `file` to ground the
|
|
102
|
-
// frame. Externals
|
|
97
|
+
// frame. Externals carry no file by design.
|
|
103
98
|
const module = typeof c.module === 'string' ? c.module.trim() : '';
|
|
104
99
|
const file = typeof c.file === 'string' ? c.file.trim() : '';
|
|
105
100
|
if (module && !file && !isUngrounded(c)) {
|
|
106
101
|
problems.push({
|
|
107
102
|
path: `/components/${i}/module`,
|
|
108
|
-
message: `component ${JSON.stringify(c.alias)}: module ${JSON.stringify(module)} is set but file is empty — a module frame needs a file to ground it
|
|
103
|
+
message: `component ${JSON.stringify(c.alias)}: module ${JSON.stringify(module)} is set but file is empty — a module frame needs a file to ground it.`,
|
|
109
104
|
});
|
|
110
105
|
}
|
|
111
106
|
if (
|
|
112
107
|
file &&
|
|
113
|
-
c.proposed !== true &&
|
|
114
108
|
c.deprecated !== true &&
|
|
115
109
|
mentionsNodeModules(file)
|
|
116
110
|
) {
|
|
@@ -165,6 +159,56 @@ export function validateSubsystemModelCrossField(
|
|
|
165
159
|
`trail ${JSON.stringify(w.id)}: step ${si}`,
|
|
166
160
|
);
|
|
167
161
|
if (spanProblem) problems.push(spanProblem);
|
|
162
|
+
|
|
163
|
+
// The site construct is the enclosing frame; the seam line must live
|
|
164
|
+
// inside it. The schema can enforce each range but not containment.
|
|
165
|
+
const siteSpanProblem = spanRangeProblem(
|
|
166
|
+
step.site?.span,
|
|
167
|
+
`/trails/${ti}/steps/${si}/site/span`,
|
|
168
|
+
`trail ${JSON.stringify(w.id)}: step ${si} site`,
|
|
169
|
+
);
|
|
170
|
+
if (siteSpanProblem) problems.push(siteSpanProblem);
|
|
171
|
+
if (
|
|
172
|
+
step.span &&
|
|
173
|
+
step.site?.span &&
|
|
174
|
+
!(
|
|
175
|
+
step.site.span.startLine <= step.span.startLine &&
|
|
176
|
+
step.span.endLine <= step.site.span.endLine
|
|
177
|
+
)
|
|
178
|
+
) {
|
|
179
|
+
problems.push({
|
|
180
|
+
path: `/trails/${ti}/steps/${si}/site/span`,
|
|
181
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} site span ${step.site.span.startLine}-${step.site.span.endLine} does not contain the seam span ${step.span.startLine}-${step.span.endLine}.`,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// The target is a construct in its own file, so its span and purl
|
|
186
|
+
// fragment are checked independently of the step's site file.
|
|
187
|
+
const targetSpanProblem = spanRangeProblem(
|
|
188
|
+
step.target?.span,
|
|
189
|
+
`/trails/${ti}/steps/${si}/target/span`,
|
|
190
|
+
`trail ${JSON.stringify(w.id)}: step ${si} target`,
|
|
191
|
+
);
|
|
192
|
+
if (targetSpanProblem) problems.push(targetSpanProblem);
|
|
193
|
+
if (
|
|
194
|
+
step.target &&
|
|
195
|
+
typeof step.target.purl === 'string' &&
|
|
196
|
+
step.target.purl.includes('#')
|
|
197
|
+
) {
|
|
198
|
+
const fragment = step.target.purl.split('#').slice(1).join('#');
|
|
199
|
+
if (fragment !== step.target.file) {
|
|
200
|
+
problems.push({
|
|
201
|
+
path: `/trails/${ti}/steps/${si}/target/purl`,
|
|
202
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} target purl fragment ${JSON.stringify(fragment)} does not match target file ${JSON.stringify(step.target.file)}`,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (step.target && mentionsNodeModules(step.target.file)) {
|
|
207
|
+
problems.push({
|
|
208
|
+
path: `/trails/${ti}/steps/${si}/target/file`,
|
|
209
|
+
message: `trail ${JSON.stringify(w.id)}: step ${si} target file ${JSON.stringify(step.target.file)} points into node_modules — model the dependency as an external instead.`,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
168
212
|
});
|
|
169
213
|
});
|
|
170
214
|
|