@sdd-method/sdd-cli 1.1.0 → 1.2.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/lib/catalogue/aggregate.d.ts.map +1 -1
- package/dist/lib/catalogue/aggregate.js +5 -4
- package/dist/lib/catalogue/aggregate.js.map +1 -1
- package/dist/lib/catalogue/build.d.ts.map +1 -1
- package/dist/lib/catalogue/build.js +2 -6
- package/dist/lib/catalogue/build.js.map +1 -1
- package/dist/lib/catalogue/builders/capability-spec.d.ts +9 -3
- package/dist/lib/catalogue/builders/capability-spec.d.ts.map +1 -1
- package/dist/lib/catalogue/builders/capability-spec.js +9 -3
- package/dist/lib/catalogue/builders/capability-spec.js.map +1 -1
- package/dist/lib/catalogue/canonical-schema.yaml +57 -6
- package/dist/lib/catalogue/coverage-predicates.d.ts +176 -0
- package/dist/lib/catalogue/coverage-predicates.d.ts.map +1 -0
- package/dist/lib/catalogue/coverage-predicates.js +603 -0
- package/dist/lib/catalogue/coverage-predicates.js.map +1 -0
- package/dist/lib/catalogue/coverage-render.d.ts +39 -0
- package/dist/lib/catalogue/coverage-render.d.ts.map +1 -0
- package/dist/lib/catalogue/coverage-render.js +347 -0
- package/dist/lib/catalogue/coverage-render.js.map +1 -0
- package/dist/lib/catalogue/coverage-run.d.ts +33 -0
- package/dist/lib/catalogue/coverage-run.d.ts.map +1 -0
- package/dist/lib/catalogue/coverage-run.js +91 -0
- package/dist/lib/catalogue/coverage-run.js.map +1 -0
- package/dist/lib/catalogue/ddl-generator.d.ts +80 -0
- package/dist/lib/catalogue/ddl-generator.d.ts.map +1 -0
- package/dist/lib/catalogue/ddl-generator.js +215 -0
- package/dist/lib/catalogue/ddl-generator.js.map +1 -0
- package/dist/lib/catalogue/engine-validator.d.ts +103 -0
- package/dist/lib/catalogue/engine-validator.d.ts.map +1 -0
- package/dist/lib/catalogue/engine-validator.js +221 -0
- package/dist/lib/catalogue/engine-validator.js.map +1 -0
- package/dist/lib/catalogue/enum-validator.d.ts.map +1 -1
- package/dist/lib/catalogue/enum-validator.js +15 -0
- package/dist/lib/catalogue/enum-validator.js.map +1 -1
- package/dist/lib/catalogue/fk-validator.d.ts +6 -0
- package/dist/lib/catalogue/fk-validator.d.ts.map +1 -1
- package/dist/lib/catalogue/fk-validator.js +6 -0
- package/dist/lib/catalogue/fk-validator.js.map +1 -1
- package/dist/lib/catalogue/gate-checks.d.ts +117 -0
- package/dist/lib/catalogue/gate-checks.d.ts.map +1 -0
- package/dist/lib/catalogue/gate-checks.js +261 -0
- package/dist/lib/catalogue/gate-checks.js.map +1 -0
- package/dist/lib/catalogue/parity-harness.d.ts +48 -0
- package/dist/lib/catalogue/parity-harness.d.ts.map +1 -0
- package/dist/lib/catalogue/parity-harness.js +76 -0
- package/dist/lib/catalogue/parity-harness.js.map +1 -0
- package/dist/lib/catalogue/schema-compat.d.ts +3 -3
- package/dist/lib/catalogue/schema-compat.js +3 -3
- package/dist/lib/catalogue/validate.d.ts.map +1 -1
- package/dist/lib/catalogue/validate.js +6 -11
- package/dist/lib/catalogue/validate.js.map +1 -1
- package/dist/verbs/catalogue.d.ts.map +1 -1
- package/dist/verbs/catalogue.js +24 -0
- package/dist/verbs/catalogue.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverage renderers — M-ADR 0205 §4.4 (A4 CS-2).
|
|
3
|
+
*
|
|
4
|
+
* Each function renders a predicate's structured result into the EXACT
|
|
5
|
+
* stdout lines its reference shell script prints. The text is a
|
|
6
|
+
* compatibility contract: adopters' findings baselines hold these literal
|
|
7
|
+
* lines, so every string here is copied from the reference, never
|
|
8
|
+
* paraphrased. Line ORDER within a predicate follows the reference's
|
|
9
|
+
* print order (metrics/controls/findings blocks); WITHIN a block the
|
|
10
|
+
* engine's total ORDER BY governs, which may differ from the reference's
|
|
11
|
+
* file-row order — baselines compare by membership, and the line-parity
|
|
12
|
+
* driver compares sorted multisets.
|
|
13
|
+
*
|
|
14
|
+
* Percentages use Python's %.1f semantics (round-half-even on the scaled
|
|
15
|
+
* value), because the references print through Python f-strings.
|
|
16
|
+
*/
|
|
17
|
+
/** Python `%.1f` — half to even at an exact scaled .5, else nearest. */
|
|
18
|
+
export function fmt1f(x) {
|
|
19
|
+
const scaled = x * 10;
|
|
20
|
+
const floor = Math.floor(scaled);
|
|
21
|
+
const diff = scaled - floor;
|
|
22
|
+
let n;
|
|
23
|
+
if (diff > 0.5)
|
|
24
|
+
n = floor + 1;
|
|
25
|
+
else if (diff < 0.5)
|
|
26
|
+
n = floor;
|
|
27
|
+
else
|
|
28
|
+
n = floor % 2 === 0 ? floor : floor + 1;
|
|
29
|
+
return (n / 10).toFixed(1);
|
|
30
|
+
}
|
|
31
|
+
export function renderRepoCapability(findings, metrics) {
|
|
32
|
+
const lines = [];
|
|
33
|
+
for (const f of findings) {
|
|
34
|
+
if (f.classification === "conflict") {
|
|
35
|
+
lines.push(`[finding] divergence: repo ${f.subjectId} declares capability_exemption ` +
|
|
36
|
+
`(${f.exemptionReason ?? ""}) but also has a repo_capability edge — an exempt repository ` +
|
|
37
|
+
`must not claim a capability (per M-ADR 0188 §4.1)`);
|
|
38
|
+
}
|
|
39
|
+
else if (f.classification === "shape_a") {
|
|
40
|
+
const names = (f.unclaimedServices ?? []).join(", ") +
|
|
41
|
+
((f.unclaimedCount ?? 0) > 3 ? " …" : "");
|
|
42
|
+
lines.push(`[finding] orphan: repo ${f.subjectId} resolves to no capability in this SDD's ` +
|
|
43
|
+
`own catalogues; its service(s) [${names}] have no capability_service row ` +
|
|
44
|
+
`here — check the aggregate's capability_service.csv for this service_id ` +
|
|
45
|
+
`before assuming the edge is missing (per M-ADR 0188 §6.2b)`);
|
|
46
|
+
}
|
|
47
|
+
else if (f.classification === "claimed_unresolved") {
|
|
48
|
+
lines.push(`[finding] orphan: repo ${f.subjectId} resolves to no capability although its ` +
|
|
49
|
+
`service(s) are claimed — check services.primary_repo_id is populated ` +
|
|
50
|
+
`(per M-ADR 0157 §4.3)`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
lines.push(`[finding] orphan: repo ${f.subjectId} resolves to no capability, has no service ` +
|
|
54
|
+
`row, and declares no capability_exemption — declare capabilities: or ` +
|
|
55
|
+
`capability_exemption (per M-ADR 0188 §4.1)`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (metrics.total > 0) {
|
|
59
|
+
const resolved = metrics.byCapability + metrics.byExemption;
|
|
60
|
+
const pct = fmt1f((100.0 * resolved) / metrics.total);
|
|
61
|
+
lines.push(`[metric] repo_capability_resolution: ${resolved}/${metrics.total} (${pct}%) ` +
|
|
62
|
+
`— ${metrics.byCapability} by capability, ${metrics.byExemption} by exemption, ` +
|
|
63
|
+
`${metrics.conflicting} conflicting, ${metrics.unresolved} unresolved`);
|
|
64
|
+
if (metrics.unresolved > 0) {
|
|
65
|
+
lines.push(`[metric] repo_capability_orphan_shape: ${metrics.shapeA} with no local ` +
|
|
66
|
+
`capability_service row for the service (check the aggregate before ` +
|
|
67
|
+
`assuming the edge is missing), ${metrics.shapeB} with no service row (declare ` +
|
|
68
|
+
`capabilities: or capability_exemption), ${metrics.other} other`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return lines;
|
|
72
|
+
}
|
|
73
|
+
function leverageNote(f) {
|
|
74
|
+
if (f.leverage === undefined)
|
|
75
|
+
return "";
|
|
76
|
+
if (f.leverage === "na")
|
|
77
|
+
return " [leverage: n/a — no primary_repo_id]";
|
|
78
|
+
if (f.leverage === "yes") {
|
|
79
|
+
return (` [leverage: yes — claiming this service would also resolve ` +
|
|
80
|
+
`repo ${f.primaryRepo}'s repo_capability shape-(a) orphan via Path X]`);
|
|
81
|
+
}
|
|
82
|
+
return ` [leverage: no — repo ${f.primaryRepo} already resolves]`;
|
|
83
|
+
}
|
|
84
|
+
export function renderServiceCapability(findings, metrics, tier) {
|
|
85
|
+
const lines = [];
|
|
86
|
+
for (const f of findings) {
|
|
87
|
+
if (f.classification === "conflict") {
|
|
88
|
+
lines.push(`[finding] divergence: service ${f.subjectId} declares service_capability_exemption ` +
|
|
89
|
+
`(${f.exemptionReason ?? ""}) but also has a capability_service edge — an exempt service ` +
|
|
90
|
+
`must not claim a capability (per M-ADR 0133 §4.2b)`);
|
|
91
|
+
}
|
|
92
|
+
else if (tier === "aggregate") {
|
|
93
|
+
lines.push(`[finding] orphan: service ${f.subjectId} resolves to no capability anywhere in ` +
|
|
94
|
+
`the merged estate and declares no exemption — M-ADR 0196 §4.1 gap class ` +
|
|
95
|
+
`unauthored-surface (not itself a method defect; remedy is to claim, ` +
|
|
96
|
+
`exempt, or accept the surface)${leverageNote(f)}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
lines.push(`[finding] coverage: service ${f.subjectId} has no capability_service row and no ` +
|
|
100
|
+
`exemption in this SDD's own catalogues — classification cannot complete ` +
|
|
101
|
+
`at member tier (a claim may exist in a sibling SDD's own ` +
|
|
102
|
+
`capability_service.csv); check the aggregate next${leverageNote(f)}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (metrics.total > 0) {
|
|
106
|
+
const resolved = metrics.claimed + metrics.exempt;
|
|
107
|
+
const pct = fmt1f((100.0 * resolved) / metrics.total);
|
|
108
|
+
const label = tier === "aggregate" ? "orphaned" : "unresolved-locally";
|
|
109
|
+
lines.push(`[metric] service_capability_resolution (tier=${tier}): ${resolved}/${metrics.total} ` +
|
|
110
|
+
`(${pct}%) — ${metrics.claimed} claimed, ${metrics.exempt} exempt, ` +
|
|
111
|
+
`${metrics.conflicting} conflicting, ${metrics.unresolved} ${label}`);
|
|
112
|
+
if (metrics.leverage !== undefined && metrics.unresolved > 0) {
|
|
113
|
+
lines.push(`[metric] service_capability_leverage (tier=${tier}): ${metrics.leverage.yes} would ` +
|
|
114
|
+
`also resolve a repo_capability shape-(a) orphan via Path X, ${metrics.leverage.no} ` +
|
|
115
|
+
`would not (repo already resolves), ${metrics.leverage.na} n/a (no primary_repo_id)`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return lines;
|
|
119
|
+
}
|
|
120
|
+
export function renderEventCoverage(res, tier) {
|
|
121
|
+
if (res.na) {
|
|
122
|
+
return [
|
|
123
|
+
`[metric] event_coverage (tier=${tier}): n/a — this unit holds no events.csv ` +
|
|
124
|
+
`rows. Both event sources (contracts/avro discovery; per-domain ` +
|
|
125
|
+
`event-catalog.yaml) are platform-profile surfaces, so for app/integration ` +
|
|
126
|
+
`units this cell classifies BY-METAMODEL (M-ADR 0196 §4.1): no event node ` +
|
|
127
|
+
`surface exists here. For a platform unit, this is an unauthored/undiscovered ` +
|
|
128
|
+
`surface instead — check contracts/avro/ and docs/domains/*/contracts/events/.`,
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
const m = res.metrics;
|
|
132
|
+
const c = res.controls;
|
|
133
|
+
const label = tier === "member" ? "unresolved-locally" : "orphaned";
|
|
134
|
+
const lines = [
|
|
135
|
+
`[metric] event_coverage (tier=${tier}): ${m.covered + m.viaContract}/${m.total} covered ` +
|
|
136
|
+
`(${m.covered} attributed, ${m.viaContract} covered-as-contract), ` +
|
|
137
|
+
`${m.unresolved} ${label}`,
|
|
138
|
+
`[metric] capability-reach (chain readout, never a verdict): ${m.capReach}/${m.total} ` +
|
|
139
|
+
`events whose attributed service is claimed by a capability`,
|
|
140
|
+
`[metric] consumer-enumerability (M-ADR 0057 analogue, never a verdict): ` +
|
|
141
|
+
`${m.consumerEnum}/${m.total} events with at least one role=consumes attribution`,
|
|
142
|
+
];
|
|
143
|
+
if (c.colUnresolving.length > 0) {
|
|
144
|
+
lines.push(`[control] publisher column set but UNRESOLVING against services.csv: ` +
|
|
145
|
+
`${c.colUnresolving.length}`);
|
|
146
|
+
for (const x of c.colUnresolving) {
|
|
147
|
+
lines.push(` - ${x.eventId} (publisher_service_id=${x.publisher})`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (c.colNoEdge.length > 0) {
|
|
151
|
+
lines.push(`[control] column-vs-edge disagreement — publisher resolves but no ` +
|
|
152
|
+
`publishes edge exists: ${c.colNoEdge.length}`);
|
|
153
|
+
for (const x of c.colNoEdge)
|
|
154
|
+
lines.push(` - ${x}`);
|
|
155
|
+
}
|
|
156
|
+
if (c.edgeNoCol.length > 0) {
|
|
157
|
+
lines.push(`[control] column-vs-edge disagreement — publishes edge exists but the ` +
|
|
158
|
+
`row's publisher column is empty: ${c.edgeNoCol.length}`);
|
|
159
|
+
for (const x of c.edgeNoCol)
|
|
160
|
+
lines.push(` - ${x}`);
|
|
161
|
+
}
|
|
162
|
+
for (const f of res.findings) {
|
|
163
|
+
if (tier === "aggregate") {
|
|
164
|
+
lines.push(`[finding] orphan: event ${f.subjectId} is attributed to nothing in the merged ` +
|
|
165
|
+
`estate — no service_event row and no resolving publisher_service_id. ` +
|
|
166
|
+
`Next checks, by authoring direction: forward — is a repo-config ` +
|
|
167
|
+
`\`events:\` block authored for its producer, or is this an avsc-only ` +
|
|
168
|
+
`discovery? reverse — is the event-catalog.yaml \`publisher\` field ` +
|
|
169
|
+
`empty, or the catalog file absent for its domain (the 0156 class)? ` +
|
|
170
|
+
`Do not 'declare the event' — the row already exists; what is missing ` +
|
|
171
|
+
`is attribution.`);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
lines.push(`[report] unresolved-locally: event ${f.subjectId} carries no local attribution. ` +
|
|
175
|
+
`A sibling's event-catalog consumers[] may attribute it at aggregate ` +
|
|
176
|
+
`tier; absence is not assertable here (M-ADR 0199 §4.3).`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return lines;
|
|
180
|
+
}
|
|
181
|
+
export function renderContractCoverage(res, tier) {
|
|
182
|
+
if (res.na) {
|
|
183
|
+
return [
|
|
184
|
+
`[metric] contract_coverage (tier=${tier}): n/a — this unit holds no ` +
|
|
185
|
+
`contracts.csv rows, so there is no population to score. The contracts ` +
|
|
186
|
+
`discoverer is unconditional across profiles, so this is an unauthored ` +
|
|
187
|
+
`surface at the node catalogue (M-ADR 0196 §4.1), not out of scope by profile.`,
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
const lines = [];
|
|
191
|
+
if (res.availability !== undefined) {
|
|
192
|
+
lines.push(`[info] availability manifest: ${res.availability.attested} attested artefact(s), ` +
|
|
193
|
+
`${res.availability.unmodelled.length} with no contract row (attested but not ` +
|
|
194
|
+
`declared-external — participation is a separate claim, M-ADR 0202)`);
|
|
195
|
+
for (const pp of res.availability.unmodelled)
|
|
196
|
+
lines.push(` - ${pp}`);
|
|
197
|
+
}
|
|
198
|
+
if (res.availabilityWarning !== undefined) {
|
|
199
|
+
lines.push(`[warn] availability manifest unreadable: ${res.availabilityWarning}`);
|
|
200
|
+
}
|
|
201
|
+
for (const f of res.findings) {
|
|
202
|
+
if (f.kind === "divergence") {
|
|
203
|
+
lines.push(`[finding] divergence: contract ${f.subjectId} is excluded from scoring ` +
|
|
204
|
+
`(${f.classification}) but also carries a live ` +
|
|
205
|
+
`capability_contract or service_contract edge — the exclusion asserts it ` +
|
|
206
|
+
`is not expected to be reachable and the edge says it is; check which is ` +
|
|
207
|
+
`stale`);
|
|
208
|
+
}
|
|
209
|
+
else if (tier === "aggregate") {
|
|
210
|
+
lines.push(`[finding] orphan: contract ${f.subjectId} is reachable from nothing in the ` +
|
|
211
|
+
`merged estate — no capability_contract row (no owner in the product ` +
|
|
212
|
+
`model) and no service_contract row (no runtime attribution). Under ` +
|
|
213
|
+
`M-ADR 0057 lock semantics its consumers cannot be enumerated, so it ` +
|
|
214
|
+
`can be neither safely changed nor safely retired. Next checks: is a ` +
|
|
215
|
+
`traceability.contracts entry authored but unresolved (see the ` +
|
|
216
|
+
`capability_contract orphan findings from the build), and does this ` +
|
|
217
|
+
`estate have an exposes surface at all (repo-config contracts: ` +
|
|
218
|
+
`blocks)? If this contract is legitimately unreachable, none of the ` +
|
|
219
|
+
`four scoped-out states covers it — raise it, because that case is ` +
|
|
220
|
+
`the trigger for opening an exemption vocabulary`);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
lines.push(`[finding] coverage: contract ${f.subjectId} has no capability_contract and no ` +
|
|
224
|
+
`service_contract row in this SDD's own catalogues — classification ` +
|
|
225
|
+
`cannot complete at member tier, because a service_contract row about ` +
|
|
226
|
+
`this contract may be authored in a sibling SDD (both its FKs are ` +
|
|
227
|
+
`external). Check the aggregate next`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const m = res.metrics;
|
|
231
|
+
const resolved = m.covered + m.viaEvent + m.excluded;
|
|
232
|
+
const label = tier === "aggregate" ? "orphaned" : "unresolved-locally";
|
|
233
|
+
lines.push(`[metric] contract_coverage (tier=${tier}): ${resolved}/${m.total} ` +
|
|
234
|
+
`(${fmt1f((100.0 * resolved) / m.total)}%) — ${m.covered} covered, ${m.viaEvent} ` +
|
|
235
|
+
`covered-as-event, ${m.excluded} excluded, ${m.conflicting} conflicting, ` +
|
|
236
|
+
`${m.unresolved} ${label}`);
|
|
237
|
+
const exclusionKeys = Object.keys(m.byExclusion).sort();
|
|
238
|
+
if (exclusionKeys.length > 0) {
|
|
239
|
+
lines.push(`[metric] contract_excluded (tier=${tier}): ` +
|
|
240
|
+
exclusionKeys.map((k) => `${k} ${m.byExclusion[k]}`).join(", "));
|
|
241
|
+
}
|
|
242
|
+
lines.push(`[metric] contract_consumer_enumerable (tier=${tier}): ${m.consumersNamed}/${m.total} ` +
|
|
243
|
+
`(${fmt1f((100.0 * m.consumersNamed) / m.total)}%) carry a service_contract role=consumes ` +
|
|
244
|
+
`row. This is the property M-ADR 0057 lock semantics need and it is REPORTED, NOT ` +
|
|
245
|
+
`VERDICTED: the consumes surface is reverse-method only (an adopter alias map over ` +
|
|
246
|
+
`service-architecture.md), so a forward-authored estate scores zero here by ` +
|
|
247
|
+
`construction rather than by neglect`);
|
|
248
|
+
lines.push(`[metric] contract_attribution_shape (tier=${tier}): ${m.ownedOnly} owner-only, ` +
|
|
249
|
+
`${m.attrOnly} runtime-only, ${m.both} both — a population covered wholly by one edge ` +
|
|
250
|
+
`rests on one authoring surface`);
|
|
251
|
+
return lines;
|
|
252
|
+
}
|
|
253
|
+
// ─── the nine Phase-0 gate checks ────────────────────────────────────────
|
|
254
|
+
export function renderEventCatalogueCheck(gaps) {
|
|
255
|
+
return gaps.map((g) => `[finding] coverage: domain ${g.domain} event-catalog.yaml declares ${g.declared} events but events.csv contains ${g.emitted} rows for that domain (per ADR 0156 Phase 0)`);
|
|
256
|
+
}
|
|
257
|
+
export function renderRepoEdgesCheck(res) {
|
|
258
|
+
const lines = [];
|
|
259
|
+
if (res.repoCapabilityGap) {
|
|
260
|
+
const g = res.repoCapabilityGap;
|
|
261
|
+
lines.push(`[finding] coverage: repo_capability.csv is empty but ${g.capabilityService} capability_service rows + ${g.servicesWithRepo} services with primary_repo_id present — reverse-method derivation likely missing (per ADR 0157 §4.3, Phase 0)`);
|
|
262
|
+
}
|
|
263
|
+
if (res.repoContractForwardGap) {
|
|
264
|
+
const g = res.repoContractForwardGap;
|
|
265
|
+
lines.push(`[finding] coverage: repo_contract.csv is empty but ${g.contracts} contracts and ${g.repoConfigsWithContracts} repo-configs with contracts: blocks present — forward-method derivation likely missing (per ADR 0157 §4.2, Phase 0)`);
|
|
266
|
+
}
|
|
267
|
+
if (res.repoContractPathXGap) {
|
|
268
|
+
const g = res.repoContractPathXGap;
|
|
269
|
+
lines.push(`[finding] coverage: repo_contract.csv is empty but ${g.serviceContracts} service_contract rows + ${g.servicesWithRepo} services with primary_repo_id present — reverse-method Path X (service_contract ⋈ services.primary_repo_id) derivation likely missing (per ADR 0157 §4.2, Phase 0)`);
|
|
270
|
+
}
|
|
271
|
+
if (res.repoContractReverseGap) {
|
|
272
|
+
const g = res.repoContractReverseGap;
|
|
273
|
+
lines.push(`[finding] coverage: repo_contract.csv is empty with ${g.contracts} contracts present and no repo-config.contracts: blocks or service_contract rows — reverse-method derivation via contracts.source_repo_id likely missing (per ADR 0157 §4.2, Phase 0)`);
|
|
274
|
+
}
|
|
275
|
+
return lines;
|
|
276
|
+
}
|
|
277
|
+
export function renderGlossaryXrefCheck(finding) {
|
|
278
|
+
return finding
|
|
279
|
+
? [
|
|
280
|
+
`[finding] coverage: docs/platform/reference/glossary-alignment-manifest.yaml exists but glossary_xref.csv emits 0 rows — multi-source derivation likely missing (per ADR 0158 §4.5, Phase 0)`,
|
|
281
|
+
]
|
|
282
|
+
: [];
|
|
283
|
+
}
|
|
284
|
+
export function renderDataModelEntitiesCheck(res) {
|
|
285
|
+
const lines = [];
|
|
286
|
+
if (res.entitiesGap) {
|
|
287
|
+
lines.push(`[finding] coverage: ${res.entitiesGap.domainModels} domain-model files catalogued but entities.csv emits 0 rows — reverse-method entity extraction missing (per ADR 0159 Phase 0)`);
|
|
288
|
+
}
|
|
289
|
+
if (res.serviceEntityGap) {
|
|
290
|
+
const g = res.serviceEntityGap;
|
|
291
|
+
lines.push(`[finding] coverage: ${g.entities} entities + ${g.services} services catalogued but service_entity.csv emits 0 rows — Data Store Mapping ingestion missing (per ADR 0159 Phase 0)`);
|
|
292
|
+
}
|
|
293
|
+
if (res.containerEntityGap) {
|
|
294
|
+
const g = res.containerEntityGap;
|
|
295
|
+
lines.push(`[finding] coverage: ${g.containersWithService} containers map to services + ${g.serviceEntity} service_entity edges present but c4_container_entity.csv emits 0 rows — Phase 3 derivation missing (per ADR 0159 Phase 0)`);
|
|
296
|
+
}
|
|
297
|
+
return lines;
|
|
298
|
+
}
|
|
299
|
+
export function renderCapabilityEventCheck(res) {
|
|
300
|
+
const lines = [];
|
|
301
|
+
if (res.derivableGap) {
|
|
302
|
+
const g = res.derivableGap;
|
|
303
|
+
lines.push(`[finding] coverage: service_event (${g.serviceEvent}) + capability_service (${g.capabilityService}) populated but capability_event emits 0 rows — reverse-derivable edge missing (per ADR 0160 Phase 0)`);
|
|
304
|
+
}
|
|
305
|
+
if (res.authoredGap) {
|
|
306
|
+
lines.push(`[finding] coverage: capability_event has ${res.authoredGap.derived} derived rows but 0 authored rows — no traceability.events[] or traceability.contracts.{published,consumed}_events declarations are landing in the catalogue. Governance queries filtering to source=authored will return empty (per ADR 0160 Phase 0)`);
|
|
307
|
+
}
|
|
308
|
+
return lines;
|
|
309
|
+
}
|
|
310
|
+
export function renderFeatureEventCheck(res) {
|
|
311
|
+
return res.gap
|
|
312
|
+
? [
|
|
313
|
+
`[finding] coverage: service_event (${res.gap.serviceEvent}) + feature_service (${res.gap.featureService}) populated but feature_event emits 0 rows — reverse-derivable edge missing (per ADR 0161 Phase 0)`,
|
|
314
|
+
]
|
|
315
|
+
: [];
|
|
316
|
+
}
|
|
317
|
+
export function renderPlatformDependenciesCheck(finding) {
|
|
318
|
+
return finding
|
|
319
|
+
? [
|
|
320
|
+
`[finding] coverage: app-platform-dependencies.yaml declares a platform_dependencies block but product_platform_dependencies.csv emits 0 rows — forward-method ingestion missing (per ADR 0162 Phase 0). Resolves once the builder reads the forward source.`,
|
|
321
|
+
]
|
|
322
|
+
: [];
|
|
323
|
+
}
|
|
324
|
+
export function renderFeatureSpecPromotionCheck(res) {
|
|
325
|
+
if (!res.finding)
|
|
326
|
+
return [];
|
|
327
|
+
const f = res.finding;
|
|
328
|
+
return [
|
|
329
|
+
`[finding] coverage: ${f.intermediate} of ${f.total} features are reverse-intermediate ` +
|
|
330
|
+
`(capability-spec/feature-grounding) not yet promoted to feature-spec — ` +
|
|
331
|
+
`unresolvable as realises:/FK targets (${f.pctResolvable}% resolvable, ${f.note}; ` +
|
|
332
|
+
`per ADR 0177 §4.2)`,
|
|
333
|
+
];
|
|
334
|
+
}
|
|
335
|
+
export function renderFeatureSurfaceDuplicationCheck(res) {
|
|
336
|
+
if (!res.finding)
|
|
337
|
+
return [];
|
|
338
|
+
const f = res.finding;
|
|
339
|
+
const capWord = f.capabilities === 1 ? "capability" : "capabilities";
|
|
340
|
+
return [
|
|
341
|
+
`[finding] coverage: ${f.pairs} near-duplicate feature surface(s) across ` +
|
|
342
|
+
`${f.capabilities} ${capWord} — a capability-spec (rollup) and feature-grounding ` +
|
|
343
|
+
`(detailed) slug naming the same surface; reconcile to one slug per surface, ` +
|
|
344
|
+
`detailed slug canonical (per ADR 0177 §4.3)`,
|
|
345
|
+
];
|
|
346
|
+
}
|
|
347
|
+
//# sourceMappingURL=coverage-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-render.js","sourceRoot":"","sources":["../../../src/lib/catalogue/coverage-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmBH,wEAAwE;AACxE,MAAM,UAAU,KAAK,CAAC,CAAS;IAC7B,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAS,CAAC;IACd,IAAI,IAAI,GAAG,GAAG;QAAE,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;SACzB,IAAI,IAAI,GAAG,GAAG;QAAE,CAAC,GAAG,KAAK,CAAC;;QAC1B,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;IAC7C,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,QAAoC,EACpC,OAA8B;IAE9B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,cAAc,KAAK,UAAU,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CACR,8BAA8B,CAAC,CAAC,SAAS,iCAAiC;gBACxE,IAAI,C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AO,sDAAsD;YAClF,8EAA8E;YAC9E,6CAA6C;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverage mode — `sdd-cli catalogue validate --coverage` (A4 CS-2).
|
|
3
|
+
*
|
|
4
|
+
* Runs the thirteen engine coverage predicates against a catalogues
|
|
5
|
+
* directory and prints EXACTLY the lines the reference shell scripts
|
|
6
|
+
* printed (coverage-render.ts holds the text contract), in a fixed block
|
|
7
|
+
* order: the four catalogue-classics (repo-capability, service-capability,
|
|
8
|
+
* event, contract), then the nine Phase-0 gate checks in the
|
|
9
|
+
* catalogue-integrity-gate's step order. Nothing else is written to
|
|
10
|
+
* stdout — the gate swaps N script invocations for one CLI call and the
|
|
11
|
+
* stream stays parseable by the same baseline machinery.
|
|
12
|
+
*
|
|
13
|
+
* Exit code is 0 in normal operation, exactly as the reference scripts:
|
|
14
|
+
* gating is the findings baseline's job, never this mode's. A classifier
|
|
15
|
+
* probe failure throws (the references exit 2).
|
|
16
|
+
*
|
|
17
|
+
* The one deliberately-unported check is check-repo-config-coverage.sh:
|
|
18
|
+
* it reads the AUTHORING surface, is text-shaped by design (A0's
|
|
19
|
+
* classification), and stays shell.
|
|
20
|
+
*/
|
|
21
|
+
import { type CoverageTier } from "./coverage-predicates.js";
|
|
22
|
+
export interface CoverageRunInputs {
|
|
23
|
+
/** SDD repo root (defaults to cwd) — authored surfaces resolve here. */
|
|
24
|
+
readonly sddPath?: string;
|
|
25
|
+
/** Catalogues directory, relative to the SDD root (default `catalogues`). */
|
|
26
|
+
readonly cataloguesDir?: string;
|
|
27
|
+
/** Explicit tier, never inferred (M-ADR 0196 §4.3). Default member. */
|
|
28
|
+
readonly tier?: CoverageTier;
|
|
29
|
+
}
|
|
30
|
+
export declare function runCatalogueCoverage(inputs: CoverageRunInputs, write: (s: string) => void): Promise<{
|
|
31
|
+
exitCode: number;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=coverage-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-run.d.ts","sourceRoot":"","sources":["../../../src/lib/catalogue/coverage-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AA4BlC,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;CAC9B;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA6E/B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coverage mode — `sdd-cli catalogue validate --coverage` (A4 CS-2).
|
|
3
|
+
*
|
|
4
|
+
* Runs the thirteen engine coverage predicates against a catalogues
|
|
5
|
+
* directory and prints EXACTLY the lines the reference shell scripts
|
|
6
|
+
* printed (coverage-render.ts holds the text contract), in a fixed block
|
|
7
|
+
* order: the four catalogue-classics (repo-capability, service-capability,
|
|
8
|
+
* event, contract), then the nine Phase-0 gate checks in the
|
|
9
|
+
* catalogue-integrity-gate's step order. Nothing else is written to
|
|
10
|
+
* stdout — the gate swaps N script invocations for one CLI call and the
|
|
11
|
+
* stream stays parseable by the same baseline machinery.
|
|
12
|
+
*
|
|
13
|
+
* Exit code is 0 in normal operation, exactly as the reference scripts:
|
|
14
|
+
* gating is the findings baseline's job, never this mode's. A classifier
|
|
15
|
+
* probe failure throws (the references exit 2).
|
|
16
|
+
*
|
|
17
|
+
* The one deliberately-unported check is check-repo-config-coverage.sh:
|
|
18
|
+
* it reads the AUTHORING surface, is text-shaped by design (A0's
|
|
19
|
+
* classification), and stays shell.
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync } from "node:fs";
|
|
22
|
+
import { join, resolve } from "node:path";
|
|
23
|
+
import { readCatalogueCsv } from "./csv-reader.js";
|
|
24
|
+
import { createEngineSession } from "./engine-validator.js";
|
|
25
|
+
import { loadCanonicalSchema } from "./schema-loader.js";
|
|
26
|
+
import { runContractCoverage, runEventCoverage, runRepoCapabilityCoverage, runServiceCapabilityCoverage, } from "./coverage-predicates.js";
|
|
27
|
+
import { runCapabilityEventCheck, runDataModelEntitiesCheck, runEventCatalogueCheck, runFeatureEventCheck, runFeatureSpecPromotionCheck, runFeatureSurfaceDuplicationCheck, runGlossaryXrefCheck, runPlatformDependenciesCheck, runRepoEdgesCheck, } from "./gate-checks.js";
|
|
28
|
+
import { renderCapabilityEventCheck, renderContractCoverage, renderDataModelEntitiesCheck, renderEventCatalogueCheck, renderEventCoverage, renderFeatureEventCheck, renderFeatureSpecPromotionCheck, renderFeatureSurfaceDuplicationCheck, renderGlossaryXrefCheck, renderPlatformDependenciesCheck, renderRepoCapability, renderRepoEdgesCheck, renderServiceCapability, } from "./coverage-render.js";
|
|
29
|
+
export async function runCatalogueCoverage(inputs, write) {
|
|
30
|
+
const sddRoot = resolve(inputs.sddPath ?? process.cwd());
|
|
31
|
+
const dir = resolve(sddRoot, inputs.cataloguesDir ?? "catalogues");
|
|
32
|
+
const tier = inputs.tier ?? "member";
|
|
33
|
+
const schema = await loadCanonicalSchema();
|
|
34
|
+
const present = (name) => existsSync(join(dir, `${name}.csv`));
|
|
35
|
+
const rowsByCatalogue = new Map();
|
|
36
|
+
for (const cat of schema.catalogues) {
|
|
37
|
+
if (!present(cat.name))
|
|
38
|
+
continue;
|
|
39
|
+
const parsed = await readCatalogueCsv(join(dir, `${cat.name}.csv`));
|
|
40
|
+
rowsByCatalogue.set(cat.name, parsed.rows);
|
|
41
|
+
}
|
|
42
|
+
const session = await createEngineSession(schema, rowsByCatalogue);
|
|
43
|
+
const lines = [];
|
|
44
|
+
try {
|
|
45
|
+
// The four catalogue-classics, each anchored on its population file
|
|
46
|
+
// exactly as the reference scripts anchor (absent file → silent).
|
|
47
|
+
if (present("repositories")) {
|
|
48
|
+
const r = await runRepoCapabilityCoverage(session);
|
|
49
|
+
lines.push(...renderRepoCapability(r.findings, r.metrics));
|
|
50
|
+
}
|
|
51
|
+
if (present("services")) {
|
|
52
|
+
const r = await runServiceCapabilityCoverage(session, {
|
|
53
|
+
tier,
|
|
54
|
+
repoCapabilityAvailable: present("repo_capability"),
|
|
55
|
+
});
|
|
56
|
+
lines.push(...renderServiceCapability(r.findings, r.metrics, tier));
|
|
57
|
+
}
|
|
58
|
+
if (present("events")) {
|
|
59
|
+
const r = await runEventCoverage(session, { tier });
|
|
60
|
+
lines.push(...renderEventCoverage(r, tier));
|
|
61
|
+
}
|
|
62
|
+
if (present("contracts")) {
|
|
63
|
+
const r = await runContractCoverage(session, { tier, sddRoot });
|
|
64
|
+
lines.push(...renderContractCoverage(r, tier));
|
|
65
|
+
}
|
|
66
|
+
// The nine Phase-0 gate checks, in the gate's step order.
|
|
67
|
+
const eventCatalogue = await runEventCatalogueCheck(session, {
|
|
68
|
+
sddRoot,
|
|
69
|
+
eventsPresent: present("events"),
|
|
70
|
+
});
|
|
71
|
+
lines.push(...renderEventCatalogueCheck(eventCatalogue.gaps));
|
|
72
|
+
lines.push(...renderRepoEdgesCheck(await runRepoEdgesCheck(session, { sddRoot })));
|
|
73
|
+
lines.push(...renderGlossaryXrefCheck((await runGlossaryXrefCheck(session, {
|
|
74
|
+
sddRoot,
|
|
75
|
+
xrefPresent: present("glossary_xref"),
|
|
76
|
+
})).finding));
|
|
77
|
+
lines.push(...renderDataModelEntitiesCheck(await runDataModelEntitiesCheck(session)));
|
|
78
|
+
lines.push(...renderCapabilityEventCheck(await runCapabilityEventCheck(session)));
|
|
79
|
+
lines.push(...renderFeatureEventCheck(await runFeatureEventCheck(session)));
|
|
80
|
+
lines.push(...renderPlatformDependenciesCheck((await runPlatformDependenciesCheck(session, { sddRoot })).finding));
|
|
81
|
+
lines.push(...renderFeatureSpecPromotionCheck(await runFeatureSpecPromotionCheck(session)));
|
|
82
|
+
lines.push(...renderFeatureSurfaceDuplicationCheck(await runFeatureSurfaceDuplicationCheck(session)));
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
session.dispose();
|
|
86
|
+
}
|
|
87
|
+
for (const line of lines)
|
|
88
|
+
write(`${line}\n`);
|
|
89
|
+
return { exitCode: 0 };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=coverage-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-run.js","sourceRoot":"","sources":["../../../src/lib/catalogue/coverage-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,yBAAyB,EACzB,4BAA4B,GAE7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAC5B,iCAAiC,EACjC,oBAAoB,EACpB,4BAA4B,EAC5B,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,4BAA4B,EAC5B,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB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4.3 (engine-evolution Phase A1).
|
|
3
|
+
*
|
|
4
|
+
* Emits, from the loaded canonical schema:
|
|
5
|
+
* (a) CREATE TABLE DDL for every declared catalogue, typed per the
|
|
6
|
+
* schema's column types; and
|
|
7
|
+
* (b) a deterministic list of constraint-violation queries (fk | pk |
|
|
8
|
+
* enum) whose row semantics mirror fk-validator.ts and
|
|
9
|
+
* enum-validator.ts EXACTLY — the Phase A2 dual-run comparison
|
|
10
|
+
* (old path vs engine path, count AND list) depends on that
|
|
11
|
+
* equivalence, so any semantic change here must change there too:
|
|
12
|
+
* - fk: a required (non-nullable, non-external) FK fails when
|
|
13
|
+
* empty; a non-empty value must resolve against the target
|
|
14
|
+
* catalogue's primary keys unless the FK is effective-external
|
|
15
|
+
* (declared `external`, or external for the build's profile via
|
|
16
|
+
* `externalForProfiles`) — mirroring FkValidationOptions.
|
|
17
|
+
* - pk: duplicate non-empty primary-key values.
|
|
18
|
+
* - enum: a non-empty (trimmed) bound-column value outside the
|
|
19
|
+
* bound enum's declared set. Emptiness is nullability's concern,
|
|
20
|
+
* not the enum's, exactly as in enum-validator.ts.
|
|
21
|
+
*
|
|
22
|
+
* Determinism per M-ADR 0205 §4.2: emission order is the schema's own
|
|
23
|
+
* declaration order; every query carries a total ORDER BY.
|
|
24
|
+
*
|
|
25
|
+
* Digest coupling per §4.3 is inherited, not re-implemented: this module
|
|
26
|
+
* reads the schema through loadCanonicalSchema, and the vendored copy it
|
|
27
|
+
* loads is guarded by canonical-schema-drift.test.ts.
|
|
28
|
+
*
|
|
29
|
+
* There is NO hand-maintained DDL anywhere: an unknown column type or a
|
|
30
|
+
* binding to an unknown enum throws at generation time — loud, never a
|
|
31
|
+
* silent fallback (the known*Ids.has() lesson).
|
|
32
|
+
*/
|
|
33
|
+
import type { CanonicalSchema, ForeignKeyDef } from "./schema-loader.js";
|
|
34
|
+
import type { FkValidationOptions } from "./fk-validator.js";
|
|
35
|
+
/** Engine type for a schema column type; throws on an unmapped type. */
|
|
36
|
+
export declare function sqlType(catalogue: string, column: string, type: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* The one definition of effective-external, shared with the engine
|
|
39
|
+
* validator so the three consumers (fk-validator.ts, the query generator,
|
|
40
|
+
* engine-validator.ts) cannot drift: declared `external`, or external for
|
|
41
|
+
* the build's profile via `externalForProfiles`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isEffectiveExternal(fk: ForeignKeyDef, options: FkValidationOptions): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* One CREATE TABLE statement per catalogue, in schema declaration order.
|
|
46
|
+
* Plain typed columns only: enforcement of PK/FK/enum semantics lives in
|
|
47
|
+
* the violation queries, whose findings-shaped output (never a load
|
|
48
|
+
* abort) is what the validators' exit contracts need.
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateTableDdl(schema: CanonicalSchema): readonly string[];
|
|
51
|
+
export type ConstraintKind = "fk" | "pk" | "enum";
|
|
52
|
+
export interface ConstraintQuery {
|
|
53
|
+
readonly catalogue: string;
|
|
54
|
+
readonly kind: ConstraintKind;
|
|
55
|
+
/** The constrained column (fk/enum) or the primary-key column (pk). */
|
|
56
|
+
readonly column: string;
|
|
57
|
+
/** For fk: the "{catalogue}.{column}" target. For enum: the enum name. */
|
|
58
|
+
readonly target?: string;
|
|
59
|
+
/**
|
|
60
|
+
* SELECT returning one row per violation with a total ORDER BY.
|
|
61
|
+
* fk/enum rows: (row_pk, value). pk rows: (row_pk, n).
|
|
62
|
+
*/
|
|
63
|
+
readonly sql: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The violation-query set for a schema, mirroring the in-memory
|
|
67
|
+
* validators' semantics under the same options they take.
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateConstraintQueries(schema: CanonicalSchema, options?: FkValidationOptions): readonly ConstraintQuery[];
|
|
70
|
+
/**
|
|
71
|
+
* Dangling-value queries for the FKs the main set SKIPS as
|
|
72
|
+
* effective-external — one query per skipped FK, returning the rows the
|
|
73
|
+
* in-memory path logs as `[finding] external` (unresolved non-empty
|
|
74
|
+
* values; resolution happens at aggregation). Empty when
|
|
75
|
+
* treatExternalAsInternal is set, exactly as the main set then skips
|
|
76
|
+
* nothing. Kept separate from generateConstraintQueries because these
|
|
77
|
+
* rows are FINDINGS, not failures — the exit contracts differ.
|
|
78
|
+
*/
|
|
79
|
+
export declare function generateExternalFindingQueries(schema: CanonicalSchema, options?: FkValidationOptions): readonly ConstraintQuery[];
|
|
80
|
+
//# sourceMappingURL=ddl-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddl-generator.d.ts","sourceRoot":"","sources":["../../../src/lib/catalogue/ddl-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EACV,eAAe,EAEf,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAY7D,wEAAwE;AACxE,wBAAgB,OAAO,CACrB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,MAAM,CAQR;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,aAAa,EACjB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAMT;AAeD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,MAAM,EAAE,CAO3E;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,CAAC,EAA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