@htilabs/platform-common-models 0.19.0 → 0.20.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/cvcs/index.cjs +4769 -643
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +5036 -606
- package/dist/cvcs/index.d.ts +5036 -606
- package/dist/cvcs/index.js +4769 -643
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +74 -1
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +77 -4
- package/dist/enums/index.d.ts +77 -4
- package/dist/enums/index.js +74 -1
- package/dist/enums/index.js.map +1 -1
- package/dist/index.cjs +5199 -588
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5189 -588
- package/dist/index.js.map +1 -1
- package/dist/information-scope/index.cjs +440 -0
- package/dist/information-scope/index.cjs.map +1 -0
- package/dist/information-scope/index.d.cts +313 -0
- package/dist/information-scope/index.d.ts +313 -0
- package/dist/information-scope/index.js +404 -0
- package/dist/information-scope/index.js.map +1 -0
- package/dist/services/index.cjs +414 -2
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +403 -1
- package/dist/services/index.js.map +1 -1
- package/package.json +32 -26
- package/src/__tests__/__snapshots__/cvc-sot.snap +3 -3
- package/src/__tests__/core-information-scope-invariant.test.ts +709 -456
- package/src/__tests__/cvc-sot-snapshot.test.ts +16 -17
- package/src/__tests__/cvc-structural.test.ts +2 -2
- package/src/__tests__/location-type-routing-invariant.test.ts +25 -8
- package/src/cvcs/coreInformationScope.v2.0.0.json +5396 -0
- package/src/cvcs/index.ts +2 -2
- package/src/cvcs/roiScope.v1.3.0.json +360 -0
- package/src/generated/cvc-enums.ts +77 -4
- package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v4.migrations.csv +106 -0
- package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v4.rows.csv +117 -0
- package/src/services/__tests__/fixtures/infoscope-v4/loadInfoscopeV4Fixtures.ts +116 -0
- package/src/services/__tests__/informationScopeResolver.test.ts +964 -0
- package/src/services/index.ts +10 -3
- package/src/services/informationScope.ts +10 -0
- package/src/services/informationScopeResolver.ts +672 -0
- package/src/services/informationScopeSot.ts +161 -0
- package/src/cvcs/coreInformationScope.v1.1.0.json +0 -1290
- package/src/cvcs/roiScope.v1.2.0.json +0 -340
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CORE INFORMATION SCOPE (CVC-236) — the invariants adoption depends on
|
|
3
|
-
*
|
|
2
|
+
* CORE INFORMATION SCOPE (CVC-236) — the v4 tree and the invariants adoption depends on
|
|
3
|
+
* =====================================================================================
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* SOT v2.0.0 absorbs the canonical CVC-236 v4 tree (prototype
|
|
6
|
+
* `core_information_scope.v4.draft.yaml`, signed 2026-10-09; developer handoff
|
|
7
|
+
* `docs/share-roi/INFOSCOPE_V4_DEV_HANDOFF_2026-10-09.md`):
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* System metadata · Narrative notes · Primary client / case subject
|
|
10
|
+
* (8 categories → sub-categories → 28 instrument rows / 1 rest row) ·
|
|
11
|
+
* Other named persons (3 person types × the same categories) · 4 LEADS
|
|
12
|
+
* categories beside the top layer.
|
|
13
|
+
*
|
|
14
|
+
* Two vocabularies still describe stored consent:
|
|
11
15
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* only as the stored-data provenance check. That move is safe for exactly one reason:
|
|
15
|
-
* every substantive `roi_scope` key survives here, spelled identically, so a
|
|
16
|
-
* stored ROI keeps its exact recorded meaning. That is not a nice-to-have — an
|
|
17
|
-
* ROI whose meaning widens is a CONSENT change wearing a data change's clothes,
|
|
18
|
-
* and one already shipped on the CaseShare lane when a coarse->granular table
|
|
19
|
-
* expanded `caseNotes` to include screening notes the survivor never authorized.
|
|
16
|
+
* `roi_scope` LEGACY flat item vocabulary, 27 substantive keys
|
|
17
|
+
* `core_information_scope` the tree above (115 live rows + 27 RETIRED tombstones)
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* Stored ROIs and shares were written against both. Adoption stays a
|
|
20
|
+
* MIGRATION, not a re-consent, because (a) every published key is still an
|
|
21
|
+
* entry here, at its published code, and (b) a key the tree no longer
|
|
22
|
+
* carries is a tombstone whose v4 reading is canon's from-to table — read at
|
|
23
|
+
* READ time, never by rewriting the stored list (handoff § 3).
|
|
23
24
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Codes are identifiers, not tree paths: every v1.1.0 code is byte-identical
|
|
26
|
+
* although six published categories (identifying, risk, contact, services,
|
|
27
|
+
* health_accommodation, immigration_legal_status) now sit under
|
|
28
|
+
* `primary_client`. The
|
|
29
|
+
* tree is `parentCode` / `childCodes`.
|
|
27
30
|
*/
|
|
28
31
|
|
|
29
32
|
import { readFileSync } from "node:fs";
|
|
@@ -38,182 +41,108 @@ const cvcDir = path.join(here, "..", "cvcs");
|
|
|
38
41
|
interface Entry {
|
|
39
42
|
code: string;
|
|
40
43
|
key: string;
|
|
44
|
+
title: string;
|
|
45
|
+
definition: string | null;
|
|
41
46
|
selectable: boolean;
|
|
42
47
|
parentCode: string | null;
|
|
48
|
+
parentKey: string | null;
|
|
43
49
|
childCodes: string[];
|
|
50
|
+
childKeys: string[];
|
|
51
|
+
canonicalCode?: string;
|
|
52
|
+
rowType?: string;
|
|
53
|
+
depth?: number;
|
|
54
|
+
kindBranch?: string | null;
|
|
55
|
+
apps?: { pave: boolean; thread: boolean; leads: boolean };
|
|
44
56
|
shareableDefault?: boolean;
|
|
45
|
-
required?: boolean;
|
|
46
57
|
platformFloor?: boolean;
|
|
47
58
|
levelFloor?: number;
|
|
48
|
-
appRelevance?: string[];
|
|
49
59
|
specialDataType?: string;
|
|
60
|
+
status?: string;
|
|
61
|
+
replacesV3?: string[];
|
|
62
|
+
required?: boolean;
|
|
63
|
+
kindRow?: string;
|
|
64
|
+
instrument?: string;
|
|
65
|
+
part?: string;
|
|
50
66
|
retired?: boolean;
|
|
67
|
+
successors?: string[];
|
|
68
|
+
successorCodes?: string[];
|
|
69
|
+
restrictionSuccessors?: string[];
|
|
70
|
+
restrictionSuccessorCodes?: string[];
|
|
71
|
+
migrationRule?: string;
|
|
51
72
|
}
|
|
52
73
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const byCode = new Map(scope.entries.map((e) => [e.code, e]));
|
|
63
|
-
const MISSINGNESS = new Set([
|
|
64
|
-
"missingness_root",
|
|
65
|
-
"unknown",
|
|
66
|
-
"anonymous",
|
|
67
|
-
"data_not_collected",
|
|
68
|
-
]);
|
|
69
|
-
|
|
70
|
-
const isMissingness = (e: Entry): boolean =>
|
|
71
|
-
MISSINGNESS.has(e.key) ||
|
|
72
|
-
(e.parentCode !== null && byCode.get(e.parentCode)?.key === "missingness_root");
|
|
73
|
-
|
|
74
|
-
const categories = scope.entries.filter(
|
|
75
|
-
(e) => e.parentCode === null && !isMissingness(e),
|
|
76
|
-
);
|
|
77
|
-
/** Every L2 row: live units AND retired tombstones. */
|
|
78
|
-
const allUnits = scope.entries.filter(
|
|
79
|
-
(e) => e.parentCode !== null && !isMissingness(e),
|
|
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);
|
|
85
|
-
|
|
86
|
-
describe("core_information_scope — adoption invariants", () => {
|
|
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));
|
|
93
|
-
const missing = roiSubstantive.filter((k) => !unitKeys.has(k));
|
|
94
|
-
|
|
95
|
-
// A failure here means a stored ROI can no longer be expressed in the new
|
|
96
|
-
// vocabulary — re-consent, not migration.
|
|
97
|
-
expect(missing).toEqual([]);
|
|
98
|
-
expect(roiSubstantive.length).toBe(27);
|
|
99
|
-
});
|
|
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
|
-
|
|
153
|
-
it("is a strict superset — the additions are additions, not renames", () => {
|
|
154
|
-
expect(units.length).toBeGreaterThan(27);
|
|
155
|
-
expect(units).toHaveLength(55);
|
|
156
|
-
expect(tombstones).toHaveLength(2);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("keeps the two grains distinct: categories decide policy, units carry consent", () => {
|
|
160
|
-
expect(categories).toHaveLength(12);
|
|
161
|
-
expect(categories.every((c) => c.selectable === false)).toBe(true);
|
|
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);
|
|
166
|
-
});
|
|
167
|
-
|
|
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) {
|
|
173
|
-
const parent = byCode.get(u.parentCode as string);
|
|
174
|
-
expect(parent, `unit ${u.key} has a dangling parent`).toBeDefined();
|
|
175
|
-
expect(parent?.selectable, `unit ${u.key} hangs off a selectable row`).toBe(
|
|
176
|
-
false,
|
|
177
|
-
);
|
|
178
|
-
expect(parent?.childCodes, `category ${parent?.key} disowns ${u.key}`).toContain(
|
|
179
|
-
u.code,
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
expect(categories.flatMap((c) => c.childCodes)).toHaveLength(allUnits.length);
|
|
183
|
-
});
|
|
74
|
+
interface MigrationLine {
|
|
75
|
+
from: string;
|
|
76
|
+
fromCode: string;
|
|
77
|
+
rule: string;
|
|
78
|
+
to: string[];
|
|
79
|
+
toCodes: string[];
|
|
80
|
+
note: string;
|
|
81
|
+
widens: boolean;
|
|
82
|
+
}
|
|
184
83
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
84
|
+
interface Envelope {
|
|
85
|
+
version: string;
|
|
86
|
+
scopeVersion?: number;
|
|
87
|
+
_status: string;
|
|
88
|
+
_source: string;
|
|
89
|
+
_supersedes: {
|
|
90
|
+
version: string;
|
|
91
|
+
keyMap: Record<string, string>;
|
|
92
|
+
retiredCodes: unknown[];
|
|
93
|
+
notes: Record<string, string>;
|
|
94
|
+
};
|
|
95
|
+
levels: Record<string, string>;
|
|
96
|
+
migrations: {
|
|
97
|
+
stampKey: string;
|
|
98
|
+
fromVersion: number;
|
|
99
|
+
toVersion: number;
|
|
100
|
+
readAt: string;
|
|
101
|
+
unstamped: string;
|
|
102
|
+
rules: Record<string, string>;
|
|
103
|
+
table: MigrationLine[];
|
|
104
|
+
};
|
|
105
|
+
entries: Entry[];
|
|
106
|
+
}
|
|
188
107
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"federal_protection_applications",
|
|
192
|
-
"hiv_status",
|
|
193
|
-
"immigration_status",
|
|
194
|
-
"le_report_status",
|
|
195
|
-
"safe_locations",
|
|
196
|
-
"tvap_enrollment",
|
|
197
|
-
"uscis_alien_number",
|
|
198
|
-
]);
|
|
108
|
+
const read = (f: string): Envelope =>
|
|
109
|
+
JSON.parse(readFileSync(path.join(cvcDir, f), "utf8")) as Envelope;
|
|
199
110
|
|
|
200
|
-
|
|
201
|
-
|
|
111
|
+
const scope = read("coreInformationScope.v2.0.0.json");
|
|
112
|
+
const roi = read("roiScope.v1.3.0.json");
|
|
202
113
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
114
|
+
const byCode = new Map(scope.entries.map((e) => [e.code, e]));
|
|
115
|
+
const byKey = new Map(scope.entries.map((e) => [e.key, e]));
|
|
116
|
+
const MISSINGNESS = new Set(["missingness_root", "unknown", "anonymous", "data_not_collected"]);
|
|
117
|
+
const isMissingness = (e: Entry): boolean => MISSINGNESS.has(e.key);
|
|
118
|
+
|
|
119
|
+
const rows = scope.entries.filter((e) => !isMissingness(e));
|
|
120
|
+
/** The live v4 tree. */
|
|
121
|
+
const live = rows.filter((e) => e.retired !== true);
|
|
122
|
+
/** Retired tombstones — resolvable by code, never offered. */
|
|
123
|
+
const tombstones = rows.filter((e) => e.retired === true);
|
|
124
|
+
const liveKey = (k: string): Entry | undefined => {
|
|
125
|
+
const e = byKey.get(k);
|
|
126
|
+
return e && e.retired !== true ? e : undefined;
|
|
127
|
+
};
|
|
128
|
+
const ancestors = (e: Entry): Entry[] => {
|
|
129
|
+
const out: Entry[] = [];
|
|
130
|
+
let p = e.parentCode;
|
|
131
|
+
while (p !== null) {
|
|
132
|
+
const parent = byCode.get(p);
|
|
133
|
+
if (!parent) break;
|
|
134
|
+
out.push(parent);
|
|
135
|
+
p = parent.parentCode;
|
|
136
|
+
}
|
|
137
|
+
return out;
|
|
138
|
+
};
|
|
139
|
+
const seg = (n: number): string => String(n).padStart(3, "0");
|
|
140
|
+
const codeOf = (...segs: number[]): string =>
|
|
141
|
+
["236", ...[...segs, 0, 0, 0, 0, 0, 0].slice(0, 6).map(seg)].join("-");
|
|
142
|
+
const sortedKeys = (es: Entry[]): string[] => es.map((e) => e.key).sort();
|
|
207
143
|
|
|
208
|
-
/**
|
|
209
|
-
|
|
210
|
-
* reorder or mid-list insertion would silently renumber codes already stored
|
|
211
|
-
* on ROIs and shares. The generator refuses that (its FROZEN table); this pins
|
|
212
|
-
* the same published assignment from the consumer side, so a hand-edit or a
|
|
213
|
-
* generator change that renumbers fails here too. New units APPEND inside
|
|
214
|
-
* their category; new categories APPEND at the end. Never reorder this table.
|
|
215
|
-
*/
|
|
216
|
-
const PUBLISHED: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
144
|
+
/** What v1.1.0 published, by category slot, in ordinal order. Never reorder. */
|
|
145
|
+
const PUBLISHED_V1_1_0: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
217
146
|
["identifying", ["names", "dob", "addresses", "additional_ids", "demographics"]],
|
|
218
147
|
[
|
|
219
148
|
"risk",
|
|
@@ -239,8 +168,6 @@ const PUBLISHED: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
|
239
168
|
],
|
|
240
169
|
["contact", ["contact_info", "safe_locations", "priorities_safety", "encounter_location"]],
|
|
241
170
|
["services", ["contact_history", "service_history", "plans_goals"]],
|
|
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
171
|
["notes", ["screen_notes", "case_notes", "background", "session_summary"]],
|
|
245
172
|
[
|
|
246
173
|
"health_accommodation",
|
|
@@ -272,209 +199,588 @@ const PUBLISHED: ReadonlyArray<readonly [string, readonly string[]]> = [
|
|
|
272
199
|
["investigative_work_product", ["case_determinations", "case_lifecycle", "case_attachments"]],
|
|
273
200
|
["object_identifiers", ["phone_identifiers", "object_identity_attributes"]],
|
|
274
201
|
];
|
|
202
|
+
const V1_1_0_KEYS = [
|
|
203
|
+
...MISSINGNESS,
|
|
204
|
+
...PUBLISHED_V1_1_0.flatMap(([c, us]) => [c, ...us]),
|
|
205
|
+
];
|
|
275
206
|
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
207
|
+
/** The v2.0.0 appends: [key, code]. Append-only. */
|
|
208
|
+
const APPENDED_V2_0_0: ReadonlyArray<readonly [string, string]> = [
|
|
209
|
+
["identifying__other", codeOf(1, 6)],
|
|
210
|
+
["health_status", codeOf(6, 10)],
|
|
211
|
+
["immigration_applications", codeOf(7, 6)],
|
|
212
|
+
["instruments", codeOf(13)],
|
|
213
|
+
["instrument_summary", codeOf(13, 1)],
|
|
214
|
+
["instrument_full", codeOf(13, 2)],
|
|
215
|
+
["relationships_household", codeOf(14)],
|
|
216
|
+
["primary_client", codeOf(15)],
|
|
217
|
+
["other_named_persons", codeOf(16)],
|
|
218
|
+
["offenders", codeOf(16, 1)],
|
|
219
|
+
["family", codeOf(16, 2)],
|
|
220
|
+
["others", codeOf(16, 3)],
|
|
221
|
+
];
|
|
222
|
+
const INSTRUMENTS = [
|
|
223
|
+
"initial_screen",
|
|
224
|
+
"mental_health_screen",
|
|
225
|
+
"behavioral_health_intake",
|
|
226
|
+
"trauma_and_coping_screen",
|
|
227
|
+
"ae_intake",
|
|
228
|
+
"ida",
|
|
229
|
+
"lap",
|
|
230
|
+
"danger_assessment",
|
|
231
|
+
"stalking_assessment",
|
|
232
|
+
"injury_and_strangulation",
|
|
233
|
+
"hope_scale",
|
|
234
|
+
"needs_assessment",
|
|
235
|
+
"tra",
|
|
236
|
+
"findings",
|
|
237
|
+
];
|
|
238
|
+
const KINDS = ["offenders", "family", "others"] as const;
|
|
239
|
+
|
|
240
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
241
|
+
describe("core_information_scope v4 — the tree (handoff § 1, § 8)", () => {
|
|
242
|
+
it("carries every canon row once: 115 live rows, 27 tombstones, 4 missingness", () => {
|
|
243
|
+
expect(live).toHaveLength(115);
|
|
244
|
+
expect(tombstones).toHaveLength(27);
|
|
245
|
+
expect(scope.entries).toHaveLength(146);
|
|
246
|
+
expect(scope.scopeVersion).toBe(4);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it("counts each row type as canon does", () => {
|
|
250
|
+
const counts: Record<string, number> = {};
|
|
251
|
+
for (const e of live) counts[e.rowType as string] = (counts[e.rowType as string] ?? 0) + 1;
|
|
252
|
+
expect(counts).toEqual({
|
|
253
|
+
branch: 2,
|
|
254
|
+
person_type: 3,
|
|
255
|
+
category: 38,
|
|
256
|
+
subcategory: 34,
|
|
257
|
+
// canon's exporter label for a LEADS unit (no row_type in the yaml) — kept as written
|
|
258
|
+
"sub-category": 9,
|
|
259
|
+
category_rest: 1,
|
|
260
|
+
"instrument row": 28,
|
|
261
|
+
});
|
|
262
|
+
});
|
|
280
263
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
264
|
+
it("roots the tree at the four top-layer groups plus the four LEADS categories", () => {
|
|
265
|
+
expect(sortedKeys(live.filter((e) => e.parentCode === null))).toEqual([
|
|
266
|
+
"commercial_activity",
|
|
267
|
+
"investigative_work_product",
|
|
268
|
+
"network_associations",
|
|
269
|
+
"notes",
|
|
270
|
+
"object_identifiers",
|
|
271
|
+
"other_named_persons",
|
|
272
|
+
"primary_client",
|
|
273
|
+
"system",
|
|
274
|
+
]);
|
|
275
|
+
expect(sortedKeys(live.filter((e) => e.parentCode === byKey.get("primary_client")?.code))).toEqual([
|
|
276
|
+
"contact",
|
|
277
|
+
"health_accommodation",
|
|
278
|
+
"identifying",
|
|
279
|
+
"immigration_legal_status",
|
|
280
|
+
"instruments",
|
|
281
|
+
"relationships_household",
|
|
282
|
+
"risk",
|
|
283
|
+
"services",
|
|
284
|
+
]);
|
|
285
|
+
expect(byKey.get("other_named_persons")?.childCodes.map((c) => byCode.get(c)?.key)).toEqual([
|
|
286
|
+
"offenders",
|
|
287
|
+
"family",
|
|
288
|
+
"others",
|
|
287
289
|
]);
|
|
288
|
-
// Exact equality, both directions: an unlisted addition fails too, so the
|
|
289
|
-
// table above is updated (by APPENDING) in the same change that mints it.
|
|
290
|
-
expect(new Map(actual)).toEqual(new Map(expected));
|
|
291
290
|
});
|
|
292
|
-
});
|
|
293
291
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
expect(unit).toBeDefined();
|
|
307
|
-
expect(unit?.code).toBe("236-003-003-000-000-000-000");
|
|
308
|
-
expect(unit?.selectable).toBe(true);
|
|
309
|
-
expect(unit?.parentCode).toBe(byKey.get("contact")?.code);
|
|
310
|
-
expect(byKey.get("contact")?.childCodes).toContain(unit?.code);
|
|
311
|
-
expect(
|
|
312
|
-
scope.entries.filter((e) => e.key.startsWith("priorities")).map((e) => e.key),
|
|
313
|
-
).toEqual(["priorities_safety"]);
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
it("carries canon's posture: shareable by default, never the platform floor", () => {
|
|
317
|
-
// R1 rejected heightened protection: the most action-relevant answers on
|
|
318
|
-
// the record must not be the hardest to pass to the next advocate.
|
|
319
|
-
expect(unit?.shareableDefault).toBe(true);
|
|
320
|
-
// R2: locations follow the location, never the question — the floor stays
|
|
321
|
-
// on safe_locations alone, nothing is carved out of this unit by hand.
|
|
322
|
-
expect(unit?.platformFloor).toBeUndefined();
|
|
323
|
-
expect(unit?.required).toBeUndefined();
|
|
324
|
-
expect(unit?.levelFloor).toBe(3);
|
|
325
|
-
expect(unit?.specialDataType).toBe("survivor_confidential");
|
|
326
|
-
expect(unit?.appRelevance).toEqual(["PAVE", "Thread"]);
|
|
292
|
+
it("gives every non-top row exactly one live parent, reciprocally", () => {
|
|
293
|
+
for (const e of live) {
|
|
294
|
+
if (e.parentCode === null) continue;
|
|
295
|
+
const parent = byCode.get(e.parentCode);
|
|
296
|
+
expect(parent, `${e.key} has a dangling parent`).toBeDefined();
|
|
297
|
+
expect(parent?.retired, `${e.key} hangs off a tombstone`).toBeUndefined();
|
|
298
|
+
expect(parent?.childCodes, `${parent?.key} disowns ${e.key}`).toContain(e.code);
|
|
299
|
+
expect(
|
|
300
|
+
rows.filter((p) => p.childCodes.includes(e.code)).map((p) => p.key),
|
|
301
|
+
`${e.key} is claimed by more than one parent`,
|
|
302
|
+
).toHaveLength(1);
|
|
303
|
+
}
|
|
327
304
|
});
|
|
328
|
-
});
|
|
329
305
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
expect(
|
|
347
|
-
|
|
348
|
-
expect(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
expect(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
expect(
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
306
|
+
it("carries the tree by key as well as by code (parentKey / childKeys)", () => {
|
|
307
|
+
for (const e of scope.entries) {
|
|
308
|
+
expect(e.parentKey, e.key).toBe(e.parentCode === null ? null : byCode.get(e.parentCode)?.key);
|
|
309
|
+
expect(e.childKeys, e.key).toEqual(e.childCodes.map((c) => byCode.get(c)?.key));
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it("carries canon's depth: the number of ancestors (LEADS rows sit one deeper, beside the top layer)", () => {
|
|
314
|
+
for (const e of live) {
|
|
315
|
+
const extra = e.kindBranch === "leads" ? 1 : 0;
|
|
316
|
+
expect(e.depth, e.key).toBe(ancestors(e).length + extra);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it("keeps system_info: present, required, under System metadata", () => {
|
|
321
|
+
const si = liveKey("system_info");
|
|
322
|
+
expect(si?.required).toBe(true);
|
|
323
|
+
expect(si?.parentCode).toBe(byKey.get("system")?.code);
|
|
324
|
+
expect(sortedKeys(live.filter((e) => e.required === true))).toEqual(["system_info"]);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it("offers every LIVE row but the 28 instrument rows and the identifying rest row", () => {
|
|
328
|
+
const notSelectable = live.filter((e) => !e.selectable);
|
|
329
|
+
expect(notSelectable).toHaveLength(29);
|
|
330
|
+
expect(sortedKeys(notSelectable)).toEqual(
|
|
331
|
+
[
|
|
332
|
+
...INSTRUMENTS.flatMap((i) => [`summary_${i}`, `full_${i}`]),
|
|
333
|
+
"identifying__other",
|
|
334
|
+
].sort(),
|
|
335
|
+
);
|
|
336
|
+
expect(liveKey("identifying__other")?.rowType).toBe("category_rest");
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
it("puts the platform floor on exactly four rows: safe_locations and its three per-kind copies", () => {
|
|
340
|
+
expect(sortedKeys(live.filter((e) => e.platformFloor === true))).toEqual(
|
|
341
|
+
["safe_locations", ...KINDS.map((k) => `${k}__safe_locations`)].sort(),
|
|
342
|
+
);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it("turns exactly 28 rows off by default: Immigration, the Full part, and the floor", () => {
|
|
346
|
+
const off = live.filter((e) => e.shareableDefault === false);
|
|
347
|
+
expect(off).toHaveLength(28);
|
|
348
|
+
expect(sortedKeys(off)).toEqual(
|
|
349
|
+
[
|
|
350
|
+
"immigration_legal_status",
|
|
351
|
+
"immigration_status",
|
|
352
|
+
"immigration_applications",
|
|
353
|
+
"instrument_full",
|
|
354
|
+
...INSTRUMENTS.map((i) => `full_${i}`),
|
|
355
|
+
"safe_locations",
|
|
356
|
+
...KINDS.flatMap((k) => [
|
|
357
|
+
`${k}__immigration_legal_status`,
|
|
358
|
+
`${k}__instrument_full`,
|
|
359
|
+
`${k}__safe_locations`,
|
|
360
|
+
]),
|
|
361
|
+
].sort(),
|
|
362
|
+
);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it("uses only the canon enum values (handoff § 8, plus the three canon uses § 8 omits)", () => {
|
|
366
|
+
for (const e of live) {
|
|
367
|
+
expect(
|
|
368
|
+
[
|
|
369
|
+
"category",
|
|
370
|
+
"subcategory",
|
|
371
|
+
"sub-category",
|
|
372
|
+
"person_type",
|
|
373
|
+
"category_rest",
|
|
374
|
+
"instrument row",
|
|
375
|
+
"branch",
|
|
376
|
+
],
|
|
377
|
+
e.key,
|
|
378
|
+
).toContain(e.rowType);
|
|
379
|
+
expect(["none", "survivor_confidential", "criminal_intelligence", "evidence"], e.key).toContain(
|
|
380
|
+
e.specialDataType,
|
|
381
|
+
);
|
|
382
|
+
expect(["as_today", "new"], e.key).toContain(e.status);
|
|
383
|
+
expect(["client", "offenders", "family", "others", "leads", null], e.key).toContain(
|
|
384
|
+
e.kindBranch,
|
|
385
|
+
);
|
|
386
|
+
expect([1, 3], e.key).toContain(e.levelFloor);
|
|
387
|
+
expect(Object.keys(e.apps ?? {}).sort(), e.key).toEqual(["leads", "pave", "thread"]);
|
|
388
|
+
}
|
|
389
|
+
expect(live.filter((e) => e.status === "new")).toHaveLength(42);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it("spells a canon `.` as `__` in the key, with the canon code on canonicalCode", () => {
|
|
393
|
+
const dotted = live.filter((e) => e.canonicalCode !== undefined);
|
|
394
|
+
expect(dotted).toHaveLength(34);
|
|
395
|
+
for (const e of live) {
|
|
396
|
+
if (e.key.includes("__")) expect(e.canonicalCode, e.key).toBe(e.key.replace("__", "."));
|
|
397
|
+
else expect(e.canonicalCode, e.key).toBeUndefined();
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
it("places the per-kind rows by person type (handoff § 4: no LEADS column on them)", () => {
|
|
402
|
+
for (const k of KINDS) {
|
|
403
|
+
const kindRows = live.filter((e) => e.kindBranch === k);
|
|
404
|
+
expect(kindRows, k).toHaveLength(12);
|
|
405
|
+
for (const e of kindRows) {
|
|
406
|
+
expect(ancestors(e).map((a) => a.key), e.key).toContain("other_named_persons");
|
|
407
|
+
expect(e.apps?.leads, e.key).toBe(false);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
381
410
|
});
|
|
382
411
|
});
|
|
383
412
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
) as { _status: string; entries: (Entry & { title: string; definition: string })[] };
|
|
395
|
-
const unit = raw.entries.find((e) => e.key === "safe_locations");
|
|
413
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
414
|
+
describe("core_information_scope v4 — published codes never move, new codes append", () => {
|
|
415
|
+
it("keeps every v1.1.0 category and unit at its v1.1.0 positional code", () => {
|
|
416
|
+
for (const [ci, [cat, us]] of PUBLISHED_V1_1_0.entries()) {
|
|
417
|
+
expect(byKey.get(cat)?.code, cat).toBe(codeOf(ci + 1));
|
|
418
|
+
for (const [ui, u] of us.entries()) {
|
|
419
|
+
expect(byKey.get(u)?.code, u).toBe(codeOf(ci + 1, ui + 1));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
});
|
|
396
423
|
|
|
397
|
-
it("
|
|
398
|
-
expect(
|
|
399
|
-
expect(unit?.title).toBe("Safe & confidential locations");
|
|
400
|
-
expect(unit?.platformFloor).toBe(true);
|
|
401
|
-
expect(unit?.shareableDefault).toBe(false);
|
|
424
|
+
it("appends the new category-, unit- and person-type slots at their frozen codes", () => {
|
|
425
|
+
for (const [k, c] of APPENDED_V2_0_0) expect(byKey.get(k)?.code, k).toBe(c);
|
|
402
426
|
});
|
|
403
427
|
|
|
404
|
-
it("
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
428
|
+
it("codes each instrument row 236-013-00P-NNN, the same NNN for both parts", () => {
|
|
429
|
+
for (const [i, inst] of INSTRUMENTS.entries()) {
|
|
430
|
+
for (const [p, part] of (["summary", "full"] as const).entries()) {
|
|
431
|
+
const e = liveKey(`${part}_${inst}`);
|
|
432
|
+
expect(e?.code, `${part}_${inst}`).toBe(codeOf(13, p + 1, i + 1));
|
|
433
|
+
expect(e?.instrument).toBe(inst);
|
|
434
|
+
expect(e?.part).toBe(part);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it("codes every per-kind row by MIRRORING the kind-tree row it copies", () => {
|
|
440
|
+
const perKind = live.filter((e) => e.kindRow !== undefined);
|
|
441
|
+
expect(perKind).toHaveLength(33);
|
|
442
|
+
for (const e of perKind) {
|
|
443
|
+
const kind = byKey.get(e.kindBranch as string);
|
|
444
|
+
const mirrored = liveKey(e.kindRow as string);
|
|
445
|
+
expect(mirrored, e.key).toBeDefined();
|
|
446
|
+
expect(mirrored?.kindBranch, e.key).toBe("client");
|
|
447
|
+
expect(e.key).toBe(`${e.kindBranch}__${e.kindRow}`);
|
|
448
|
+
const segs = (c: string): string[] => c.split("-").slice(1).filter((s) => s !== "000");
|
|
449
|
+
expect(segs(e.code), e.key).toEqual([
|
|
450
|
+
...segs(kind?.code as string),
|
|
451
|
+
...segs(mirrored?.code as string),
|
|
452
|
+
]);
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
it("never reuses a code: unique across live rows and tombstones", () => {
|
|
457
|
+
expect(new Set(scope.entries.map((e) => e.code)).size).toBe(scope.entries.length);
|
|
458
|
+
expect(new Set(scope.entries.map((e) => e.key)).size).toBe(scope.entries.length);
|
|
409
459
|
});
|
|
410
460
|
});
|
|
411
461
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
462
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
463
|
+
describe("core_information_scope v4 — retirements and the from-to table (handoff § 3)", () => {
|
|
464
|
+
const table = scope.migrations.table;
|
|
465
|
+
|
|
466
|
+
it("tombstones exactly the 27 published units v4 no longer carries", () => {
|
|
467
|
+
expect(sortedKeys(tombstones)).toEqual(
|
|
468
|
+
[
|
|
469
|
+
// Narrative notes (2026-10-05)
|
|
470
|
+
"screen_notes",
|
|
471
|
+
"background",
|
|
472
|
+
// the instrument era (INFOSCOPE-RETIRE 2026-10-08)
|
|
473
|
+
"ida_full",
|
|
474
|
+
"ida_consid",
|
|
475
|
+
"initial_screen",
|
|
476
|
+
"tra",
|
|
477
|
+
"lap",
|
|
478
|
+
"danger_assessment",
|
|
479
|
+
"injury_and_strangulation",
|
|
480
|
+
"stalking_assessment",
|
|
481
|
+
"ae_intake",
|
|
482
|
+
"hope_scale",
|
|
483
|
+
"assessment_records",
|
|
484
|
+
"determinations",
|
|
485
|
+
"mental_health_screen",
|
|
486
|
+
"trauma_and_coping_screen",
|
|
487
|
+
"behavioral_health_intake",
|
|
488
|
+
// v4 (2026-10-08/09)
|
|
489
|
+
"offender_facilitator",
|
|
490
|
+
"disability_subtypes",
|
|
491
|
+
"mental_health_status",
|
|
492
|
+
"substance_use_status",
|
|
493
|
+
"chronic_health_status",
|
|
494
|
+
"hiv_status",
|
|
495
|
+
"uscis_alien_number",
|
|
496
|
+
"federal_protection_applications",
|
|
497
|
+
"tvap_enrollment",
|
|
498
|
+
"le_report_status",
|
|
499
|
+
].sort(),
|
|
500
|
+
);
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
it("makes every tombstone unofferable, attribute-free, and named by its canon reading", () => {
|
|
504
|
+
for (const t of tombstones) {
|
|
505
|
+
expect(t.selectable, t.key).toBe(false);
|
|
506
|
+
expect(t.status, t.key).toBe("retired");
|
|
507
|
+
expect(t.childCodes, t.key).toEqual([]);
|
|
508
|
+
expect(t.definition, t.key).toMatch(/^RETIRED \d{4}-\d{2}-\d{2} /);
|
|
444
509
|
for (const attr of [
|
|
445
510
|
"shareableDefault",
|
|
446
511
|
"levelFloor",
|
|
447
|
-
"
|
|
512
|
+
"apps",
|
|
448
513
|
"specialDataType",
|
|
449
514
|
"platformFloor",
|
|
450
515
|
"required",
|
|
516
|
+
"rowType",
|
|
451
517
|
] as const) {
|
|
452
|
-
expect(t
|
|
518
|
+
expect(t[attr], `${t.key}.${attr}`).toBeUndefined();
|
|
453
519
|
}
|
|
520
|
+
const lines = table.filter(
|
|
521
|
+
(m) => m.from === t.key && (m.rule === "row" || m.rule === "retired before v4"),
|
|
522
|
+
);
|
|
523
|
+
expect(lines, t.key).toHaveLength(1);
|
|
524
|
+
expect(t.successors, t.key).toEqual(lines[0]?.to);
|
|
525
|
+
expect(t.successorCodes, t.key).toEqual(lines[0]?.toCodes);
|
|
526
|
+
expect(t.migrationRule, t.key).toBe(lines[0]?.rule);
|
|
527
|
+
for (const s of t.successors ?? []) expect(liveKey(s), `${t.key} -> ${s}`).toBeDefined();
|
|
528
|
+
// A tombstone stays under the category that published it.
|
|
529
|
+
const home = PUBLISHED_V1_1_0.find(([, us]) => us.includes(t.key))?.[0];
|
|
530
|
+
expect(byCode.get(t.parentCode as string)?.key, t.key).toBe(home);
|
|
454
531
|
}
|
|
455
532
|
});
|
|
456
533
|
|
|
457
|
-
it("
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
534
|
+
it("reads the three include-nothing retirements as nothing", () => {
|
|
535
|
+
expect(sortedKeys(tombstones.filter((t) => (t.successors ?? []).length === 0))).toEqual([
|
|
536
|
+
"assessment_records",
|
|
537
|
+
"background",
|
|
538
|
+
"screen_notes",
|
|
539
|
+
]);
|
|
540
|
+
expect(byKey.get("offender_facilitator")?.successors).toEqual([
|
|
541
|
+
"offenders__identifying",
|
|
542
|
+
"offenders__risk",
|
|
543
|
+
]);
|
|
544
|
+
expect(byKey.get("ida_full")?.successors).toEqual(["full_ida", "summary_ida"]);
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it("maps EVERY v1.1.0 key to a live v4 key or a tombstone", () => {
|
|
548
|
+
for (const k of V1_1_0_KEYS) {
|
|
549
|
+
const e = byKey.get(k);
|
|
550
|
+
expect(e, k).toBeDefined();
|
|
551
|
+
if (MISSINGNESS.has(k)) continue;
|
|
552
|
+
if (e?.retired === true) {
|
|
553
|
+
expect(e.successors, k).toBeDefined();
|
|
554
|
+
} else {
|
|
555
|
+
expect(
|
|
556
|
+
table.some((m) => m.from === k && m.rule === "identity" && m.to[0] === k),
|
|
557
|
+
`${k} is live but has no identity line`,
|
|
558
|
+
).toBe(true);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
expect(V1_1_0_KEYS).toHaveLength(73);
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
it("exports canon's table whole: 103 lines, every target live, codes resolved", () => {
|
|
565
|
+
const m = scope.migrations;
|
|
566
|
+
expect([m.stampKey, m.fromVersion, m.toVersion]).toEqual(["scopeVersion", 3, 4]);
|
|
567
|
+
expect(m.readAt).toMatch(/never rewrite/);
|
|
568
|
+
const counts: Record<string, number> = {};
|
|
569
|
+
for (const l of table) counts[l.rule] = (counts[l.rule] ?? 0) + 1;
|
|
570
|
+
expect(counts).toEqual({
|
|
571
|
+
identity: 73,
|
|
572
|
+
row: 10,
|
|
573
|
+
category: 2,
|
|
574
|
+
subtract: 1,
|
|
575
|
+
"retired before v4": 17,
|
|
576
|
+
});
|
|
577
|
+
expect(Object.keys(m.rules).sort()).toEqual([...Object.keys(counts), "widens"].sort());
|
|
578
|
+
for (const l of table) {
|
|
579
|
+
expect(byKey.get(l.from)?.code, l.from).toBe(l.fromCode);
|
|
580
|
+
expect(l.toCodes, l.from).toEqual(l.to.map((t) => liveKey(t)?.code));
|
|
581
|
+
if (l.rule === "identity") expect(l.to, l.from).toEqual([l.from]);
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
it("never widens a category-grain selection: each target's live subtree ⊆ what the v1.1.0 category covered", () => {
|
|
586
|
+
// The rows a category covers in v4: its live descendants, walked by
|
|
587
|
+
// parentKey. A `category_rest` row is the category's own grain (the facts
|
|
588
|
+
// v1.1.0 kept on the category itself), so it is not an addition.
|
|
589
|
+
const descendants = (k: string): string[] =>
|
|
590
|
+
live
|
|
591
|
+
.filter((e) => e.rowType !== "category_rest" && ancestors(e).some((a) => a.key === k))
|
|
592
|
+
.map((e) => e.key);
|
|
593
|
+
const covered = new Map(PUBLISHED_V1_1_0.map(([c, us]) => [c, new Set(us)]));
|
|
594
|
+
const cat = table.filter((l) => l.rule === "category");
|
|
595
|
+
expect(cat.length).toBeGreaterThan(0);
|
|
596
|
+
for (const l of cat) {
|
|
597
|
+
const was = covered.get(l.from);
|
|
598
|
+
expect(was, `${l.from} is not a v1.1.0 category`).toBeDefined();
|
|
599
|
+
for (const t of l.to) {
|
|
600
|
+
const wider = descendants(t).filter((d) => !was?.has(d));
|
|
601
|
+
expect(wider, `${l.from} -> ${t} reaches rows the v1.1.0 category did not cover`).toEqual([]);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
it("keeps a restriction restricting, and names the restriction reading on the tombstone", () => {
|
|
607
|
+
const sub = table.filter((l) => l.rule === "subtract");
|
|
608
|
+
for (const l of sub) {
|
|
609
|
+
const t = byKey.get(l.from);
|
|
610
|
+
expect(t?.retired, l.from).toBe(true);
|
|
611
|
+
expect(t?.restrictionSuccessors, l.from).toEqual(l.to);
|
|
612
|
+
expect(t?.restrictionSuccessorCodes, l.from).toEqual(l.toCodes);
|
|
613
|
+
}
|
|
614
|
+
expect(sortedKeys(tombstones.filter((t) => t.restrictionSuccessors !== undefined))).toEqual(
|
|
615
|
+
sub.map((l) => l.from).sort(),
|
|
616
|
+
);
|
|
617
|
+
expect(byKey.get("offender_facilitator")?.restrictionSuccessors).toEqual(["offenders"]);
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
it("flags exactly the readings that WIDEN: a target shared by more than one v3 code", () => {
|
|
621
|
+
// Computed: an identity/row line widens when its target is also another
|
|
622
|
+
// v3 code's identity/row target. Pinned: consent widening, OPEN (Crysta).
|
|
623
|
+
const sel = table.filter((l) => l.rule === "identity" || l.rule === "row");
|
|
624
|
+
const sources = new Map<string, Set<string>>();
|
|
625
|
+
for (const l of sel) {
|
|
626
|
+
for (const t of l.to) sources.set(t, (sources.get(t) ?? new Set()).add(l.from));
|
|
627
|
+
}
|
|
628
|
+
const computed = sel
|
|
629
|
+
.filter((l) => l.to.some((t) => (sources.get(t)?.size ?? 0) > 1))
|
|
630
|
+
.map((l) => l.from)
|
|
631
|
+
.sort();
|
|
632
|
+
const PINNED = [
|
|
633
|
+
"chronic_health_status",
|
|
634
|
+
"disability_subtypes",
|
|
635
|
+
"federal_protection_applications",
|
|
636
|
+
"hiv_status",
|
|
637
|
+
"immigration_status",
|
|
638
|
+
"le_report_status",
|
|
639
|
+
"mental_health_status",
|
|
640
|
+
"substance_use_status",
|
|
641
|
+
"tvap_enrollment",
|
|
642
|
+
"uscis_alien_number",
|
|
643
|
+
];
|
|
644
|
+
expect(computed).toEqual(PINNED);
|
|
645
|
+
expect(table.filter((l) => l.widens).map((l) => l.from).sort()).toEqual(PINNED);
|
|
646
|
+
expect(
|
|
647
|
+
Object.entries(scope._supersedes.notes)
|
|
648
|
+
.filter(([, v]) => v.includes("reads WIDER"))
|
|
649
|
+
.map(([k]) => k)
|
|
650
|
+
.sort(),
|
|
651
|
+
).toEqual(PINNED);
|
|
652
|
+
// Only identity and row lines can widen.
|
|
653
|
+
expect(table.filter((l) => l.widens && l.rule !== "identity" && l.rule !== "row")).toEqual([]);
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
it("sends a v2-era or unstamped list through canon's pinned v2 -> v3 table first", () => {
|
|
657
|
+
const cite = "data/cvcs/core_information_scope.yaml L539-565 @ 00179edc";
|
|
658
|
+
expect(scope.migrations.unstamped).toContain(cite);
|
|
659
|
+
expect(scope.migrations.readAt).toContain(cite);
|
|
660
|
+
for (const t of tombstones.filter((x) => x.migrationRule === "retired before v4")) {
|
|
661
|
+
if ((t.successors ?? []).length > 0) expect(t.definition, t.key).toContain(cite);
|
|
662
|
+
}
|
|
663
|
+
expect(scope._supersedes.notes["risk"]).toContain(cite);
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
it("pins _source to the last canon commit, never to the ref it was read from", () => {
|
|
667
|
+
expect(scope._source).not.toMatch(/read from/);
|
|
668
|
+
expect(scope._source).toMatch(/v4\.draft\.yaml @ [0-9a-f]{8} /);
|
|
669
|
+
});
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
673
|
+
describe("core_information_scope v4 — which rows apply to which app (handoff § 4)", () => {
|
|
674
|
+
it("makes LEADS the only app on the LEADS categories and on Derived risk signals", () => {
|
|
675
|
+
const leadsOnly = live.filter(
|
|
676
|
+
(e) => e.apps?.leads === true && e.apps.pave === false && e.apps.thread === false,
|
|
677
|
+
);
|
|
678
|
+
expect(sortedKeys(leadsOnly)).toEqual(
|
|
679
|
+
[
|
|
680
|
+
"derived_risk_signals",
|
|
681
|
+
"network_associations",
|
|
682
|
+
"network_membership",
|
|
683
|
+
"persona_links",
|
|
684
|
+
"commercial_activity",
|
|
685
|
+
"ad_content",
|
|
686
|
+
"commercial_patterns",
|
|
687
|
+
"investigative_work_product",
|
|
688
|
+
"case_determinations",
|
|
689
|
+
"case_lifecycle",
|
|
690
|
+
"case_attachments",
|
|
691
|
+
"object_identifiers",
|
|
692
|
+
"object_identity_attributes",
|
|
693
|
+
"phone_identifiers",
|
|
694
|
+
].sort(),
|
|
695
|
+
);
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
it("marks Thread n/a on the client's Immigration & legal status", () => {
|
|
699
|
+
for (const k of ["immigration_legal_status", "immigration_status", "immigration_applications"]) {
|
|
700
|
+
expect(liveKey(k)?.apps?.thread, k).toBe(false);
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
706
|
+
describe("core_information_scope — adoption from roi_scope", () => {
|
|
707
|
+
const roiSubstantive = roi.entries.map((e) => e.key).filter((k) => !MISSINGNESS.has(k));
|
|
708
|
+
|
|
709
|
+
it("resolves every substantive roi_scope key, spelled identically", () => {
|
|
710
|
+
const keys = new Set(rows.map((u) => u.key));
|
|
711
|
+
expect(roiSubstantive.filter((k) => !keys.has(k))).toEqual([]);
|
|
712
|
+
expect(roiSubstantive.length).toBe(27);
|
|
463
713
|
});
|
|
464
714
|
|
|
465
|
-
it("
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
715
|
+
it("gives ONE answer to 'is this offerable' across both vocabularies (co-bwc)", () => {
|
|
716
|
+
const disagreements = roi.entries
|
|
717
|
+
.filter((e) => {
|
|
718
|
+
const twin = byKey.get(e.key);
|
|
719
|
+
return (
|
|
720
|
+
twin === undefined ||
|
|
721
|
+
twin.selectable !== e.selectable ||
|
|
722
|
+
(twin.retired === true) !== (e.retired === true)
|
|
723
|
+
);
|
|
724
|
+
})
|
|
725
|
+
.map((e) => e.key);
|
|
726
|
+
expect(disagreements).toEqual([]);
|
|
727
|
+
|
|
728
|
+
// Every CVC-236 tombstone whose key roi_scope carries is a roi_scope
|
|
729
|
+
// tombstone too (a CVC-236-only retirement is not a divergence).
|
|
730
|
+
const roiKeys = new Set(roi.entries.map((e) => e.key));
|
|
731
|
+
const roiTombstones = roi.entries.filter((e) => e.retired === true);
|
|
732
|
+
expect(sortedKeys(roiTombstones)).toEqual(
|
|
733
|
+
sortedKeys(tombstones.filter((t) => roiKeys.has(t.key))),
|
|
734
|
+
);
|
|
735
|
+
expect(roiTombstones).toHaveLength(13);
|
|
736
|
+
// Codes are never withdrawn or reused.
|
|
737
|
+
expect(roiTombstones.map((e) => e.code).sort()).toEqual(
|
|
738
|
+
[8, 9, 12, 14, 18, 19, 20, 21, 22, 24, 25, 26, 27].map(
|
|
739
|
+
(n) => `983-${seg(n)}-000-000-000-000-000`,
|
|
740
|
+
),
|
|
741
|
+
);
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
746
|
+
describe("core_information_scope — carried-over rulings", () => {
|
|
747
|
+
it("priorities_safety (2026-09-29, R1): one selectable Contact & safety row, shareable, no floor", () => {
|
|
748
|
+
const u = liveKey("priorities_safety");
|
|
749
|
+
expect(u?.code).toBe("236-003-003-000-000-000-000");
|
|
469
750
|
expect(u?.selectable).toBe(true);
|
|
470
|
-
expect(u?.parentCode).toBe(
|
|
751
|
+
expect(u?.parentCode).toBe(byKey.get("contact")?.code);
|
|
752
|
+
expect(u?.shareableDefault).toBe(true);
|
|
753
|
+
expect(u?.platformFloor).toBe(false);
|
|
754
|
+
expect(u?.apps).toEqual({ pave: true, thread: true, leads: false });
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
it("encounter_location (2026-10-01, R2): appended after priorities_safety, shareable, no floor", () => {
|
|
758
|
+
const u = liveKey("encounter_location");
|
|
759
|
+
expect(u?.code).toBe("236-003-004-000-000-000-000");
|
|
760
|
+
expect(byKey.get("contact")?.childCodes).toEqual([
|
|
761
|
+
"236-003-001-000-000-000-000",
|
|
762
|
+
"236-003-002-000-000-000-000",
|
|
763
|
+
"236-003-003-000-000-000-000",
|
|
764
|
+
"236-003-004-000-000-000-000",
|
|
765
|
+
]);
|
|
471
766
|
expect(u?.shareableDefault).toBe(true);
|
|
472
|
-
expect(u?.
|
|
473
|
-
expect(
|
|
474
|
-
|
|
767
|
+
expect(u?.platformFloor).toBe(false);
|
|
768
|
+
expect(liveKey("addresses")?.code).toBe("236-001-003-000-000-000-000");
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
it("safe_locations (ratified 2026-09-08): code, label and floor posture kept; canon, not provisional", () => {
|
|
772
|
+
const u = liveKey("safe_locations");
|
|
773
|
+
expect(u?.code).toBe("236-003-002-000-000-000-000");
|
|
774
|
+
expect(u?.title).toBe("Safe & confidential locations");
|
|
775
|
+
expect(u?.platformFloor).toBe(true);
|
|
776
|
+
expect(u?.shareableDefault).toBe(false);
|
|
777
|
+
expect(u?.definition).not.toMatch(/PROVISIONAL/);
|
|
778
|
+
expect(scope._status).toContain("`safe_locations` is CANON");
|
|
475
779
|
});
|
|
476
780
|
|
|
477
|
-
it("
|
|
781
|
+
it("narrative notes (2026-10-05): two live rows, both retired rows kept as tombstones", () => {
|
|
782
|
+
const notes = byKey.get("notes");
|
|
783
|
+
expect(notes?.parentCode).toBeNull();
|
|
478
784
|
expect(notes?.childCodes).toEqual([
|
|
479
785
|
"236-005-001-000-000-000-000",
|
|
480
786
|
"236-005-002-000-000-000-000",
|
|
@@ -483,136 +789,83 @@ describe("core_information_scope — narrative notes (2026-10-05)", () => {
|
|
|
483
789
|
]);
|
|
484
790
|
const liveKids = (notes?.childCodes ?? [])
|
|
485
791
|
.map((c) => byCode.get(c))
|
|
486
|
-
.filter((e) => e?.selectable
|
|
792
|
+
.filter((e) => e?.selectable)
|
|
487
793
|
.map((e) => e?.key);
|
|
488
794
|
expect(liveKids).toEqual(["case_notes", "session_summary"]);
|
|
795
|
+
expect(byKey.get("screen_notes")?.title).toBe("Screen notes");
|
|
796
|
+
expect(byKey.get("background")?.title).toBe("Background information");
|
|
489
797
|
});
|
|
490
798
|
|
|
491
|
-
it("
|
|
492
|
-
expect(
|
|
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"]);
|
|
799
|
+
it("Thread on System involvement (2026-10-01); the offender's record now rides its person type", () => {
|
|
800
|
+
expect(liveKey("system_involvement")?.apps?.thread).toBe(true);
|
|
801
|
+
expect(byKey.get("offender_facilitator")?.retired).toBe(true);
|
|
802
|
+
expect(liveKey("offenders")?.rowType).toBe("person_type");
|
|
511
803
|
});
|
|
512
804
|
});
|
|
513
805
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
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;
|
|
806
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
807
|
+
describe("core_information_scope — v2.0.0 supersedes v1.1.0", () => {
|
|
808
|
+
const sup = scope._supersedes;
|
|
535
809
|
|
|
536
|
-
it("is version
|
|
537
|
-
expect(
|
|
538
|
-
expect(sup.version).toBe("1.
|
|
539
|
-
// Tombstones keep their codes, so nothing is withdrawn.
|
|
810
|
+
it("is version 2.0.0, superseding 1.1.0, with no code withdrawn", () => {
|
|
811
|
+
expect(scope.version).toBe("2.0.0");
|
|
812
|
+
expect(sup.version).toBe("1.1.0");
|
|
540
813
|
expect(sup.retiredCodes).toEqual([]);
|
|
541
814
|
});
|
|
542
815
|
|
|
543
|
-
it("maps every v1.
|
|
544
|
-
|
|
545
|
-
expect(Object.keys(sup.keyMap)).toEqual(keys.filter((k) => k !== "session_summary"));
|
|
546
|
-
expect(Object.keys(sup.keyMap)).toHaveLength(72);
|
|
816
|
+
it("maps every v1.1.0 key to itself", () => {
|
|
817
|
+
expect(Object.keys(sup.keyMap).sort()).toEqual([...V1_1_0_KEYS].sort());
|
|
547
818
|
for (const [from, to] of Object.entries(sup.keyMap)) expect(to, from).toBe(from);
|
|
548
819
|
});
|
|
549
820
|
|
|
550
|
-
it("notes each retirement and the
|
|
551
|
-
|
|
552
|
-
"background",
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
"summary",
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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)");
|
|
821
|
+
it("notes each new retirement, the two category narrowings and the identity widening", () => {
|
|
822
|
+
const newlyRetired = sortedKeys(
|
|
823
|
+
tombstones.filter((t) => t.key !== "screen_notes" && t.key !== "background"),
|
|
824
|
+
);
|
|
825
|
+
expect(Object.keys(sup.notes).sort()).toEqual(
|
|
826
|
+
[...newlyRetired, "identifying", "immigration_status", "risk", "summary"].sort(),
|
|
827
|
+
);
|
|
828
|
+
expect(sup.notes["risk"]).toContain("reads NARROWER");
|
|
829
|
+
expect(sup.notes["identifying"]).toContain("reads NARROWER");
|
|
830
|
+
expect(sup.notes["hiv_status"]).toContain("reads WIDER");
|
|
564
831
|
});
|
|
565
832
|
|
|
566
|
-
it("leaves no
|
|
567
|
-
|
|
833
|
+
it("leaves no superseded file behind for the registry to resolve", () => {
|
|
834
|
+
for (const v of ["1.0.0", "1.1.0"]) {
|
|
835
|
+
expect(() => readFileSync(path.join(cvcDir, `coreInformationScope.v${v}.json`))).toThrow();
|
|
836
|
+
}
|
|
568
837
|
});
|
|
569
838
|
});
|
|
570
839
|
|
|
571
|
-
|
|
572
|
-
|
|
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;
|
|
840
|
+
describe("roi_scope — v1.3.0 supersedes v1.2.0", () => {
|
|
841
|
+
const sup = roi._supersedes;
|
|
592
842
|
|
|
593
|
-
it("is version 1.
|
|
594
|
-
expect(
|
|
595
|
-
expect(sup.version).toBe("1.
|
|
843
|
+
it("is version 1.3.0, superseding 1.2.0, identity keyMap, nothing withdrawn", () => {
|
|
844
|
+
expect(roi.version).toBe("1.3.0");
|
|
845
|
+
expect(sup.version).toBe("1.2.0");
|
|
596
846
|
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));
|
|
847
|
+
expect(Object.keys(sup.keyMap)).toEqual(roi.entries.map((e) => e.key));
|
|
601
848
|
expect(Object.keys(sup.keyMap)).toHaveLength(31);
|
|
602
849
|
for (const [from, to] of Object.entries(sup.keyMap)) expect(to, from).toBe(from);
|
|
603
850
|
});
|
|
604
851
|
|
|
605
|
-
it("notes each retirement
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
852
|
+
it("notes each new retirement with its CVC-236 twin's reading", () => {
|
|
853
|
+
const newly = roi.entries
|
|
854
|
+
.filter((e) => e.retired === true && !["screen_notes", "background"].includes(e.key))
|
|
855
|
+
.map((e) => e.key);
|
|
856
|
+
expect(newly).toHaveLength(11);
|
|
857
|
+
expect(Object.keys(sup.notes).sort()).toEqual([...newly, "summary"].sort());
|
|
858
|
+
for (const k of newly) {
|
|
859
|
+
const twin = byKey.get(k);
|
|
860
|
+
for (const s of twin?.successors ?? []) expect(sup.notes[k], k).toContain(`\`${s}\``);
|
|
861
|
+
expect(sup.notes[k], k).toContain("CVC-236 v2.0.0 retired the same key");
|
|
862
|
+
expect(sup.notes[k], k).toContain("unstamped and v2-era");
|
|
611
863
|
}
|
|
612
864
|
});
|
|
613
865
|
|
|
614
|
-
it("leaves no superseded file behind
|
|
615
|
-
|
|
616
|
-
|
|
866
|
+
it("leaves no superseded file behind", () => {
|
|
867
|
+
for (const v of ["1.0.0", "1.1.0", "1.2.0"]) {
|
|
868
|
+
expect(() => readFileSync(path.join(cvcDir, `roiScope.v${v}.json`))).toThrow();
|
|
869
|
+
}
|
|
617
870
|
});
|
|
618
871
|
});
|