@htilabs/platform-common-models 0.14.0 → 0.17.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/{cvcEntry-0BIB9sen.d.cts → cvcEntry-ctHTp2df.d.cts} +36 -36
- package/dist/{cvcEntry-0BIB9sen.d.ts → cvcEntry-ctHTp2df.d.ts} +36 -36
- package/dist/cvcs/index.cjs +184 -40
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +191 -41
- package/dist/cvcs/index.d.ts +191 -41
- package/dist/cvcs/index.js +184 -40
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +3 -1
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +8 -6
- package/dist/enums/index.d.ts +8 -6
- package/dist/enums/index.js +3 -1
- package/dist/enums/index.js.map +1 -1
- package/dist/{index-CDoqrfc1.d.ts → index-4DiJrn7y.d.ts} +1 -1
- package/dist/{index-Zu_mOJRn.d.cts → index-qreOzXYS.d.cts} +1 -1
- package/dist/index.cjs +187 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +187 -41
- package/dist/index.js.map +1 -1
- package/dist/models/index.d.cts +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/schemas/index.d.cts +11 -11
- package/dist/schemas/index.d.ts +11 -11
- package/package.json +27 -26
- package/src/__tests__/__snapshots__/cvc-sot.snap +5 -5
- package/src/__tests__/core-functions-canon.test.ts +53 -0
- package/src/__tests__/core-information-scope-invariant.test.ts +298 -19
- package/src/__tests__/cvc-sot-snapshot.test.ts +19 -12
- package/src/__tests__/cvc-status-parser.test.ts +1 -1
- package/src/__tests__/cvc-structural.test.ts +3 -3
- package/src/__tests__/location-type-routing-invariant.test.ts +1 -1
- package/src/cvcs/{coreFunctions.v1.0.0.json → coreFunctions.v1.1.0.json} +11 -2
- package/src/cvcs/{coreInformationScope.v1.0.0.json → coreInformationScope.v1.1.0.json} +113 -22
- package/src/cvcs/index.ts +3 -3
- package/src/cvcs/{roiScope.v1.0.0.json → roiScope.v1.2.0.json} +51 -7
- package/src/generated/cvc-enums.ts +8 -6
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Two vocabularies describe the same thing at different grains:
|
|
6
6
|
*
|
|
7
|
-
* `roi_scope` flat item vocabulary, 27 substantive keys
|
|
8
|
-
*
|
|
7
|
+
* `roi_scope` LEGACY flat item vocabulary, 27 substantive keys
|
|
8
|
+
* (25 live + 2 RETIRED tombstones), no category axis
|
|
9
|
+
* `core_information_scope` 12 policy-grain CATEGORIES + 55 authorization-grain UNITS
|
|
10
|
+
* (+ 2 RETIRED tombstones, 2026-10-05)
|
|
9
11
|
*
|
|
10
|
-
* PAVE and Thread
|
|
11
|
-
*
|
|
12
|
+
* PAVE and Thread both hold stored ROIs written against `roi_scope` keys, and
|
|
13
|
+
* both now derive their live vocabulary from this domain, keeping `roi_scope`
|
|
14
|
+
* only as the stored-data provenance check. That move is safe for exactly one reason:
|
|
12
15
|
* every substantive `roi_scope` key survives here, spelled identically, so a
|
|
13
16
|
* stored ROI keeps its exact recorded meaning. That is not a nice-to-have — an
|
|
14
17
|
* ROI whose meaning widens is a CONSENT change wearing a data change's clothes,
|
|
@@ -44,6 +47,7 @@ interface Entry {
|
|
|
44
47
|
levelFloor?: number;
|
|
45
48
|
appRelevance?: string[];
|
|
46
49
|
specialDataType?: string;
|
|
50
|
+
retired?: boolean;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
const read = (f: string): { entries: Entry[]; levels: Record<string, string> } =>
|
|
@@ -52,8 +56,8 @@ const read = (f: string): { entries: Entry[]; levels: Record<string, string> } =
|
|
|
52
56
|
levels: Record<string, string>;
|
|
53
57
|
};
|
|
54
58
|
|
|
55
|
-
const scope = read("coreInformationScope.v1.
|
|
56
|
-
const roi = read("roiScope.v1.
|
|
59
|
+
const scope = read("coreInformationScope.v1.1.0.json");
|
|
60
|
+
const roi = read("roiScope.v1.2.0.json");
|
|
57
61
|
|
|
58
62
|
const byCode = new Map(scope.entries.map((e) => [e.code, e]));
|
|
59
63
|
const MISSINGNESS = new Set([
|
|
@@ -70,16 +74,22 @@ const isMissingness = (e: Entry): boolean =>
|
|
|
70
74
|
const categories = scope.entries.filter(
|
|
71
75
|
(e) => e.parentCode === null && !isMissingness(e),
|
|
72
76
|
);
|
|
73
|
-
|
|
77
|
+
/** Every L2 row: live units AND retired tombstones. */
|
|
78
|
+
const allUnits = scope.entries.filter(
|
|
74
79
|
(e) => e.parentCode !== null && !isMissingness(e),
|
|
75
80
|
);
|
|
81
|
+
/** Live, authorizable units — what a picker offers. */
|
|
82
|
+
const units = allUnits.filter((e) => e.retired !== true);
|
|
83
|
+
/** Retired tombstones — resolvable by code, include nothing, never offered. */
|
|
84
|
+
const tombstones = allUnits.filter((e) => e.retired === true);
|
|
76
85
|
|
|
77
86
|
describe("core_information_scope — adoption invariants", () => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
const roiSubstantive = roi.entries
|
|
88
|
+
.map((e) => e.key)
|
|
89
|
+
.filter((k) => !MISSINGNESS.has(k));
|
|
90
|
+
|
|
91
|
+
it("resolves every substantive roi_scope key, spelled identically", () => {
|
|
92
|
+
const unitKeys = new Set(allUnits.map((u) => u.key));
|
|
83
93
|
const missing = roiSubstantive.filter((k) => !unitKeys.has(k));
|
|
84
94
|
|
|
85
95
|
// A failure here means a stored ROI can no longer be expressed in the new
|
|
@@ -88,19 +98,78 @@ describe("core_information_scope — adoption invariants", () => {
|
|
|
88
98
|
expect(roiSubstantive.length).toBe(27);
|
|
89
99
|
});
|
|
90
100
|
|
|
101
|
+
it("retires exactly the two roi_scope keys canon retired, and no other", () => {
|
|
102
|
+
// NARRATIVE-NOTES 2026-10-05 (signed Spec v2 rule 5): screen_notes and
|
|
103
|
+
// background are retired. A stored ROI naming one still RESOLVES (to a
|
|
104
|
+
// tombstone that includes nothing) — it narrows, it never widens, and
|
|
105
|
+
// canon records that only demo data named them. Any OTHER roi_scope key
|
|
106
|
+
// landing on a tombstone would be an unruled narrowing of stored consent.
|
|
107
|
+
const live = new Set(units.map((u) => u.key));
|
|
108
|
+
expect(roiSubstantive.filter((k) => !live.has(k)).sort()).toEqual([
|
|
109
|
+
"background",
|
|
110
|
+
"screen_notes",
|
|
111
|
+
]);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("gives ONE answer to 'is this offerable' across both vocabularies (co-bwc)", () => {
|
|
115
|
+
// Until roi_scope v1.2.0 the package answered twice: CVC-236 v1.1.0 had
|
|
116
|
+
// retired screen_notes / background while roi_scope still marked them
|
|
117
|
+
// selectable. Every shared key must now agree on selectable AND retired,
|
|
118
|
+
// so neither vocabulary can re-offer a retired unit as consent.
|
|
119
|
+
// Missingness keys included: the four shared sentinels must agree too.
|
|
120
|
+
const scopeByKey = new Map(scope.entries.map((u) => [u.key, u]));
|
|
121
|
+
const disagreements = roi.entries
|
|
122
|
+
.filter((e) => {
|
|
123
|
+
const twin = scopeByKey.get(e.key);
|
|
124
|
+
return (
|
|
125
|
+
twin === undefined ||
|
|
126
|
+
twin.selectable !== e.selectable ||
|
|
127
|
+
(twin.retired === true) !== (e.retired === true)
|
|
128
|
+
);
|
|
129
|
+
})
|
|
130
|
+
.map((e) => e.key);
|
|
131
|
+
expect(disagreements).toEqual([]);
|
|
132
|
+
|
|
133
|
+
// Scoped to CVC-236 tombstones whose key roi_scope carries: a future
|
|
134
|
+
// CVC-236-only retirement (a unit roi_scope never had) is not a
|
|
135
|
+
// divergence of the legacy vocabulary.
|
|
136
|
+
const roiKeys = new Set(roi.entries.map((e) => e.key));
|
|
137
|
+
const roiTombstones = roi.entries.filter((e) => e.retired === true);
|
|
138
|
+
expect(roiTombstones.map((e) => e.key).sort()).toEqual(
|
|
139
|
+
tombstones
|
|
140
|
+
.filter((t) => roiKeys.has(t.key))
|
|
141
|
+
.map((t) => t.key)
|
|
142
|
+
.sort(),
|
|
143
|
+
);
|
|
144
|
+
// A tombstone keeps its published roi_scope code (983-012 / 983-014) —
|
|
145
|
+
// codes are never withdrawn or reused.
|
|
146
|
+
expect(roiTombstones.map((e) => e.code).sort()).toEqual([
|
|
147
|
+
"983-012-000-000-000-000-000",
|
|
148
|
+
"983-014-000-000-000-000-000",
|
|
149
|
+
]);
|
|
150
|
+
expect(roiTombstones.every((e) => e.selectable === false)).toBe(true);
|
|
151
|
+
});
|
|
152
|
+
|
|
91
153
|
it("is a strict superset — the additions are additions, not renames", () => {
|
|
92
154
|
expect(units.length).toBeGreaterThan(27);
|
|
93
|
-
expect(units).toHaveLength(
|
|
155
|
+
expect(units).toHaveLength(55);
|
|
156
|
+
expect(tombstones).toHaveLength(2);
|
|
94
157
|
});
|
|
95
158
|
|
|
96
159
|
it("keeps the two grains distinct: categories decide policy, units carry consent", () => {
|
|
97
160
|
expect(categories).toHaveLength(12);
|
|
98
161
|
expect(categories.every((c) => c.selectable === false)).toBe(true);
|
|
99
162
|
expect(units.every((u) => u.selectable === true)).toBe(true);
|
|
163
|
+
// A tombstone is never authorizable — selectable would let a retired
|
|
164
|
+
// code be cited as consent again.
|
|
165
|
+
expect(tombstones.every((t) => t.selectable === false)).toBe(true);
|
|
100
166
|
});
|
|
101
167
|
|
|
102
|
-
it("wires every unit to exactly one category, reciprocally", () => {
|
|
103
|
-
|
|
168
|
+
it("wires every unit — tombstones included — to exactly one category, reciprocally", () => {
|
|
169
|
+
// Tombstones stay in their category's childCodes: the locked spec §4 C4
|
|
170
|
+
// invariant makes childCodes the exact inverse of parentCode. Pickers
|
|
171
|
+
// offer only selectable children.
|
|
172
|
+
for (const u of allUnits) {
|
|
104
173
|
const parent = byCode.get(u.parentCode as string);
|
|
105
174
|
expect(parent, `unit ${u.key} has a dangling parent`).toBeDefined();
|
|
106
175
|
expect(parent?.selectable, `unit ${u.key} hangs off a selectable row`).toBe(
|
|
@@ -110,7 +179,7 @@ describe("core_information_scope — adoption invariants", () => {
|
|
|
110
179
|
u.code,
|
|
111
180
|
);
|
|
112
181
|
}
|
|
113
|
-
expect(categories.flatMap((c) => c.childCodes)).toHaveLength(
|
|
182
|
+
expect(categories.flatMap((c) => c.childCodes)).toHaveLength(allUnits.length);
|
|
114
183
|
});
|
|
115
184
|
|
|
116
185
|
it("publishes the posture sets as data, so they stop being literals", () => {
|
|
@@ -170,7 +239,9 @@ const PUBLISHED: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
|
170
239
|
],
|
|
171
240
|
["contact", ["contact_info", "safe_locations", "priorities_safety", "encounter_location"]],
|
|
172
241
|
["services", ["contact_history", "service_history", "plans_goals"]],
|
|
173
|
-
|
|
242
|
+
// screen_notes (-001) and background (-003) are RETIRED tombstones since
|
|
243
|
+
// 2026-10-05 — they keep their codes; session_summary APPENDED at -004.
|
|
244
|
+
["notes", ["screen_notes", "case_notes", "background", "session_summary"]],
|
|
174
245
|
[
|
|
175
246
|
"health_accommodation",
|
|
176
247
|
[
|
|
@@ -209,7 +280,7 @@ const byKey = new Map(scope.entries.map((e) => [e.key, e]));
|
|
|
209
280
|
|
|
210
281
|
describe("core_information_scope — published codes never move", () => {
|
|
211
282
|
it("keeps every published category and unit at its frozen positional code", () => {
|
|
212
|
-
const actual = [...categories, ...
|
|
283
|
+
const actual = [...categories, ...allUnits].map((e): [string, string] => [e.key, e.code]);
|
|
213
284
|
const expected = PUBLISHED.flatMap(([cat, us], ci): [string, string][] => [
|
|
214
285
|
[cat, codeOf(ci + 1)],
|
|
215
286
|
...us.map((u, ui): [string, string] => [u, codeOf(ci + 1, ui + 1)]),
|
|
@@ -319,7 +390,7 @@ describe("core_information_scope — encounter_location (2026-10-01)", () => {
|
|
|
319
390
|
*/
|
|
320
391
|
describe("core_information_scope — safe_locations ratified (2026-09-08)", () => {
|
|
321
392
|
const raw = JSON.parse(
|
|
322
|
-
readFileSync(path.join(cvcDir, "coreInformationScope.v1.
|
|
393
|
+
readFileSync(path.join(cvcDir, "coreInformationScope.v1.1.0.json"), "utf8"),
|
|
323
394
|
) as { _status: string; entries: (Entry & { title: string; definition: string })[] };
|
|
324
395
|
const unit = raw.entries.find((e) => e.key === "safe_locations");
|
|
325
396
|
|
|
@@ -337,3 +408,211 @@ describe("core_information_scope — safe_locations ratified (2026-09-08)", () =
|
|
|
337
408
|
expect(raw._status).toContain("`safe_locations` is CANON");
|
|
338
409
|
});
|
|
339
410
|
});
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Narrative notes — canon CVC-236 amendment 2026-10-05 (NARRATIVE-NOTES,
|
|
414
|
+
* signed Spec v2 rule 5, Crysta; prototype `data/cvcs/
|
|
415
|
+
* core_information_scope.yaml` @ 9ef79748, lines 445-467). The category now
|
|
416
|
+
* offers two units, Session summary and Session & case notes; `screen_notes`
|
|
417
|
+
* and `background` are listed in `retired_units`. Canon lists session_summary
|
|
418
|
+
* FIRST, but codes follow the generator's frozen ledger, so no published
|
|
419
|
+
* ordinal moves and no retired ordinal is reused.
|
|
420
|
+
*/
|
|
421
|
+
describe("core_information_scope — narrative notes (2026-10-05)", () => {
|
|
422
|
+
const raw = JSON.parse(
|
|
423
|
+
readFileSync(path.join(cvcDir, "coreInformationScope.v1.1.0.json"), "utf8"),
|
|
424
|
+
) as { entries: (Entry & { title: string; definition: string })[] };
|
|
425
|
+
const rawByKey = new Map(raw.entries.map((e) => [e.key, e]));
|
|
426
|
+
const notes = byKey.get("notes");
|
|
427
|
+
|
|
428
|
+
it("keeps screen_notes and background as RETIRED tombstones at their published codes", () => {
|
|
429
|
+
for (const [key, code, title] of [
|
|
430
|
+
["screen_notes", "236-005-001-000-000-000-000", "Screen notes"],
|
|
431
|
+
["background", "236-005-003-000-000-000-000", "Background information"],
|
|
432
|
+
] as const) {
|
|
433
|
+
const t = rawByKey.get(key);
|
|
434
|
+
expect(t?.code, key).toBe(code);
|
|
435
|
+
expect(t?.title, key).toBe(title);
|
|
436
|
+
expect(t?.retired, key).toBe(true);
|
|
437
|
+
expect(t?.selectable, key).toBe(false);
|
|
438
|
+
expect(t?.parentCode, key).toBe(notes?.code);
|
|
439
|
+
expect(t?.childCodes, key).toEqual([]);
|
|
440
|
+
expect(t?.definition, key).toMatch(/^RETIRED 2026-10-05 /);
|
|
441
|
+
expect(t?.definition, key).toContain("includes nothing");
|
|
442
|
+
// Nothing left to share or view: no decision attributes a picker or a
|
|
443
|
+
// share builder could act on.
|
|
444
|
+
for (const attr of [
|
|
445
|
+
"shareableDefault",
|
|
446
|
+
"levelFloor",
|
|
447
|
+
"appRelevance",
|
|
448
|
+
"specialDataType",
|
|
449
|
+
"platformFloor",
|
|
450
|
+
"required",
|
|
451
|
+
] as const) {
|
|
452
|
+
expect(t?.[attr], `${key}.${attr}`).toBeUndefined();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it("keeps case_notes at 236-005-002 under canon's new label", () => {
|
|
458
|
+
const u = rawByKey.get("case_notes");
|
|
459
|
+
expect(u?.code).toBe("236-005-002-000-000-000-000");
|
|
460
|
+
expect(u?.title).toBe("Session & case notes");
|
|
461
|
+
expect(u?.selectable).toBe(true);
|
|
462
|
+
expect(u?.retired).toBeUndefined();
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it("APPENDS session_summary at 236-005-004 — never at a retired slot", () => {
|
|
466
|
+
const u = rawByKey.get("session_summary");
|
|
467
|
+
expect(u?.code).toBe("236-005-004-000-000-000-000");
|
|
468
|
+
expect(u?.title).toBe("Session summary");
|
|
469
|
+
expect(u?.selectable).toBe(true);
|
|
470
|
+
expect(u?.parentCode).toBe(notes?.code);
|
|
471
|
+
expect(u?.shareableDefault).toBe(true);
|
|
472
|
+
expect(u?.levelFloor).toBe(3);
|
|
473
|
+
expect(u?.specialDataType).toBe("survivor_confidential");
|
|
474
|
+
expect(u?.appRelevance).toEqual(["PAVE", "Thread"]);
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
it("lists the category's children in code order, tombstones included, two of them live", () => {
|
|
478
|
+
expect(notes?.childCodes).toEqual([
|
|
479
|
+
"236-005-001-000-000-000-000",
|
|
480
|
+
"236-005-002-000-000-000-000",
|
|
481
|
+
"236-005-003-000-000-000-000",
|
|
482
|
+
"236-005-004-000-000-000-000",
|
|
483
|
+
]);
|
|
484
|
+
const liveKids = (notes?.childCodes ?? [])
|
|
485
|
+
.map((c) => byCode.get(c))
|
|
486
|
+
.filter((e) => e?.selectable === true)
|
|
487
|
+
.map((e) => e?.key);
|
|
488
|
+
expect(liveKids).toEqual(["case_notes", "session_summary"]);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it("tombstones only what canon retired — no other unit in the domain is retired", () => {
|
|
492
|
+
expect(tombstones.map((t) => t.key).sort()).toEqual(["background", "screen_notes"]);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* OFFENDER-SYSTEM-UNITS-THREAD — canon CVC-236 amendment 2026-10-01 (Crysta
|
|
498
|
+
* R1; prototype `data/cvcs/core_information_scope.yaml` @ 0247b654, carried
|
|
499
|
+
* by the 9ef79748 regeneration at lines 407-410). Thread captures perpetrator
|
|
500
|
+
* records and protection orders, so both risk units now list Thread. Codes
|
|
501
|
+
* and posture are unchanged; only app relevance and wording moved.
|
|
502
|
+
*/
|
|
503
|
+
describe("core_information_scope — Thread joins offender + system units (2026-10-01)", () => {
|
|
504
|
+
it("lists Thread on offender_facilitator and system_involvement, codes unchanged", () => {
|
|
505
|
+
const off = byKey.get("offender_facilitator");
|
|
506
|
+
const sys = byKey.get("system_involvement");
|
|
507
|
+
expect(off?.code).toBe("236-002-015-000-000-000-000");
|
|
508
|
+
expect(off?.appRelevance).toEqual(["PAVE", "Thread", "LEADS"]);
|
|
509
|
+
expect(sys?.code).toBe("236-002-016-000-000-000-000");
|
|
510
|
+
expect(sys?.appRelevance).toEqual(["PAVE", "Thread"]);
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* SOT v1.1.0 supersedes v1.0.0 (ADR-CVC-0.8.13 Addendum 2026-10-05): the
|
|
516
|
+
* narrative-notes change is not additive — two published units lost
|
|
517
|
+
* `selectable` and `case_notes` was narrowed — so it cannot reuse 1.0.0
|
|
518
|
+
* under the seeder's §9.1.2 content-drift guard. `_supersedes` is the house
|
|
519
|
+
* shape (victimAbuseTypes / incidentParticipationRoles v1.1.0).
|
|
520
|
+
*/
|
|
521
|
+
describe("core_information_scope — v1.1.0 supersedes v1.0.0", () => {
|
|
522
|
+
const env = JSON.parse(
|
|
523
|
+
readFileSync(path.join(cvcDir, "coreInformationScope.v1.1.0.json"), "utf8"),
|
|
524
|
+
) as {
|
|
525
|
+
version: string;
|
|
526
|
+
_supersedes: {
|
|
527
|
+
version: string;
|
|
528
|
+
keyMap: Record<string, string>;
|
|
529
|
+
retiredCodes: unknown[];
|
|
530
|
+
notes: Record<string, string>;
|
|
531
|
+
};
|
|
532
|
+
entries: Entry[];
|
|
533
|
+
};
|
|
534
|
+
const sup = env._supersedes;
|
|
535
|
+
|
|
536
|
+
it("is version 1.1.0, superseding 1.0.0, with no code withdrawn", () => {
|
|
537
|
+
expect(env.version).toBe("1.1.0");
|
|
538
|
+
expect(sup.version).toBe("1.0.0");
|
|
539
|
+
// Tombstones keep their codes, so nothing is withdrawn.
|
|
540
|
+
expect(sup.retiredCodes).toEqual([]);
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
it("maps every v1.0.0 key to itself — every key but the one added", () => {
|
|
544
|
+
const keys = env.entries.map((e) => e.key);
|
|
545
|
+
expect(Object.keys(sup.keyMap)).toEqual(keys.filter((k) => k !== "session_summary"));
|
|
546
|
+
expect(Object.keys(sup.keyMap)).toHaveLength(72);
|
|
547
|
+
for (const [from, to] of Object.entries(sup.keyMap)) expect(to, from).toBe(from);
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
it("notes each retirement and the case_notes narrowing", () => {
|
|
551
|
+
expect(Object.keys(sup.notes).sort()).toEqual([
|
|
552
|
+
"background",
|
|
553
|
+
"case_notes",
|
|
554
|
+
"screen_notes",
|
|
555
|
+
"summary",
|
|
556
|
+
]);
|
|
557
|
+
for (const k of ["screen_notes", "background"]) {
|
|
558
|
+
expect(sup.notes[k], k).toContain("NO successor key");
|
|
559
|
+
expect(sup.notes[k], k).toContain("includes nothing");
|
|
560
|
+
}
|
|
561
|
+
expect(sup.notes["case_notes"]).toContain("reads NARROWER");
|
|
562
|
+
expect(sup.notes["case_notes"]).toContain("no longer includes the session summary");
|
|
563
|
+
expect(sup.notes["summary"]).toContain("`session_summary` (236-005-004)");
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
it("leaves no v1.0.0 file behind for the registry to resolve", () => {
|
|
567
|
+
expect(() => readFileSync(path.join(cvcDir, "coreInformationScope.v1.0.0.json"))).toThrow();
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* roi_scope v1.2.0 supersedes v1.1.0 (co-bwc; ADR-CVC-0.8.13 Addendum
|
|
573
|
+
* 2026-10-05): tombstoning screen_notes / background to match CVC-236 v1.1.0
|
|
574
|
+
* takes `selectable` away from two published items, which is not additive.
|
|
575
|
+
* The superseded file was named `roiScope.v1.0.0.json` but declared 1.1.0;
|
|
576
|
+
* the declared version is the one superseded.
|
|
577
|
+
*/
|
|
578
|
+
describe("roi_scope — v1.2.0 supersedes v1.1.0", () => {
|
|
579
|
+
const env = JSON.parse(
|
|
580
|
+
readFileSync(path.join(cvcDir, "roiScope.v1.2.0.json"), "utf8"),
|
|
581
|
+
) as {
|
|
582
|
+
version: string;
|
|
583
|
+
_supersedes: {
|
|
584
|
+
version: string;
|
|
585
|
+
keyMap: Record<string, string>;
|
|
586
|
+
retiredCodes: unknown[];
|
|
587
|
+
notes: Record<string, string>;
|
|
588
|
+
};
|
|
589
|
+
entries: Entry[];
|
|
590
|
+
};
|
|
591
|
+
const sup = env._supersedes;
|
|
592
|
+
|
|
593
|
+
it("is version 1.2.0, superseding 1.1.0, with no code withdrawn", () => {
|
|
594
|
+
expect(env.version).toBe("1.2.0");
|
|
595
|
+
expect(sup.version).toBe("1.1.0");
|
|
596
|
+
expect(sup.retiredCodes).toEqual([]);
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
it("maps every v1.1.0 key to itself — nothing added, nothing renamed", () => {
|
|
600
|
+
expect(Object.keys(sup.keyMap)).toEqual(env.entries.map((e) => e.key));
|
|
601
|
+
expect(Object.keys(sup.keyMap)).toHaveLength(31);
|
|
602
|
+
for (const [from, to] of Object.entries(sup.keyMap)) expect(to, from).toBe(from);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
it("notes each retirement, citing the CVC-236 twin", () => {
|
|
606
|
+
expect(Object.keys(sup.notes).sort()).toEqual(["background", "screen_notes", "summary"]);
|
|
607
|
+
for (const k of ["screen_notes", "background"]) {
|
|
608
|
+
expect(sup.notes[k], k).toContain("NO successor key");
|
|
609
|
+
expect(sup.notes[k], k).toContain("includes nothing");
|
|
610
|
+
expect(sup.notes[k], k).toContain("CVC-236 v1.1.0 retired the same key");
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it("leaves no superseded file behind for the registry to resolve", () => {
|
|
615
|
+
expect(() => readFileSync(path.join(cvcDir, "roiScope.v1.0.0.json"))).toThrow();
|
|
616
|
+
expect(() => readFileSync(path.join(cvcDir, "roiScope.v1.1.0.json"))).toThrow();
|
|
617
|
+
});
|
|
618
|
+
});
|
|
@@ -646,14 +646,17 @@ const SOT_SPECS: readonly SotSpec[] = [
|
|
|
646
646
|
// fields) + 4 missingness = 9
|
|
647
647
|
// ─── 0.8.12 vocabulary batch ───
|
|
648
648
|
// CANONICAL Notion CVC-133 `core - functions` (verified v1.0): 77 functions
|
|
649
|
-
// +
|
|
650
|
-
|
|
649
|
+
// + note_open_departed_author (133-078, appended 2026-10-05, Narrative notes
|
|
650
|
+
// Spec v2 rule 10; SOT v1.1.0, additive) + 4 missingness = 82
|
|
651
|
+
{ file: "coreFunctions.v1.1.0.json", domain: "core_functions", expectedCount: 82 },
|
|
651
652
|
// 9 fine-grained Needs-Assessment CAR change types (@pave/domain
|
|
652
653
|
// NEEDS_ASSESSMENT_CHANGE_TYPES, casing normalized to lower_snake) + 4 = 13
|
|
653
654
|
{ file: "needsAssessmentChangeType.v1.0.0.json", domain: "needs_assessment_change_type", expectedCount: 13 },
|
|
654
|
-
//
|
|
655
|
-
//
|
|
656
|
-
|
|
655
|
+
// 27 ROI scope items (25 live + 2 RETIRED tombstones: screen_notes 983-012,
|
|
656
|
+
// background 983-014, retired 2026-10-05 to match CVC-236 v1.1.0 — codes
|
|
657
|
+
// kept, never reused) + 4 missingness = 31. SOT v1.2.0 (supersedes 1.1.0:
|
|
658
|
+
// the retirements are not additive; co-bwc).
|
|
659
|
+
{ file: "roiScope.v1.2.0.json", domain: "roi_scope", expectedCount: 31 },
|
|
657
660
|
// 5 stored-ROI lifecycle states (@pave/domain ROI_STATUSES) + 4 = 9
|
|
658
661
|
{ file: "roiStatus.v1.0.0.json", domain: "roi_status", expectedCount: 9 },
|
|
659
662
|
// 2 HMIS FY2026 "P2 Referrals Provided" outcomes (attained / not_attained)
|
|
@@ -736,15 +739,19 @@ const SOT_SPECS: readonly SotSpec[] = [
|
|
|
736
739
|
// 3 substantive age bands (@pave/domain AGE_BANDS_AT_EVENT minus `unknown`,
|
|
737
740
|
// which maps to the missingness sentinel) + 4 missingness = 7
|
|
738
741
|
{ file: "minorAdultStatus.v1.0.0.json", domain: "minor_adult_status", expectedCount: 7 },
|
|
739
|
-
// CVC-236 — 12 policy-grain categories +
|
|
742
|
+
// CVC-236 — 12 policy-grain categories + 55 live authorization-grain units
|
|
740
743
|
// (priorities_safety, 236-003-003, added 2026-09-29; encounter_location,
|
|
741
|
-
// 236-003-004, added 2026-10-01
|
|
742
|
-
//
|
|
743
|
-
//
|
|
744
|
-
|
|
745
|
-
|
|
744
|
+
// 236-003-004, added 2026-10-01; session_summary, 236-005-004, added
|
|
745
|
+
// 2026-10-05) + 2 RETIRED tombstones (screen_notes 236-005-001, background
|
|
746
|
+
// 236-005-003, retired 2026-10-05 — codes kept, never reused) + 1
|
|
747
|
+
// missingness root + 3 workspace-standard missingness children = 73.
|
|
748
|
+
// SOT v1.1.0 (supersedes 1.0.0: the retirements + the case_notes narrowing
|
|
749
|
+
// are not additive). Generated by scripts/gen-core-information-scope.py;
|
|
750
|
+
// codes are FROZEN there.
|
|
751
|
+
{
|
|
752
|
+
file: "coreInformationScope.v1.1.0.json",
|
|
746
753
|
domain: "core_information_scope",
|
|
747
|
-
expectedCount:
|
|
754
|
+
expectedCount: 73,
|
|
748
755
|
},
|
|
749
756
|
] as const;
|
|
750
757
|
|
|
@@ -78,7 +78,7 @@ describe("parseCvcStatus", () => {
|
|
|
78
78
|
expect(result.sourcePath).toBeNull();
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
it("flags the self-contradictory core_functions case as ambiguous, generically — not a special case for this one domain (src/cvcs/coreFunctions.v1.
|
|
81
|
+
it("flags the self-contradictory core_functions case as ambiguous, generically — not a special case for this one domain (src/cvcs/coreFunctions.v1.1.0.json)", () => {
|
|
82
82
|
const result = parseCvcStatus({
|
|
83
83
|
_status:
|
|
84
84
|
"DRAFTED — NEEDS REVIEW: canonical Notion CVC-133 (core - functions), verified v1.0, " +
|
|
@@ -182,9 +182,9 @@ const SOT_FILES: readonly SotFile[] = [
|
|
|
182
182
|
// ─── Risk taxonomy (names-only projection of the @hti/scoring SOT) ───
|
|
183
183
|
{ file: "riskCategory.v1.0.0.json", expectedDomain: "risk_category" },
|
|
184
184
|
// ─── 0.8.12 vocabulary batch ───
|
|
185
|
-
{ file: "coreFunctions.v1.
|
|
185
|
+
{ file: "coreFunctions.v1.1.0.json", expectedDomain: "core_functions" },
|
|
186
186
|
{ file: "needsAssessmentChangeType.v1.0.0.json", expectedDomain: "needs_assessment_change_type" },
|
|
187
|
-
{ file: "roiScope.v1.
|
|
187
|
+
{ file: "roiScope.v1.2.0.json", expectedDomain: "roi_scope" },
|
|
188
188
|
{ file: "roiStatus.v1.0.0.json", expectedDomain: "roi_status" },
|
|
189
189
|
{ file: "coreReferralOutcome.v1.0.0.json", expectedDomain: "core_referral_outcome" },
|
|
190
190
|
{ file: "assertionDomain.v1.1.0.json", expectedDomain: "assertion_domain" },
|
|
@@ -235,7 +235,7 @@ const SOT_FILES: readonly SotFile[] = [
|
|
|
235
235
|
{ file: "suggestionSource.v1.0.0.json", expectedDomain: "suggestion_source" },
|
|
236
236
|
// CVC-236 — generated by scripts/gen-core-information-scope.py. Omitted from
|
|
237
237
|
// this list since it was authored; added with the priorities_safety unit.
|
|
238
|
-
{ file: "coreInformationScope.v1.
|
|
238
|
+
{ file: "coreInformationScope.v1.1.0.json", expectedDomain: "core_information_scope" },
|
|
239
239
|
// ─── GDR §10.1 CAR-contract vocabularies (provisional 900-block; PAVE
|
|
240
240
|
// @pave/domain verbatim; bead pv-pgdr-cvc-source-gdr-10-1-bulk-publish). ───
|
|
241
241
|
{ file: "assertionStatus.v1.0.0.json", expectedDomain: "assertion_status" },
|
|
@@ -49,7 +49,7 @@ const read = (f: string): { entries: Entry[]; _source?: string } =>
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const lt = read("locationType.v1.0.0.json");
|
|
52
|
-
const scope = read("coreInformationScope.v1.
|
|
52
|
+
const scope = read("coreInformationScope.v1.1.0.json");
|
|
53
53
|
const byKey = new Map(lt.entries.map((e) => [e.key, e]));
|
|
54
54
|
const scopeByKey = new Map(scope.entries.map((e) => [e.key, e]));
|
|
55
55
|
const reasons = lt.entries.filter((e) => e.key !== "missingness_root");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"domain": "core_functions",
|
|
3
3
|
"name": "Core Functions",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"_status": "DRAFTED — NEEDS REVIEW: canonical Notion CVC-133 (core - functions), verified v1.0, ported verbatim from the Notion codebook. Canonical numbering (133), NOT provisional. Per-entry lifecycle Status (v1 / future / not-started) is carried in each definition.",
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"_status": "DRAFTED — NEEDS REVIEW: canonical Notion CVC-133 (core - functions), verified v1.0, ported verbatim from the Notion codebook. Canonical numbering (133), NOT provisional. Per-entry lifecycle Status (v1 / future / not-started) is carried in each definition. VERSION 1.1.0 (additive; ADR-CVC-0.8.13 Addendum 2026-10-05): APPENDS `note_open_departed_author` at 133-078 (added 2026-10-05 while building the Narrative notes Spec v2, rule 10; canon's own logic_notes mark the row as awaiting steward review (Crysta); canon `data/cvcs/core_functions.yaml` L68-93 @ prototype 9ef79748, unchanged at fed744f3, and the codebook_all.csv export). Default Off for Account Admin (MEM-ADM) only; bounds are not carried by this entry schema. Every 1.0.0 code and key is unchanged. Canon carries 112 functions; this SOT carries 78 — the other 34 canon rows are a separate absorb, not taken here.",
|
|
6
6
|
"_source": "Notion CVC-133 core - functions (collection://3211ef14-abcd-8024-867d-000be4b35a79)",
|
|
7
7
|
"levels": {
|
|
8
8
|
"0": "Unknown or Missing",
|
|
@@ -741,6 +741,15 @@
|
|
|
741
741
|
"parentCode": null,
|
|
742
742
|
"childCodes": [],
|
|
743
743
|
"definition": "Create, invite, deactivate, and manage user accounts within a member account or platform context. [Status: Defined; existing PAVE function. Platform: PLATFORM. User-relevant: no. Admin-relevant: yes. Category: Identity & access administration, Platform administration (HTI-only).]"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"code": "133-078-000-000-000-000-000",
|
|
747
|
+
"key": "note_open_departed_author",
|
|
748
|
+
"title": "Open a deactivated author's private notes",
|
|
749
|
+
"selectable": true,
|
|
750
|
+
"parentCode": null,
|
|
751
|
+
"childCodes": [],
|
|
752
|
+
"definition": "Move a deactivated author's \"Private to me\" notes to \"Our account only\", so the account can read notes whose author no longer has an account. The admin cannot read a note before opening it and cannot move it any further. [Status: Defined; new function. Platform: PAVE, THREAD. User-relevant: no. Admin-relevant: yes. Category: Account administration (member admin).]"
|
|
744
753
|
}
|
|
745
754
|
]
|
|
746
755
|
}
|