@beehexa/hexasync-template-validate 2608.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/validate/buildValidationModel.d.ts +31 -0
- package/dist/validate/buildValidationModel.d.ts.map +1 -0
- package/dist/validate/buildValidationModel.js +68 -0
- package/dist/validate/buildValidationModel.js.map +1 -0
- package/dist/validate/context.d.ts +97 -0
- package/dist/validate/context.d.ts.map +1 -0
- package/dist/validate/context.js +90 -0
- package/dist/validate/context.js.map +1 -0
- package/dist/validate/contextFromGraph.d.ts +60 -0
- package/dist/validate/contextFromGraph.d.ts.map +1 -0
- package/dist/validate/contextFromGraph.js +77 -0
- package/dist/validate/contextFromGraph.js.map +1 -0
- package/dist/validate/harvestPullerTaskIds.d.ts +60 -0
- package/dist/validate/harvestPullerTaskIds.d.ts.map +1 -0
- package/dist/validate/harvestPullerTaskIds.js +115 -0
- package/dist/validate/harvestPullerTaskIds.js.map +1 -0
- package/dist/validate/model.d.ts +14 -0
- package/dist/validate/model.d.ts.map +1 -0
- package/dist/validate/model.js +92 -0
- package/dist/validate/model.js.map +1 -0
- package/dist/validate/registry.d.ts +20 -0
- package/dist/validate/registry.d.ts.map +1 -0
- package/dist/validate/registry.js +58 -0
- package/dist/validate/registry.js.map +1 -0
- package/dist/validate/rule.d.ts +18 -0
- package/dist/validate/rule.d.ts.map +1 -0
- package/dist/validate/rule.js +2 -0
- package/dist/validate/rule.js.map +1 -0
- package/dist/validate/ruleCatalog.d.ts +22 -0
- package/dist/validate/ruleCatalog.d.ts.map +1 -0
- package/dist/validate/ruleCatalog.js +263 -0
- package/dist/validate/ruleCatalog.js.map +1 -0
- package/dist/validate/rules/dependencyIntegrity.d.ts +60 -0
- package/dist/validate/rules/dependencyIntegrity.d.ts.map +1 -0
- package/dist/validate/rules/dependencyIntegrity.js +296 -0
- package/dist/validate/rules/dependencyIntegrity.js.map +1 -0
- package/dist/validate/rules/duplicates.d.ts +23 -0
- package/dist/validate/rules/duplicates.d.ts.map +1 -0
- package/dist/validate/rules/duplicates.js +321 -0
- package/dist/validate/rules/duplicates.js.map +1 -0
- package/dist/validate/rules/flow.d.ts +41 -0
- package/dist/validate/rules/flow.d.ts.map +1 -0
- package/dist/validate/rules/flow.js +559 -0
- package/dist/validate/rules/flow.js.map +1 -0
- package/dist/validate/rules/overwriteLoss.d.ts +23 -0
- package/dist/validate/rules/overwriteLoss.d.ts.map +1 -0
- package/dist/validate/rules/overwriteLoss.js +40 -0
- package/dist/validate/rules/overwriteLoss.js.map +1 -0
- package/dist/validate/rules/pullerKind.d.ts +3 -0
- package/dist/validate/rules/pullerKind.d.ts.map +1 -0
- package/dist/validate/rules/pullerKind.js +83 -0
- package/dist/validate/rules/pullerKind.js.map +1 -0
- package/dist/validate/rules/reference.d.ts +44 -0
- package/dist/validate/rules/reference.d.ts.map +1 -0
- package/dist/validate/rules/reference.js +370 -0
- package/dist/validate/rules/reference.js.map +1 -0
- package/dist/validate/rules/referenceKind.d.ts +25 -0
- package/dist/validate/rules/referenceKind.d.ts.map +1 -0
- package/dist/validate/rules/referenceKind.js +230 -0
- package/dist/validate/rules/referenceKind.js.map +1 -0
- package/dist/validate/rules/retiredType.d.ts +142 -0
- package/dist/validate/rules/retiredType.d.ts.map +1 -0
- package/dist/validate/rules/retiredType.js +228 -0
- package/dist/validate/rules/retiredType.js.map +1 -0
- package/dist/validate/rules/tables.d.ts +8 -0
- package/dist/validate/rules/tables.d.ts.map +1 -0
- package/dist/validate/rules/tables.js +116 -0
- package/dist/validate/rules/tables.js.map +1 -0
- package/dist/validate/rules/variableDrift.d.ts +63 -0
- package/dist/validate/rules/variableDrift.d.ts.map +1 -0
- package/dist/validate/rules/variableDrift.js +132 -0
- package/dist/validate/rules/variableDrift.js.map +1 -0
- package/dist/validate/rules/variables.d.ts +12 -0
- package/dist/validate/rules/variables.d.ts.map +1 -0
- package/dist/validate/rules/variables.js +207 -0
- package/dist/validate/rules/variables.js.map +1 -0
- package/dist/validate/sourceLocator.d.ts +32 -0
- package/dist/validate/sourceLocator.d.ts.map +1 -0
- package/dist/validate/sourceLocator.js +166 -0
- package/dist/validate/sourceLocator.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { nestedReferenceBlockFor, resolveReferenceKind, REFERENCE_PROPERTIES, } from '@beehexa/hexasync-template-model';
|
|
2
|
+
// `DIRECTIVE_KEYS` stays with the merge engine that defines it — one answer to "which top-level keys
|
|
3
|
+
// are directives rather than components", imported rather than copied.
|
|
4
|
+
import { DIRECTIVE_KEYS } from '@beehexa/hexasync-template-compose';
|
|
5
|
+
import { makeTokenResolver } from './reference.js';
|
|
6
|
+
/**
|
|
7
|
+
* Index what the project actually has.
|
|
8
|
+
*
|
|
9
|
+
* Built from the composed document rather than from a component list, because the document is what
|
|
10
|
+
* the rule walks and two sources for "what exists" is the disagreement C3 forbids. Ids are resolved
|
|
11
|
+
* through the pool for the same reason the comparison is.
|
|
12
|
+
*/
|
|
13
|
+
function contentsOf(doc, resolve) {
|
|
14
|
+
const contents = new Map();
|
|
15
|
+
if (!doc || typeof doc !== 'object')
|
|
16
|
+
return contents;
|
|
17
|
+
const add = (collection, id) => {
|
|
18
|
+
if (id === null || id === undefined)
|
|
19
|
+
return;
|
|
20
|
+
const set = contents.get(collection) ?? new Set();
|
|
21
|
+
set.add(resolve(String(id)));
|
|
22
|
+
contents.set(collection, set);
|
|
23
|
+
};
|
|
24
|
+
for (const [collection, value] of Object.entries(doc)) {
|
|
25
|
+
if (DIRECTIVE_KEYS.has(collection))
|
|
26
|
+
continue;
|
|
27
|
+
if (Array.isArray(value)) {
|
|
28
|
+
for (const item of value) {
|
|
29
|
+
if (!item || typeof item !== 'object')
|
|
30
|
+
continue;
|
|
31
|
+
const raw = 'id' in item
|
|
32
|
+
? item.id
|
|
33
|
+
: 'key' in item
|
|
34
|
+
? item.key
|
|
35
|
+
: undefined;
|
|
36
|
+
add(collection, raw);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (value && typeof value === 'object') {
|
|
40
|
+
// A map collection is keyed by its own keys — `objectAssociations` and friends.
|
|
41
|
+
for (const key of Object.keys(value)) {
|
|
42
|
+
add(collection, key);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return contents;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Walk the document collecting references.
|
|
50
|
+
*
|
|
51
|
+
* Iterative, because a corpus document nests deeply enough that recursion is a real hazard — the same
|
|
52
|
+
* choice `queries.ts` made and said so.
|
|
53
|
+
*/
|
|
54
|
+
function referencesIn(doc) {
|
|
55
|
+
const found = [];
|
|
56
|
+
if (!doc || typeof doc !== 'object')
|
|
57
|
+
return found;
|
|
58
|
+
const stack = [];
|
|
59
|
+
// Seed with each top-level component, so every reference carries the component it belongs to. A
|
|
60
|
+
// finding attributed to no component cannot be located in a file, and an unlocatable error is one
|
|
61
|
+
// a developer cannot act on.
|
|
62
|
+
for (const [collection, value] of Object.entries(doc)) {
|
|
63
|
+
if (DIRECTIVE_KEYS.has(collection))
|
|
64
|
+
continue;
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
for (const item of value) {
|
|
67
|
+
if (!item || typeof item !== 'object')
|
|
68
|
+
continue;
|
|
69
|
+
const raw = 'id' in item
|
|
70
|
+
? item.id
|
|
71
|
+
: 'key' in item
|
|
72
|
+
? item.key
|
|
73
|
+
: undefined;
|
|
74
|
+
stack.push({
|
|
75
|
+
node: item,
|
|
76
|
+
parentKey: collection,
|
|
77
|
+
...(raw === null || raw === undefined
|
|
78
|
+
? {}
|
|
79
|
+
: { idOrKey: String(raw) }),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (value && typeof value === 'object') {
|
|
84
|
+
for (const [key, item] of Object.entries(value)) {
|
|
85
|
+
stack.push({ node: item, parentKey: collection, idOrKey: key });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
while (stack.length > 0) {
|
|
90
|
+
const frame = stack.pop();
|
|
91
|
+
const node = frame.node;
|
|
92
|
+
if (Array.isArray(node)) {
|
|
93
|
+
for (const item of node)
|
|
94
|
+
stack.push({ ...frame, node: item });
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (!node || typeof node !== 'object')
|
|
98
|
+
continue;
|
|
99
|
+
const record = node;
|
|
100
|
+
for (const [property, value] of Object.entries(record)) {
|
|
101
|
+
// A NESTED block — `table: { id: … }` — is the corpus's dominant reference form by about 10:1,
|
|
102
|
+
// so a rule that only understood flat `*Id` names would miss most of the real edges.
|
|
103
|
+
const nested = nestedReferenceBlockFor(property);
|
|
104
|
+
if (nested &&
|
|
105
|
+
value &&
|
|
106
|
+
typeof value === 'object' &&
|
|
107
|
+
!Array.isArray(value)) {
|
|
108
|
+
const id = value.id;
|
|
109
|
+
if (typeof id === 'string' && id !== '') {
|
|
110
|
+
found.push({
|
|
111
|
+
property: `${property}.id`,
|
|
112
|
+
targetId: id,
|
|
113
|
+
collection: nested.collection,
|
|
114
|
+
...(frame.parentKey ? { parentKey: frame.parentKey } : {}),
|
|
115
|
+
...(frame.idOrKey ? { idOrKey: frame.idOrKey } : {}),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (REFERENCE_PROPERTIES.includes(property)) {
|
|
120
|
+
for (const one of Array.isArray(value) ? value : [value]) {
|
|
121
|
+
if (typeof one !== 'string' && typeof one !== 'number')
|
|
122
|
+
continue;
|
|
123
|
+
const targetId = String(one);
|
|
124
|
+
if (targetId === '')
|
|
125
|
+
continue;
|
|
126
|
+
// The registry decides, reading the SIBLINGS — and returns undefined when this is not a
|
|
127
|
+
// reference at all, which must not be reported as a broken one.
|
|
128
|
+
const kind = resolveReferenceKind(property, targetId, record);
|
|
129
|
+
if (!kind)
|
|
130
|
+
continue;
|
|
131
|
+
found.push({
|
|
132
|
+
property: kind.property,
|
|
133
|
+
targetId,
|
|
134
|
+
collection: kind.collection,
|
|
135
|
+
...(frame.parentKey ? { parentKey: frame.parentKey } : {}),
|
|
136
|
+
...(frame.idOrKey ? { idOrKey: frame.idOrKey } : {}),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (value && typeof value === 'object')
|
|
141
|
+
stack.push({ ...frame, node: value });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return found;
|
|
145
|
+
}
|
|
146
|
+
/** Severity by what the reference does: a dangling id breaks the worker, a wrong kind misroutes it. */
|
|
147
|
+
const UNKNOWN_SEVERITY = 'high';
|
|
148
|
+
const WRONG_KIND_SEVERITY = 'high';
|
|
149
|
+
export const referenceKindRule = {
|
|
150
|
+
id: 'REF-K',
|
|
151
|
+
family: 'REF',
|
|
152
|
+
run(ctx) {
|
|
153
|
+
const issues = [];
|
|
154
|
+
const doc = ctx.tokenForm;
|
|
155
|
+
if (!doc || typeof doc !== 'object')
|
|
156
|
+
return issues;
|
|
157
|
+
const resolve = makeTokenResolver(ctx.variables);
|
|
158
|
+
const contents = contentsOf(doc, resolve);
|
|
159
|
+
const everything = new Set();
|
|
160
|
+
for (const ids of contents.values())
|
|
161
|
+
for (const id of ids)
|
|
162
|
+
everything.add(id);
|
|
163
|
+
// Deduplicated: the same reference written twice in one component is one problem, and reporting it
|
|
164
|
+
// twice trains the developer to skim the panel.
|
|
165
|
+
const seen = new Set();
|
|
166
|
+
for (const reference of referencesIn(doc)) {
|
|
167
|
+
const key = `${reference.parentKey ?? '-'}\u0000${reference.idOrKey ?? '-'}\u0000${reference.property}\u0000${reference.targetId}`;
|
|
168
|
+
if (seen.has(key))
|
|
169
|
+
continue;
|
|
170
|
+
seen.add(key);
|
|
171
|
+
const resolved = resolve(reference.targetId);
|
|
172
|
+
const target = reference.collection
|
|
173
|
+
? contents.get(reference.collection)
|
|
174
|
+
: undefined;
|
|
175
|
+
// Right kind, right instance — nothing to say.
|
|
176
|
+
if (target?.has(resolved))
|
|
177
|
+
continue;
|
|
178
|
+
const existsElsewhere = everything.has(resolved);
|
|
179
|
+
if (reference.collection === undefined) {
|
|
180
|
+
// The registry knows the property is a reference but not where it points. Only a
|
|
181
|
+
// nothing-anywhere id is reportable; claiming a KIND we cannot name would be a guess.
|
|
182
|
+
if (!existsElsewhere) {
|
|
183
|
+
issues.push({
|
|
184
|
+
ruleId: 'REF-K1',
|
|
185
|
+
family: 'REF',
|
|
186
|
+
severity: UNKNOWN_SEVERITY,
|
|
187
|
+
...(reference.parentKey ? { parentKey: reference.parentKey } : {}),
|
|
188
|
+
...(reference.idOrKey ? { idOrKey: reference.idOrKey } : {}),
|
|
189
|
+
message: `\`${reference.property}\` references \`${reference.targetId}\`, which this project does not contain`,
|
|
190
|
+
why: 'the worker cannot resolve it, so the step that reads it fails at run time',
|
|
191
|
+
locateValue: reference.targetId,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (existsElsewhere) {
|
|
197
|
+
// WRONG KIND: the id is real, and it is not one of these. This is the class the registry's
|
|
198
|
+
// sibling discrimination exists to make reportable — a puller id where a task id belongs.
|
|
199
|
+
const actual = [...contents.entries()]
|
|
200
|
+
.filter(([, ids]) => ids.has(resolved))
|
|
201
|
+
.map(([collection]) => collection)
|
|
202
|
+
.sort()
|
|
203
|
+
.join(', ');
|
|
204
|
+
issues.push({
|
|
205
|
+
ruleId: 'REF-K2',
|
|
206
|
+
family: 'REF',
|
|
207
|
+
severity: WRONG_KIND_SEVERITY,
|
|
208
|
+
...(reference.parentKey ? { parentKey: reference.parentKey } : {}),
|
|
209
|
+
...(reference.idOrKey ? { idOrKey: reference.idOrKey } : {}),
|
|
210
|
+
message: `\`${reference.property}\` must name something in \`${reference.collection}\`, but \`${reference.targetId}\` is in \`${actual}\``,
|
|
211
|
+
why: 'the worker looks the id up in the wrong collection and finds nothing',
|
|
212
|
+
locateValue: reference.targetId,
|
|
213
|
+
});
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
issues.push({
|
|
217
|
+
ruleId: 'REF-K1',
|
|
218
|
+
family: 'REF',
|
|
219
|
+
severity: UNKNOWN_SEVERITY,
|
|
220
|
+
...(reference.parentKey ? { parentKey: reference.parentKey } : {}),
|
|
221
|
+
...(reference.idOrKey ? { idOrKey: reference.idOrKey } : {}),
|
|
222
|
+
message: `\`${reference.property}\` references \`${reference.targetId}\`, which this project does not contain`,
|
|
223
|
+
why: 'the worker cannot resolve it, so the step that reads it fails at run time',
|
|
224
|
+
locateValue: reference.targetId,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return issues;
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=referenceKind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceKind.js","sourceRoot":"","sources":["../../../src/validate/rules/referenceKind.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,kCAAkC,CAAC;AAC1C,qGAAqG;AACrG,uEAAuE;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAsB,MAAM,gBAAgB,CAAC;AAKvE;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,GAAY,EAAE,OAAsB;IACtD,MAAM,QAAQ,GAAa,IAAI,GAAG,EAAE,CAAC;IACrC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAErD,MAAM,GAAG,GAAG,CAAC,UAAkB,EAAE,EAAW,EAAE,EAAE;QAC9C,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO;QAC5C,MAAM,GAAG,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AE,SAAS,CAAC,QAAQ;aAChC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { ValidationRule } from '../rule.js';
|
|
2
|
+
/**
|
|
3
|
+
* Retired component types (RET family) — Phase 2 Story 1.10.
|
|
4
|
+
*
|
|
5
|
+
* The id is `RET-1`, letters-then-digits, because `ruleCatalog`'s `splitRuleId` parses exactly that shape to
|
|
6
|
+
* sort the catalog — a `DEP-R1`-style id would silently fall to the end of the list.
|
|
7
|
+
*
|
|
8
|
+
* `schemas` and `reports` are retired: a Task (object) with `type: REFERENCE` replaces `Schema`. This reports
|
|
9
|
+
* every one that is still declared, so a template can be migrated before the platform stops carrying it.
|
|
10
|
+
*
|
|
11
|
+
* ### The severity IS the design, and it rests on a number
|
|
12
|
+
*
|
|
13
|
+
* `medium`, which the editor maps to a WARNING, and never `high` or `critical`, which map to an error.
|
|
14
|
+
*
|
|
15
|
+
* Measured across the corpus: the rule FIRES on **52 of the 104 projects that compose** — half of them.
|
|
16
|
+
*
|
|
17
|
+
* That figure was 92% until the review, and the correction matters more than the conclusion. 104 projects
|
|
18
|
+
* *declare* `schemas:` or `reports:`, but 43 of them declare an EMPTY collection (93 files are `schemas: []`,
|
|
19
|
+
* 77 are `reports: []`, 2 are `reports: null`) and emit nothing at all. The original measurement counted a
|
|
20
|
+
* regex match on the key, which is a population the rule never touches. Both the number and the test that
|
|
21
|
+
* produced it were mine, and the test was titled "fires on MOST projects" while measuring "declares".
|
|
22
|
+
*
|
|
23
|
+
* At error severity half of all projects would go red the moment anyone opened one — and a rule that shouts on
|
|
24
|
+
* half a corpus is a rule people switch off. The editor's own `findingsFromIssues.ts` names that
|
|
25
|
+
* failure ("how a rule earns a reputation for crying wolf") and reserves error for "things that break at
|
|
26
|
+
* runtime". A retired type still works; it is going away. So the conclusion survives the correction, but it
|
|
27
|
+
* now rests on a number that describes the rule rather than one that described a regex.
|
|
28
|
+
*
|
|
29
|
+
* `low` was considered and rejected: it renders as `info`, which is too quiet for a migration the platform
|
|
30
|
+
* intends to complete. Jazz's call, 2026-08-04: warning, and the build still succeeds.
|
|
31
|
+
*
|
|
32
|
+
* Validation is advisory throughout — `runValidation` swallows a throwing rule so one broken rule cannot
|
|
33
|
+
* suppress the others — so nothing here can fail a compose.
|
|
34
|
+
*
|
|
35
|
+
* ### Why a declared list rather than two branches
|
|
36
|
+
*
|
|
37
|
+
* Retiring a third type must be one entry. That is FR-107's shape applied inside a rule rather than only
|
|
38
|
+
* across the registry, and it is why the replacement text lives in the table beside the collection name.
|
|
39
|
+
*
|
|
40
|
+
* The extension's family generator derives ITS retired list from this one (`lib/variableFamily.ts`), so the two
|
|
41
|
+
* halves of the policy — do not mint new ones, flag the ones already there — cannot drift. They were separate
|
|
42
|
+
* lists until the review, which made "one entry" false across repos.
|
|
43
|
+
*
|
|
44
|
+
* ### One finding per component, not one per project
|
|
45
|
+
*
|
|
46
|
+
* A project can produce a lot of these — 57 in `001-projects/mimone`, the corpus worst — and for a rule whose
|
|
47
|
+
* whole severity argument is about not crying wolf, the review fairly asked why they are not aggregated into
|
|
48
|
+
* one finding per collection.
|
|
49
|
+
*
|
|
50
|
+
* Per-component is deliberate, for two reasons. It is what every sibling rule does (REF, DUP, PLK all emit per
|
|
51
|
+
* component), so a reader of the Problems panel does not have to learn that this one family counts
|
|
52
|
+
* differently. And it is what makes each finding NAVIGABLE: a finding carries `parentKey`/`idOrKey`, which is
|
|
53
|
+
* how the report groups it and how the editor places the squiggle. One aggregated finding would name a
|
|
54
|
+
* collection and leave the developer to find the 57 components inside it by hand.
|
|
55
|
+
*
|
|
56
|
+
* The cost is real and bounded: 445 findings across the whole corpus, worst project 57, both pinned by the
|
|
57
|
+
* corpus spec. If a project ever approached the panel's usable limit, a collection-level finding would be the
|
|
58
|
+
* answer — and the spec's bound is what would say so.
|
|
59
|
+
*
|
|
60
|
+
* Reads the COMPOSED document, like every rule here, so an inherited `schemas:` block is reported for the
|
|
61
|
+
* project that inherits it — correctly: that project ships it.
|
|
62
|
+
*
|
|
63
|
+
* Advisory + pure (no fs, never throws fatally).
|
|
64
|
+
*/
|
|
65
|
+
/**
|
|
66
|
+
* How widespread the retired types are, which is the ONLY reason the severity is a warning.
|
|
67
|
+
*
|
|
68
|
+
* Re-derived by `apps/cli/src/__tests__/retiredTypeCorpus.spec.ts`, which composes every corpus project and
|
|
69
|
+
* runs THIS RULE to count — so the figures are what the rule does, with no second implementation to be wrong.
|
|
70
|
+
* Two earlier attempts both measured something adjacent and disagreed with each other. Every field here is
|
|
71
|
+
* pinned by equality in that spec; an unpinned number beside pinned ones reads as measured and is not.
|
|
72
|
+
*
|
|
73
|
+
* If these counts collapse, the migration is working and the severity deserves another look.
|
|
74
|
+
*/
|
|
75
|
+
export declare const RETIRED_MEASUREMENTS: {
|
|
76
|
+
/**
|
|
77
|
+
* Projects that compose successfully — the population the rule is actually offered to.
|
|
78
|
+
*
|
|
79
|
+
* 104 → 105 on 2026-08-06: the corpus gained `001-projects/nla-extensions/nla-backorder` in a merge. The
|
|
80
|
+
* other four figures did not move, so nothing about the rule's behaviour changed — only the population it
|
|
81
|
+
* was measured over. Re-derived rather than relaxed: a pinned number that is allowed to drift stops being
|
|
82
|
+
* evidence for the severity argument it supports.
|
|
83
|
+
*/
|
|
84
|
+
readonly projectsComposed: 105;
|
|
85
|
+
/**
|
|
86
|
+
* Projects the rule FIRES on: a non-empty retired collection somewhere.
|
|
87
|
+
*
|
|
88
|
+
* The figure the severity argument needs, and the one the first version got wrong. It recorded 104 — the
|
|
89
|
+
* count of projects whose files merely MATCH `^schemas:|^reports:` — which includes 43 that declare an empty
|
|
90
|
+
* collection and emit nothing. A grep for the key still says 104; that is not this number and never was.
|
|
91
|
+
*/
|
|
92
|
+
readonly projectsFiring: 52;
|
|
93
|
+
/** Findings across the whole corpus, and the most any single project produces. */
|
|
94
|
+
readonly findingsTotal: 445;
|
|
95
|
+
readonly worstProjectFindings: 57;
|
|
96
|
+
/**
|
|
97
|
+
* The split per collection: components authored, and how many projects author them.
|
|
98
|
+
*
|
|
99
|
+
* Recorded because the extension's authoring schema QUOTES these in its deprecation notices
|
|
100
|
+
* (`assets/frontend/templates/main.json`), and a number living in a JSON file in another repo has nothing
|
|
101
|
+
* holding it to reality. Pinning them here means drift fails a test that can name the other file, rather
|
|
102
|
+
* than silently telling authors to plan a migration of the wrong size.
|
|
103
|
+
*
|
|
104
|
+
* They also reconcile: 218 + 227 = 445 = `findingsTotal`, one finding per component.
|
|
105
|
+
*/
|
|
106
|
+
readonly perCollection: {
|
|
107
|
+
readonly schemas: {
|
|
108
|
+
readonly components: 218;
|
|
109
|
+
readonly projects: 48;
|
|
110
|
+
};
|
|
111
|
+
readonly reports: {
|
|
112
|
+
readonly components: 227;
|
|
113
|
+
readonly projects: 38;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/** A retired collection, and what replaces it. */
|
|
118
|
+
export interface RetiredCollection {
|
|
119
|
+
/** The top-level collection key in the composed document. */
|
|
120
|
+
readonly collection: string;
|
|
121
|
+
/** What the type was called, for the message. */
|
|
122
|
+
readonly label: string;
|
|
123
|
+
/**
|
|
124
|
+
* What to use instead, when that is KNOWN.
|
|
125
|
+
*
|
|
126
|
+
* Optional deliberately. `Schema`'s successor was specified; `Report`'s was not, and an earlier version of
|
|
127
|
+
* this file asserted one ("the metrics and notification pipeline supersedes report components") that no
|
|
128
|
+
* source states — the editor inventing platform semantics, which NFR-1 forbids outright. A finding that says
|
|
129
|
+
* "retired, ask the platform team" is less useful than one naming the successor, and far better than one
|
|
130
|
+
* naming the wrong successor confidently.
|
|
131
|
+
*/
|
|
132
|
+
readonly replacement?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The types retired so far (Jazz, 2026-08-04).
|
|
136
|
+
*
|
|
137
|
+
* Exported so a test can assert the list rather than infer it from behaviour, and so a reader can see at a
|
|
138
|
+
* glance what "retired" currently covers.
|
|
139
|
+
*/
|
|
140
|
+
export declare const RETIRED_COLLECTIONS: readonly RetiredCollection[];
|
|
141
|
+
export declare const retiredTypeRule: ValidationRule;
|
|
142
|
+
//# sourceMappingURL=retiredType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retiredType.d.ts","sourceRoot":"","sources":["../../../src/validate/rules/retiredType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB;IAC/B;;;;;;;OAOG;;IAEH;;;;;;OAMG;;IAEH,kFAAkF;;;IAGlF;;;;;;;;;OASG;;;;;;;;;;;CAKK,CAAC;AAEX,kDAAkD;AAClD,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAcD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,iBAAiB,EAY3D,CAAC;AA4DF,eAAO,MAAM,eAAe,EAAE,cA0C7B,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retired component types (RET family) — Phase 2 Story 1.10.
|
|
3
|
+
*
|
|
4
|
+
* The id is `RET-1`, letters-then-digits, because `ruleCatalog`'s `splitRuleId` parses exactly that shape to
|
|
5
|
+
* sort the catalog — a `DEP-R1`-style id would silently fall to the end of the list.
|
|
6
|
+
*
|
|
7
|
+
* `schemas` and `reports` are retired: a Task (object) with `type: REFERENCE` replaces `Schema`. This reports
|
|
8
|
+
* every one that is still declared, so a template can be migrated before the platform stops carrying it.
|
|
9
|
+
*
|
|
10
|
+
* ### The severity IS the design, and it rests on a number
|
|
11
|
+
*
|
|
12
|
+
* `medium`, which the editor maps to a WARNING, and never `high` or `critical`, which map to an error.
|
|
13
|
+
*
|
|
14
|
+
* Measured across the corpus: the rule FIRES on **52 of the 104 projects that compose** — half of them.
|
|
15
|
+
*
|
|
16
|
+
* That figure was 92% until the review, and the correction matters more than the conclusion. 104 projects
|
|
17
|
+
* *declare* `schemas:` or `reports:`, but 43 of them declare an EMPTY collection (93 files are `schemas: []`,
|
|
18
|
+
* 77 are `reports: []`, 2 are `reports: null`) and emit nothing at all. The original measurement counted a
|
|
19
|
+
* regex match on the key, which is a population the rule never touches. Both the number and the test that
|
|
20
|
+
* produced it were mine, and the test was titled "fires on MOST projects" while measuring "declares".
|
|
21
|
+
*
|
|
22
|
+
* At error severity half of all projects would go red the moment anyone opened one — and a rule that shouts on
|
|
23
|
+
* half a corpus is a rule people switch off. The editor's own `findingsFromIssues.ts` names that
|
|
24
|
+
* failure ("how a rule earns a reputation for crying wolf") and reserves error for "things that break at
|
|
25
|
+
* runtime". A retired type still works; it is going away. So the conclusion survives the correction, but it
|
|
26
|
+
* now rests on a number that describes the rule rather than one that described a regex.
|
|
27
|
+
*
|
|
28
|
+
* `low` was considered and rejected: it renders as `info`, which is too quiet for a migration the platform
|
|
29
|
+
* intends to complete. Jazz's call, 2026-08-04: warning, and the build still succeeds.
|
|
30
|
+
*
|
|
31
|
+
* Validation is advisory throughout — `runValidation` swallows a throwing rule so one broken rule cannot
|
|
32
|
+
* suppress the others — so nothing here can fail a compose.
|
|
33
|
+
*
|
|
34
|
+
* ### Why a declared list rather than two branches
|
|
35
|
+
*
|
|
36
|
+
* Retiring a third type must be one entry. That is FR-107's shape applied inside a rule rather than only
|
|
37
|
+
* across the registry, and it is why the replacement text lives in the table beside the collection name.
|
|
38
|
+
*
|
|
39
|
+
* The extension's family generator derives ITS retired list from this one (`lib/variableFamily.ts`), so the two
|
|
40
|
+
* halves of the policy — do not mint new ones, flag the ones already there — cannot drift. They were separate
|
|
41
|
+
* lists until the review, which made "one entry" false across repos.
|
|
42
|
+
*
|
|
43
|
+
* ### One finding per component, not one per project
|
|
44
|
+
*
|
|
45
|
+
* A project can produce a lot of these — 57 in `001-projects/mimone`, the corpus worst — and for a rule whose
|
|
46
|
+
* whole severity argument is about not crying wolf, the review fairly asked why they are not aggregated into
|
|
47
|
+
* one finding per collection.
|
|
48
|
+
*
|
|
49
|
+
* Per-component is deliberate, for two reasons. It is what every sibling rule does (REF, DUP, PLK all emit per
|
|
50
|
+
* component), so a reader of the Problems panel does not have to learn that this one family counts
|
|
51
|
+
* differently. And it is what makes each finding NAVIGABLE: a finding carries `parentKey`/`idOrKey`, which is
|
|
52
|
+
* how the report groups it and how the editor places the squiggle. One aggregated finding would name a
|
|
53
|
+
* collection and leave the developer to find the 57 components inside it by hand.
|
|
54
|
+
*
|
|
55
|
+
* The cost is real and bounded: 445 findings across the whole corpus, worst project 57, both pinned by the
|
|
56
|
+
* corpus spec. If a project ever approached the panel's usable limit, a collection-level finding would be the
|
|
57
|
+
* answer — and the spec's bound is what would say so.
|
|
58
|
+
*
|
|
59
|
+
* Reads the COMPOSED document, like every rule here, so an inherited `schemas:` block is reported for the
|
|
60
|
+
* project that inherits it — correctly: that project ships it.
|
|
61
|
+
*
|
|
62
|
+
* Advisory + pure (no fs, never throws fatally).
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* How widespread the retired types are, which is the ONLY reason the severity is a warning.
|
|
66
|
+
*
|
|
67
|
+
* Re-derived by `apps/cli/src/__tests__/retiredTypeCorpus.spec.ts`, which composes every corpus project and
|
|
68
|
+
* runs THIS RULE to count — so the figures are what the rule does, with no second implementation to be wrong.
|
|
69
|
+
* Two earlier attempts both measured something adjacent and disagreed with each other. Every field here is
|
|
70
|
+
* pinned by equality in that spec; an unpinned number beside pinned ones reads as measured and is not.
|
|
71
|
+
*
|
|
72
|
+
* If these counts collapse, the migration is working and the severity deserves another look.
|
|
73
|
+
*/
|
|
74
|
+
export const RETIRED_MEASUREMENTS = {
|
|
75
|
+
/**
|
|
76
|
+
* Projects that compose successfully — the population the rule is actually offered to.
|
|
77
|
+
*
|
|
78
|
+
* 104 → 105 on 2026-08-06: the corpus gained `001-projects/nla-extensions/nla-backorder` in a merge. The
|
|
79
|
+
* other four figures did not move, so nothing about the rule's behaviour changed — only the population it
|
|
80
|
+
* was measured over. Re-derived rather than relaxed: a pinned number that is allowed to drift stops being
|
|
81
|
+
* evidence for the severity argument it supports.
|
|
82
|
+
*/
|
|
83
|
+
projectsComposed: 105,
|
|
84
|
+
/**
|
|
85
|
+
* Projects the rule FIRES on: a non-empty retired collection somewhere.
|
|
86
|
+
*
|
|
87
|
+
* The figure the severity argument needs, and the one the first version got wrong. It recorded 104 — the
|
|
88
|
+
* count of projects whose files merely MATCH `^schemas:|^reports:` — which includes 43 that declare an empty
|
|
89
|
+
* collection and emit nothing. A grep for the key still says 104; that is not this number and never was.
|
|
90
|
+
*/
|
|
91
|
+
projectsFiring: 52,
|
|
92
|
+
/** Findings across the whole corpus, and the most any single project produces. */
|
|
93
|
+
findingsTotal: 445,
|
|
94
|
+
worstProjectFindings: 57,
|
|
95
|
+
/**
|
|
96
|
+
* The split per collection: components authored, and how many projects author them.
|
|
97
|
+
*
|
|
98
|
+
* Recorded because the extension's authoring schema QUOTES these in its deprecation notices
|
|
99
|
+
* (`assets/frontend/templates/main.json`), and a number living in a JSON file in another repo has nothing
|
|
100
|
+
* holding it to reality. Pinning them here means drift fails a test that can name the other file, rather
|
|
101
|
+
* than silently telling authors to plan a migration of the wrong size.
|
|
102
|
+
*
|
|
103
|
+
* They also reconcile: 218 + 227 = 445 = `findingsTotal`, one finding per component.
|
|
104
|
+
*/
|
|
105
|
+
perCollection: {
|
|
106
|
+
schemas: { components: 218, projects: 48 },
|
|
107
|
+
reports: { components: 227, projects: 38 },
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* The types retired so far (Jazz, 2026-08-04).
|
|
112
|
+
*
|
|
113
|
+
* Exported so a test can assert the list rather than infer it from behaviour, and so a reader can see at a
|
|
114
|
+
* glance what "retired" currently covers.
|
|
115
|
+
*/
|
|
116
|
+
export const RETIRED_COLLECTIONS = [
|
|
117
|
+
{
|
|
118
|
+
collection: 'schemas',
|
|
119
|
+
label: 'Schema',
|
|
120
|
+
replacement: 'a Task (an `objects[]` entry) with `type: REFERENCE`',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
collection: 'reports',
|
|
124
|
+
label: 'Report',
|
|
125
|
+
// No `replacement`: Report is retired, and nobody has said what supersedes it. See the field's doc — the
|
|
126
|
+
// previous text here was invented, and a confident wrong answer is the worst of the three options.
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
/**
|
|
130
|
+
* The components in a collection, whichever shape it takes, with the id to report each under.
|
|
131
|
+
*
|
|
132
|
+
* Both shapes occur: most collections are lists of `{ id }`, while `transformations` and
|
|
133
|
+
* `objectAssociations` are keyed maps. A retired collection could be either, and reporting only lists would
|
|
134
|
+
* silently miss the other — a rule that finds nothing looks the same as a project with nothing to find.
|
|
135
|
+
*/
|
|
136
|
+
function componentsOf(value, collection) {
|
|
137
|
+
if (Array.isArray(value)) {
|
|
138
|
+
return value.map((entry, index) => {
|
|
139
|
+
const record = entry && typeof entry === 'object'
|
|
140
|
+
? entry
|
|
141
|
+
: {};
|
|
142
|
+
const named = locatable(record.id) ?? locatable(record.name);
|
|
143
|
+
// The POSITION when nothing locatable is there. Omitting `idOrKey` would file the finding as
|
|
144
|
+
// project-wide, which is wrong: the component exists, it has just not been named.
|
|
145
|
+
return named !== undefined
|
|
146
|
+
? { idOrKey: named, locatable: true }
|
|
147
|
+
: { idOrKey: `${collection}[${index}]`, locatable: false };
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// A keyed map — the shape `transformations` and `objectAssociations` use. The key IS the id, and it appears
|
|
151
|
+
// in the file, so it locates.
|
|
152
|
+
if (value && typeof value === 'object') {
|
|
153
|
+
return Object.keys(value).map((key) => ({
|
|
154
|
+
idOrKey: key,
|
|
155
|
+
locatable: key.trim() !== '',
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
// A scalar, `null`, or absent. Not a collection, so nothing to report — and nothing to throw over: a
|
|
159
|
+
// half-written file produces exactly these.
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* An id worth reporting AND worth searching for, or nothing.
|
|
164
|
+
*
|
|
165
|
+
* Three rejections, each one a finding that would otherwise land nowhere:
|
|
166
|
+
*
|
|
167
|
+
* * an EMPTY or whitespace-only string. `id != null` admitted `''`, and `findingsFromIssues` treats a falsy
|
|
168
|
+
* `idOrKey` as absent — so the finding was filed project-wide against `main.yaml` with no span, which is
|
|
169
|
+
* exactly what `componentsOf`'s own comment claims it prevents.
|
|
170
|
+
* * a NON-SCALAR. `String({a: 1})` is `"[object Object]"` and `String(['x','y'])` is `"x,y"`. Neither appears
|
|
171
|
+
* in the file, so neither locates, and both read as though the tool were confused rather than the template.
|
|
172
|
+
* * a boolean, for the same reason.
|
|
173
|
+
*
|
|
174
|
+
* A NUMBER is kept: a legitimate YAML scalar that appears in the file verbatim.
|
|
175
|
+
*
|
|
176
|
+
* All three are latent — the corpus has no instance of any — which is why they needed hunting rather than
|
|
177
|
+
* waiting for a bug report.
|
|
178
|
+
*/
|
|
179
|
+
function locatable(value) {
|
|
180
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
181
|
+
return String(value);
|
|
182
|
+
if (typeof value !== 'string')
|
|
183
|
+
return undefined;
|
|
184
|
+
return value.trim() === '' ? undefined : value;
|
|
185
|
+
}
|
|
186
|
+
export const retiredTypeRule = {
|
|
187
|
+
id: 'RET',
|
|
188
|
+
family: 'RET',
|
|
189
|
+
run(ctx) {
|
|
190
|
+
const document = ctx.tokenForm;
|
|
191
|
+
if (!document || typeof document !== 'object')
|
|
192
|
+
return [];
|
|
193
|
+
const issues = [];
|
|
194
|
+
for (const retired of RETIRED_COLLECTIONS) {
|
|
195
|
+
const value = document[retired.collection];
|
|
196
|
+
for (const component of componentsOf(value, retired.collection)) {
|
|
197
|
+
issues.push({
|
|
198
|
+
ruleId: 'RET-1',
|
|
199
|
+
family: 'RET',
|
|
200
|
+
// A warning, never an error. See the header for the measured reason.
|
|
201
|
+
severity: 'medium',
|
|
202
|
+
parentKey: retired.collection,
|
|
203
|
+
idOrKey: component.idOrKey,
|
|
204
|
+
message: `${retired.label} components are retired — \`${retired.collection}\` will stop being supported`,
|
|
205
|
+
// The `why` is CONCATENATED onto the message in the Problems panel, and repeats on every finding —
|
|
206
|
+
// up to 57 in one project. So it says only what the developer cannot already see: the migration
|
|
207
|
+
// target. "This is a warning and the build succeeds" was in here and is exactly what the warning
|
|
208
|
+
// icon conveys, 57 times over (review).
|
|
209
|
+
why: retired.replacement
|
|
210
|
+
? `Migrate it to ${retired.replacement}.`
|
|
211
|
+
: 'No documented successor yet — ask the platform team what to migrate it to.',
|
|
212
|
+
// The COMPONENT, not the collection key.
|
|
213
|
+
//
|
|
214
|
+
// `narrowToLocateValue` searches only INSIDE the component's own span, and the collection key sits on
|
|
215
|
+
// the line above it — so naming the collection could never narrow anything, and the published
|
|
216
|
+
// squiggle covered the whole component: 11 lines of a 12-line report, measured through the real
|
|
217
|
+
// editor wiring, and real components run to 179 lines. Naming the id narrows it to the declaring
|
|
218
|
+
// line, which is what an advisory warning should mark.
|
|
219
|
+
//
|
|
220
|
+
// Omitted for a positional fallback, which appears nowhere in the file.
|
|
221
|
+
...(component.locatable ? { locateValue: component.idOrKey } : {}),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return issues;
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=retiredType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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E,CAAC;QACzD,MAAM,MAAM,GAAsB,EAAE,CAAC;QAErC,KAAK,MAAM,OAAO,IAAI,mBAAmB,EAAE,CAAC;YAC1C,MAAM,KAAK,GAAI,QAAoC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACxE,KAAK,MAAM,SAAS,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChE,MAAM,CAAC,IAAI,CAAC;oBACV,MAAM,EAAE,OAAO;oBACf,MAAM,EAAE,KAAK;oBACb,qEAAqE;oBACrE,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE,OAAO,CAAC,UAAU;oBAC7B,OAAO,EAAE,SAAS,CAAC,OAAO;oBAC1B,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,+BAA+B,OAAO,CAAC,UAAU,8BAA8B;oBACxG,mGAAmG;oBACnG,gGAAgG;oBAChG,iGAAiG;oBACjG,wCAAwC;oBACxC,GAAG,EAAE,OAAO,CAAC,WAAW;wBACtB,CAAC,CAAC,iBAAiB,OAAO,CAAC,WAAW,GAAG;wBACzC,CAAC,CAAC,4EAA4E;oBAChF,yCAAyC;oBACzC,EAAE;oBACF,sGAAsG;oBACtG,8FAA8F;oBAC9F,gGAAgG;oBAChG,iGAAiG;oBACjG,uDAAuD;oBACvD,EAAE;oBACF,wEAAwE;oBACxE,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACnE,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ValidationRule } from '../rule.js';
|
|
2
|
+
/**
|
|
3
|
+
* Table & column integrity rule (TBL family). For each table that has a `columns`
|
|
4
|
+
* definition, checks the identity/index invariants the worker relies on for indexing
|
|
5
|
+
* and upsert. Reads the token-form; attributes issues to the table.
|
|
6
|
+
*/
|
|
7
|
+
export declare const tableRule: ValidationRule;
|
|
8
|
+
//# sourceMappingURL=tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/validate/rules/tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAsBjD;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,cAiKvB,CAAC"}
|