@sigloch/contracts 12.13.0 → 12.13.1

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.
@@ -66,7 +66,8 @@ export const RULE_HELP = {
66
66
  },
67
67
  'AF-05': {
68
68
  plain: "Parts of the model are not built yet and nobody has ordered the work → derive the build order.",
69
- se: "Unbuilt elements exist (`TEST` / `FUNC` / `SCHEMA` without a binding, the exemptions of R-19/R-20/R-26 apply) and no `CR` has `status: open`. The plan is the set of open CRs, not a stamp; it falls due again with every change (CR-SM-395).",
69
+ se: "Unbuilt elements exist (`TEST` / `FUNC` / `SCHEMA` without a binding, the exemptions of R-19/R-20/R-26 apply) and no `CR` has `status: open`. The plan is the set of open CRs, not a stamp; it falls due again with every change (CR-SM-395)." +
70
+ " One finding for the whole graph, at the `SYS`; the message names the unbuilt elements.",
70
71
  prompt: "se-plan",
71
72
  },
72
73
  'BQ-01': {
@@ -116,7 +117,8 @@ export const RULE_HELP = {
116
117
  },
117
118
  'CR-R03': {
118
119
  plain: "Several open changes touch the same thing, so they will collide → sequence them or merge them.",
119
- se: "One element tracked by more than one `CR` with `status` open/in-progress.",
120
+ se: "One element tracked by more than one `CR` with `status` open/in-progress." +
121
+ " One finding per set of CRs, not per element: the first element in sort order carries it, the others stand in the message and in `context.also_affects`.",
120
122
  vorschlag: 'Kläre, welcher der offenen Änderungsaufträge an {n} zuerst ändert.',
121
123
  },
122
124
  'FC-03': {
@@ -158,9 +160,9 @@ export const RULE_HELP = {
158
160
  vorschlag: 'Gib den hohen Risiken {n} einen Test.',
159
161
  },
160
162
  'IO-01': {
161
- plain: "Two steps in the same sequence have no described data passing between them → add the data one hands to the other.",
162
- se: "A `FUNC` pair inside one `FCHAIN` with no `io` path (`FUNC -io-> FLOW -io-> FUNC`) connecting them.",
163
- vorschlag: 'Ergänze den Datenfluss zwischen den Schritten {n}.',
163
+ plain: "A step of this sequence is not connected to the others by any data passing → check in the code whether it hands data to the sequence; if it does, add that data, if not, take the step out of the sequence.",
164
+ se: "A `FUNC` of an `FCHAIN` that has `io` edges but no path `FUNC -io-> FLOW -io-> FUNC` to the largest connected group of members. One finding per cut-off member, not per pair; a member with no `io` edge at all is R-31's. Often the member does not belong in the chain.",
165
+ vorschlag: 'Prüfe am Code, ob die Schritte {n} Daten an ihre Kette übergeben: ergänze dann den Datenfluss, sonst nimm sie aus der Kette.',
164
166
  },
165
167
  'IO-02': {
166
168
  plain: "Two different places write into the same flow, so a reader cannot tell which version arrives \u2192 give each source its own flow; they may keep sharing one contract.",
@@ -188,9 +190,10 @@ export const RULE_HELP = {
188
190
  vorschlag: 'Prüfe die Abhängigkeiten des Moduls {n}.',
189
191
  },
190
192
  'MT-02': {
191
- plain: "The parts inside this module never talk to each other → it is really several modules in one.",
192
- se: "LCOM4 over the BOXES of this module whitebox: its sub-MODs (`MOD -compose-> MOD`) plus its directly allocated `FUNC`s. A box owns its whole subtree, so a decomposed block carries the contracts of its leaves — the same ownership chain R-04 (CR-SM-282), BW-02 (CR-SM-283) and R-23 (CR-SM-321) use; without it a container counted as an empty group of its own and the number grew with decomposition DEPTH (CR-SM-326). Connected means a shared CONTRACT (`FLOW -relation-> SCHEMA`, else the untyped flow) — the same counting base as CR-01/R-04/MT-01 since CR-SM-274/276, not FLOW identity. CR-SM-297 dropped `satisfy`: two FUNCs meeting the same requirement can be fully decoupled at runtime, and if they share one, the REQUIREMENT is what needs decomposing. `null` (no judgement) below two boxes and where no box carries a contract at all — an unwired FUNC is R-31's statement, at the element. `info` from `metricPolicy.lcom4.info`, `warning` from `.warning` (CR-GC-329).",
193
- vorschlag: 'Teile das Modul {n}, seine Teile arbeiten nicht zusammen.',
193
+ plain: "The parts inside this module never talk to each other → it may be several modules in one; check the role and the fit of the parts, and split it only if they belong apart.",
194
+ se: "LCOM4 over the BOXES of this module whitebox: its sub-MODs (`MOD -compose-> MOD`) plus its directly allocated `FUNC`s. A box owns its whole subtree, so a decomposed block carries the contracts of its leaves — the same ownership chain R-04 (CR-SM-282), BW-02 (CR-SM-283) and R-23 (CR-SM-321) use; without it a container counted as an empty group of its own and the number grew with decomposition DEPTH (CR-SM-326). Connected means a shared CONTRACT (`FLOW -relation-> SCHEMA`, else the untyped flow) — the same counting base as CR-01/R-04/MT-01 since CR-SM-274/276, not FLOW identity. CR-SM-297 dropped `satisfy`: two FUNCs meeting the same requirement can be fully decoupled at runtime, and if they share one, the REQUIREMENT is what needs decomposing. `null` (no judgement) below two boxes and where no box carries a contract at all — an unwired FUNC is R-31's statement, at the element. `info` from `metricPolicy.lcom4.info`, `warning` from `.warning` (CR-GC-329)." +
195
+ " The number alone is no reason to split: the role of the module and the fit of its parts decide.",
196
+ vorschlag: 'Prüfe Rolle und Passung der Teile von Modul {n}; teile es nur, wenn sie fachlich nicht zusammengehören.',
194
197
  },
195
198
  'MT-04': {
196
199
  plain: "This block's parts never talk to each other → it is really two blocks that happen to sit under one name.",
@@ -198,12 +201,14 @@ export const RULE_HELP = {
198
201
  },
199
202
  'ND-01': {
200
203
  plain: "Two functions look like the same function written twice → merge them, or make clear what each one does differently.",
201
- se: "Near-duplicate `FUNC` above 0.85 similarity (name, description and legal trace partners). Since CR-SM-286 the similarity is computed IN the rule, cached per graph — before that it had to be injected, and without injection the rule returned green, indistinguishable from \"no duplicates\".",
204
+ se: "Near-duplicate `FUNC` above 0.85 similarity (name, description and legal trace partners). Since CR-SM-286 the similarity is computed IN the rule, cached per graph — before that it had to be injected, and without injection the rule returned green, indistinguishable from \"no duplicates\"." +
205
+ " It finds copies and semantic duplicates in the model, not parallel paths in the code: two ways to do the same task share a bottleneck, not a name (spike CR-GC-637).",
202
206
  vorschlag: 'Führe die doppelten Funktionen {n} zusammen oder grenze sie ab.',
203
207
  },
204
208
  'ND-02': {
205
209
  plain: "Two data contracts describe the same thing twice → merge them, or say what distinguishes them.",
206
- se: "Near-duplicate `SCHEMA` above 0.85 similarity (name, description and legal trace partners). Partners are filtered through `isValidTrace`: a rule must not reach its verdict via an edge R-18 rejects (CR-SM-286).",
210
+ se: "Near-duplicate `SCHEMA` above 0.85 similarity (name, description and legal trace partners). Partners are filtered through `isValidTrace`: a rule must not reach its verdict via an edge R-18 rejects (CR-SM-286)." +
211
+ " Likewise only copies; a second translator of one contract is RC-09's.",
207
212
  vorschlag: 'Führe die doppelten Datenformate {n} zusammen oder grenze sie ab.',
208
213
  },
209
214
  'NFR-01': {
@@ -213,7 +218,7 @@ export const RULE_HELP = {
213
218
  },
214
219
  'R-01': {
215
220
  plain: "A feature you've promised has no test proving it's met, so you can't show it works → add or author a test for it.",
216
- se: "`REQ` with no incoming `verify` trace (test→requirement coverage, INCOSE V&V).",
221
+ se: "`REQ` with no incoming `verify` trace (test→requirement coverage, INCOSE V&V). The `TEST` may still be unbound: R-19 asks for its `testRefs` once the build is open.",
217
222
  prompt: "se:close-violations",
218
223
  vorschlag: 'Ergänze Tests für die Anforderungen {n}.',
219
224
  },
@@ -275,25 +280,29 @@ export const RULE_HELP = {
275
280
  },
276
281
  'R-18': {
277
282
  plain: "You connected two items in a combination that isn't allowed → use an allowed link, or fix what's at each end.",
278
- se: "Trace whose (source-type, target-type) pair isn't an allowed combination in the metamodel of legal links.",
283
+ se: "Four cases under one id: (1) a pair, trace type, label or `kinds` condition that no pattern allows; a pattern with a `kinds` condition (for example `satisfy` onto a `REQ`) also rejects wrong or undeclared `kinds`, although the pair exists; (2) a `FUNC` or `MOD` with two `compose` parents; (3) more traces than the upper bound allows (for example a `FUNC` with two `allocate`); (4) a `FLOW` without exactly one `relation` to a `SCHEMA`.",
279
284
  vorschlag: 'Korrigiere die unzulässigen Verbindungen an {n}.',
280
285
  },
281
286
  'R-19': {
282
287
  plain: "Building has started, and a test doesn't point to a test file yet → add the link to the test file.",
283
288
  se: "`TEST` with no valid `testRefs` `[{file, case?, tool}, …]` (at least one entry)." +
289
+ " Presence and shape only: whether the file and the case exist is RC-02's question." +
284
290
  " Stage 11: due only once the build is open — an open CR or a first `realRef`/`testRefs` in the graph; before that it is not evaluated, not passed (CR-SM-395).",
285
291
  vorschlag: 'Verbinde die Tests {n} mit ihren Testdateien.',
286
292
  },
287
293
  'R-20': {
288
294
  plain: "Building has started, and a function doesn't point to its code yet → add the link to its code; or mark it as coming from an outside library.",
289
295
  se: "`FUNC` with no valid `realRef` `{file, symbol}` (graph↔code binding); else `external:true`." +
296
+ " Presence and shape only: whether file and symbol exist is RC-01's question." +
297
+ " `external` frees only from the binding rules (R-26, RC-01, RC-03, RC-10), not from the structure rules R-02, R-30 and R-31." +
290
298
  " Stage 11: due only once the build is open — an open CR or a first `realRef`/`testRefs` in the graph; before that it is not evaluated, not passed (CR-SM-395).",
291
299
  vorschlag: 'Verbinde die Funktionen {n} mit ihrem Code.',
292
300
  },
293
301
  'R-21': {
294
302
  plain: "Two functions hand data over, but they are not in one chain together — or they are, and the chain is not covered: some function in it has no requirement, and no end-to-end test checks the chain → give each function of the chain a requirement it fulfils, or give the chain an end-to-end quality requirement and a test for it.",
295
- se: "FUNC↔FUNC handover (`FUNC` ─io→ `FLOW` ─io→ `FUNC`), two findings. (a) endpoints share NO `FCHAIN` → finding at the PRODUCER: no integration scope is declared. (b) endpoints share one, but no shared chain is covered → finding at the chain, naming the member FUNCs without a REQ. A chain is covered either (1) through its members — EVERY member FUNC (`FCHAIN` ─compose→ `FUNC`) satisfies at least one `REQ`; verifying those REQs is R-01's job (CR-SM-376) — or (2) end-to-end — a verified integration test (`TEST` ─verify→ `REQ` ←satisfy─ `FCHAIN`); an `FCHAIN` satisfies only non-functional REQs (CR-SM-366). SILENT when either endpoint is in no chain at all (that is R-30's statement) and when either is infrastructure (`chains >= policy.criticality.infrastructure`): a handover into a function that runs through every chain is a bus, not a missing test.",
296
- vorschlag: 'Bringe die Übergaben an {n} in eine Funktionskette, deren Funktionen Anforderungen erfüllen oder die ein Integrationstest prüft.',
303
+ se: "FUNC↔FUNC handover (`FUNC` ─io→ `FLOW` ─io→ `FUNC`), two findings. (a) endpoints share NO `FCHAIN` → finding at the PRODUCER: no integration scope is declared. (b) endpoints share one, but no shared chain is covered → finding at the chain, naming the member FUNCs without a REQ. A chain is covered either (1) through its members — EVERY member FUNC (`FCHAIN` ─compose→ `FUNC`) satisfies at least one `REQ`; verifying those REQs is R-01's job (CR-SM-376) — or (2) end-to-end — a verified integration test (`TEST` ─verify→ `REQ` ←satisfy─ `FCHAIN`); an `FCHAIN` satisfies only non-functional REQs (CR-SM-366). SILENT when either endpoint is in no chain at all (that is R-30's statement) and when either is infrastructure (`chains >= policy.criticality.infrastructure`): a handover into a function that runs through every chain is a bus, not a missing test." +
304
+ " Check in the code first that the hand-over exists: if no code path joins the two functions, remove or re-hang the edge instead of building a chain around it; if it exists, also through a file, give it its own chain with a test.",
305
+ vorschlag: 'Prüfe am Code, ob die Übergaben an {n} existieren: entferne sonst die Kante, andernfalls gib ihnen eine Kette mit Test.',
297
306
  },
298
307
  'R-22': {
299
308
  plain: "A function isn't assigned to any building block, so it has no home in the structure → put it on a module.",
@@ -318,7 +327,7 @@ export const RULE_HELP = {
318
327
  },
319
328
  'R-29': {
320
329
  plain: "Two acceptances claim the same test file, so a red run cannot be traced to one of them and the gate counts that evidence twice → give the file to the one acceptance it really proves, or split it.",
321
- se: "Test file exclusivity (CR-SM-231): every file in `attributes.testRefs` belongs to at most one `TEST`. An acceptance may name n files (1:n) — a file may not name n acceptances. Severity `error`, deliberately sharper than R-19/R-20: a doubly claimed file makes gate numbers wrong, which is a mis-measurement, not a completeness signal. Purely structural — the file need not exist to be claimed twice.",
330
+ se: "Test file exclusivity (CR-SM-231): every file in `attributes.testRefs` belongs to at most one `TEST`. An acceptance may name n files (1:n) — a file may not name n acceptances. Severity `error`, deliberately sharper than R-19/R-20: a doubly claimed file makes gate numbers wrong, which is a mis-measurement, not a completeness signal. Purely structural — the file need not exist to be claimed twice. A further requirement the file proves hangs on the same `TEST` by one more `verify` trace; it needs no second `TEST`.",
322
331
  vorschlag: 'Gib jede Testdatei von {n} nur einem Test.',
323
332
  },
324
333
  'R-30': {
@@ -328,7 +337,9 @@ export const RULE_HELP = {
328
337
  },
329
338
  'R-31': {
330
339
  plain: "This function has no input or no output, so it is a dead block in the picture — only an actor is allowed to be an end point → connect it to a flow on the missing side.",
331
- se: "FUNC is wired (CR-GC-366): a `FUNC` needs at least one incoming `FLOW -io-> FUNC` and one outgoing `FUNC -io-> FLOW`. Only an `ACTOR` may terminate a chain. R-10 asks the same question from the FLOW side ('does this flow have a producer and a consumer?') and therefore never sees a function with no io edge at all — it does not appear in the FLOW loop. IO-01 presupposes chain membership and misses it too. One finding per FUNC naming the missing side(s), not one per side: otherwise the counter exceeds its own denominator contribution, the mis-measurement documented in CR-SM-242.",
340
+ se: "FUNC is wired (CR-GC-366): a `FUNC` needs at least one incoming `FLOW -io-> FUNC` and one outgoing `FUNC -io-> FLOW`. Only an `ACTOR` may terminate a chain. R-10 asks the same question from the FLOW side ('does this flow have a producer and a consumer?') and therefore never sees a function with no io edge at all — it does not appear in the FLOW loop. IO-01 presupposes chain membership and misses it too. One finding per FUNC naming the missing side(s), not one per side: otherwise the counter exceeds its own denominator contribution, the mis-measurement documented in CR-SM-242." +
341
+ " A decomposed block is not judged (its io edges hang on its children); no other exception exists, neither for a composition root nor for an `external` FUNC." +
342
+ " Where real information passes, model it as `FLOW` plus `SCHEMA`; where none passes, the warning stays. Do not add a flow or a chain to silence it.",
332
343
  vorschlag: 'Verbinde die Funktionen {n} auf der fehlenden Seite mit einem Datenfluss.',
333
344
  },
334
345
  'RC-01': {
@@ -347,8 +358,10 @@ export const RULE_HELP = {
347
358
  vorschlag: 'Korrigiere die Code-Verweise der Datenformate {n}, sie zeigen ins Leere.',
348
359
  },
349
360
  'RC-04': {
350
- plain: "A data format is defined but the function on that interface never actually checks incoming data against it → validate with it there.",
351
- se: "Bound `SCHEMA` whose symbol is not imported+parsed (`.parse`/`.safeParse`) in any realized `FUNC` io-connected to it (CR-211); warn — the parse may sit in a framework layer.",
361
+ plain: "A data format is defined but the function on that interface never actually checks data against it → parse with it there: its output at the producer, its input at the reader.",
362
+ se: "Bound `SCHEMA` whose symbol is not imported+parsed (`.parse`/`.safeParse`) in any realized `FUNC` io-connected to it (CR-211); warn." +
363
+ " The check reads the file of each such function for the literal `X.parse(` or `X.safeParse(` and accepts either side, the producer's output or the reader's input; a generic helper that parses inside is not seen." +
364
+ " `external` is not exempt; a foreign-API contract held as a Zod schema in our code is parsed at the boundary too.",
352
365
  vorschlag: 'Lies die Datenformate {n} im Code an der Schnittstelle, an der das Modell sie führt.',
353
366
  },
354
367
  'RC-05': {
@@ -388,7 +401,8 @@ export const RULE_HELP = {
388
401
  },
389
402
  'RC-12': {
390
403
  plain: "The model says one function hands data to another and waits, but in the code neither calls the other → point the flow at the pair that really calls each other, or note in the flow where the hand-over happens.",
391
- se: "`FLOW` with `sync: sync` whose producer and consumer `FUNC` both carry a `realRef` symbol in a file of `callScope`, yet `callEdges` holds no path of at most 3 calls between them in either direction (the answer flows from callee to caller). Silent when the `FLOW` carries a `realRef` whose symbol is declared (hand-over by callback, registry or socket, checked by the author). Pairs without binding, outside `callScope`, `async` or without `sync` are not judged; `callCoverage` counts them. Absent `callEdges` is SILENCE (CR-SM-415).",
404
+ se: "`FLOW` with `sync: sync` whose producer and consumer `FUNC` both carry a `realRef` symbol in a file of `callScope`, yet `callEdges` holds no path of at most 3 calls between them in either direction (the answer flows from callee to caller). Silent when the `FLOW` carries a `realRef` whose symbol is declared (hand-over by callback, registry or socket, checked by the author). Pairs without binding, outside `callScope`, `async` or without `sync` are not judged; `callCoverage` counts them. Absent `callEdges` is SILENCE (CR-SM-415)." +
405
+ " A finding asks the author to check; it is not proof of a model error, because the extractor does not see every hand-over (callback, registry, socket).",
392
406
  vorschlag: 'Prüfe die Flüsse {n} gegen die Aufrufe im Code.',
393
407
  },
394
408
  'RC-13': {
@@ -413,9 +427,10 @@ export const RULE_HELP = {
413
427
  vorschlag: 'Gruppiere die Teile unter {n}, es sind zu viele auf einer Ebene.',
414
428
  },
415
429
  'RD-05': {
416
- plain: "A level has only one or two parts under it → it groups nothing; fold it into the level above, or gather the parts that belong together under it.",
417
- se: "Decomposition breadth below `metricPolicy.decompositionBreadth.min` (default 3, exclusive) on one level, counted exactly like RD-04 (CR-SM-311, Z3). A level abstracts nothing below it. The finding carries no `value`/`threshold` and does not enter the steering score: it is readability, not boundary width. A level with no children at all is not this rule (empty MOD: R-23; FUNC without children is a leaf). The root level directly under `SYS` (`SYS` `compose` `MOD`, root `FUNC` forest) is exempt — there is no level above it, and one module or one root function is an architecture decision (CR-SM-388); RD-04 still applies there.",
418
- vorschlag: 'Löse die Ebene {n} in die Ebene darüber auf oder sammle unter ihr, was zusammengehört.',
430
+ plain: "A level has only one or two parts under it → it may group nothing; check the role and the fit of the parts, fold the level into the one above only if they belong there, or gather the parts that belong together under it.",
431
+ se: "Decomposition breadth below `metricPolicy.decompositionBreadth.min` (default 3, exclusive) on one level, counted exactly like RD-04 (CR-SM-311, Z3). A level abstracts nothing below it. The finding carries no `value`/`threshold` and does not enter the steering score: it is readability, not boundary width. A level with no children at all is not this rule (empty MOD: R-23; FUNC without children is a leaf). The root level directly under `SYS` (`SYS` `compose` `MOD`, root `FUNC` forest) is exempt — there is no level above it, and one module or one root function is an architecture decision (CR-SM-388); RD-04 still applies there." +
432
+ " The count alone is no reason to fold or cut: the role of the level and the fit of its parts decide.",
433
+ vorschlag: 'Prüfe Rolle und Passung der Teile von Ebene {n}: löse sie nur auf, wenn die Teile darüber gehören, sonst sammle Zusammengehöriges unter ihr.',
419
434
  },
420
435
  'SC-02': {
421
436
  plain: "A data format is defined but nothing uses it → connect it to the data it describes, or drop it.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigloch/contracts",
3
- "version": "12.13.0",
3
+ "version": "12.13.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",