@sigloch/contracts 3.1.0 → 3.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/se/index.d.ts +1 -1
- package/dist/se/index.js +1 -1
- package/dist/se/rules.js +48 -29
- package/package.json +1 -1
package/dist/se/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Ontology schema version (element types + trace types). */
|
|
6
6
|
export declare const ONTOLOGY_VERSION = "4.0.0";
|
|
7
7
|
/** Rules engine version (validation rules incl. RC conformance). */
|
|
8
|
-
export declare const RULES_VERSION = "2.
|
|
8
|
+
export declare const RULES_VERSION = "2.24.0";
|
|
9
9
|
/** Meta-model version (trace pattern constraints + format-e parser). */
|
|
10
10
|
export declare const META_MODEL_VERSION = "1.4.0";
|
|
11
11
|
export * from './ontology.js';
|
package/dist/se/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/** Ontology schema version (element types + trace types). */
|
|
6
6
|
export const ONTOLOGY_VERSION = '4.0.0'; // BREAKING: `SemanticId` (`Name.TypeAbbr.Counter`) deleted, `ElementUid` (`<TYPE>-<slug>`) is the family canon — the old canon was used by no production graph of the family while 626 of 1145 elements already carried TYPE-slug (CR-SM-217); realRef unifies codeRef+schemaRef (+physical-MOD CAD ref), symbol optional; testRef stays separate (CR-228 C); +RepoRelativePathSchema on testRef/realRef .file — no absolute/`..` paths (CR-GC-255)
|
|
7
7
|
/** Rules engine version (validation rules incl. RC conformance). */
|
|
8
|
-
export const RULES_VERSION = '2.
|
|
8
|
+
export const RULES_VERSION = '2.24.0'; // CR-GC-315: R-12 + R-21 no longer tax FLOW reuse. R-12 restricted to dependency-carrying traces (compose/allocate/relation) — on `io` the only reachable shape was FUNC ─io→ FLOW ─io→ the SAME FUNC, i.e. read-modify-write on a shared FLOW, so the check was pure false-positive there (real io-cycles span ≥2 FUNCs and a 2-cycle test cannot see them); satisfy/verify/produces 2-cycles are pattern-illegal and belong to R-18. Its dedup key is now direction-independent (`type|sorted pair`) — keying on the message never collapsed anything, so every cycle was reported twice. R-21 no longer derives FUNC↔FUNC connections from FLOW co-adjacency alone: a producer/consumer pair with NO shared FCHAIN is silent. One hub FLOW with P producers and C consumers manufactured P·C findings, each demanding its own FCHAIN+integration test including pairs that never interact — reuse was penalised quadratically. The FCHAIN is the declared integration scope; the test is owed on that declared claim only. Rule intent (CR-GC-240 gap: unit/UC tests do not cover FUNC↔FUNC wiring) unchanged. Prior: CR-SM-227: +AF-01..05 Analysis-Freshness-Legs (analysis-freshness-rules.ts) — the third leg-kind a review gate checks (rule legs, layer-presence legs [R-28], now analysis-freshness legs, docs/articles/07-the-scoring-landscape.md); presence-only rules (Presence/Resolution-Split like R-19/R-20/R-26/R-27 vs. RC-01..05) checking a `graphVersion` freshness stamp exists under SYS.attributes.analysisFreshness.<AnalysisArtifactId> for each of the 5 CR-GC-221 judgment artifacts (conops/trade/assumption-review/fmea/implplan) — staleness (stamp vs live graphVersion) stays a consumer/I-O concern (`CreationCurrencyProvider`, @sigloch/graphcode-client), NOT evaluated here; Familie-Review 2026-08-05 gate assignment → RULE_TO_PHASE: ConOps/Trade/Assumption-Review → PDR, FMEA → CDR, Implementation Plan → TRR (SRR gets none); +AnalysisArtifactId enum + AnalysisFreshnessStampSchema (ontology.ts) as the SSOT graphcode-client's ARTIFACT_CATALOG analysis ids must match; grober Graph-Versions-Stempel only, no scope-hash in this first cut (conscious CR-SM-227 limitation).
|
|
9
9
|
/** Meta-model version (trace pattern constraints + format-e parser). */
|
|
10
10
|
export const META_MODEL_VERSION = '1.4.0'; // -REQ→MOD allocate pattern removed (CR-228 A); +FUNC→FUNC compose (blackbox function decomposition)
|
|
11
11
|
export * from './ontology.js';
|
package/dist/se/rules.js
CHANGED
|
@@ -312,28 +312,39 @@ function flowCompleteness(graph) {
|
|
|
312
312
|
// R-11: REMOVED — superseded by SC-02 (identical check, better severity).
|
|
313
313
|
// ---------------------------------------------------------------------------
|
|
314
314
|
// ---------------------------------------------------------------------------
|
|
315
|
-
// R-12: Circular dependency detection
|
|
316
|
-
//
|
|
315
|
+
// R-12: Circular dependency detection — direct 2-cycles over dependency-carrying
|
|
316
|
+
// traces only (CR-GC-315). `io` is excluded: the only shape a 2-cycle test can
|
|
317
|
+
// hit on `io` is FUNC ─io→ FLOW ─io→ the SAME FUNC, i.e. read-modify-write on a
|
|
318
|
+
// shared FLOW — the reuse pattern, not a dependency cycle. Real io-cycles span
|
|
319
|
+
// ≥2 FUNCs and are invisible to a 2-cycle test anyway, so on `io` the rule was
|
|
320
|
+
// pure false-positive and taxed FLOW reuse. satisfy/verify/produces 2-cycles are
|
|
321
|
+
// already pattern-illegal and belong to R-18.
|
|
322
|
+
// ---------------------------------------------------------------------------
|
|
323
|
+
/** Trace types on which a direct 2-cycle is a real finding (CR-GC-315). */
|
|
324
|
+
const CIRCULAR_TRACE_TYPES = new Set(['compose', 'allocate', 'relation']);
|
|
317
325
|
function noDirectCircular(graph) {
|
|
318
326
|
const violations = [];
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
rule_id: 'R-12',
|
|
323
|
-
severity: 'warning',
|
|
324
|
-
element_id: t.source,
|
|
325
|
-
message: `Circular ${t.type} between ${t.source} and ${t.target}`,
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
}
|
|
327
|
+
// Direction-independent key: A↔B is ONE cycle, reported once. Keying on the
|
|
328
|
+
// message (CR-GC-315 predecessor) never collapsed anything — the two
|
|
329
|
+
// directions render different messages, so every cycle was reported twice.
|
|
329
330
|
const seen = new Set();
|
|
330
|
-
|
|
331
|
-
|
|
331
|
+
for (const t of graph.traces) {
|
|
332
|
+
if (!CIRCULAR_TRACE_TYPES.has(t.type))
|
|
333
|
+
continue;
|
|
334
|
+
if (!graph.traces.some(other => other.source === t.target && other.target === t.source && other.type === t.type))
|
|
335
|
+
continue;
|
|
336
|
+
const key = `${t.type}|${[t.source, t.target].sort().join('|')}`;
|
|
332
337
|
if (seen.has(key))
|
|
333
|
-
|
|
338
|
+
continue;
|
|
334
339
|
seen.add(key);
|
|
335
|
-
|
|
336
|
-
|
|
340
|
+
violations.push({
|
|
341
|
+
rule_id: 'R-12',
|
|
342
|
+
severity: 'warning',
|
|
343
|
+
element_id: t.source,
|
|
344
|
+
message: `Circular ${t.type} between ${t.source} and ${t.target}`,
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
return violations;
|
|
337
348
|
}
|
|
338
349
|
// ---------------------------------------------------------------------------
|
|
339
350
|
// R-13: DELETED — superseded by RD-01 (CR-180)
|
|
@@ -724,13 +735,17 @@ function funcMustHaveCodeBinding(graph) {
|
|
|
724
735
|
}
|
|
725
736
|
/** All rules — see RULES_VERSION in ./index.ts (R-06/R-07/R-09/R-11/R-13/R-24/R-25 removed, R-14..R-23/R-26/RD-01..03/MS-01..02 added) */
|
|
726
737
|
// ---------------------------------------------------------------------------
|
|
727
|
-
// R-21: Every FUNC↔FUNC connection must be covered by an
|
|
728
|
-
// A connection is FUNC ─io→ FLOW ─io→ FUNC. It is
|
|
729
|
-
// endpoints share an FCHAIN that owns a verifying
|
|
730
|
-
// (TEST ─verify→ REQ ←satisfy─ FCHAIN). Unit tests
|
|
731
|
-
// acceptance tests do NOT cover the interface between
|
|
732
|
-
// CR-GC-240 folded "integration" onto the UC level,
|
|
733
|
-
// wiring unverified; this rule closes that gap
|
|
738
|
+
// R-21: Every FUNC↔FUNC connection *declared as an FCHAIN* must be covered by an
|
|
739
|
+
// integration test. A connection is FUNC ─io→ FLOW ─io→ FUNC. It is
|
|
740
|
+
// covered iff both endpoints share an FCHAIN that owns a verifying
|
|
741
|
+
// integration test (TEST ─verify→ REQ ←satisfy─ FCHAIN). Unit tests
|
|
742
|
+
// (FUNC→REQ) and UC acceptance tests do NOT cover the interface between
|
|
743
|
+
// two functions — CR-GC-240 folded "integration" onto the UC level,
|
|
744
|
+
// leaving FUNC↔FUNC wiring unverified; this rule closes that gap.
|
|
745
|
+
// CR-GC-315: a producer/consumer pair with NO shared FCHAIN is silent.
|
|
746
|
+
// Co-adjacency at a shared FLOW is not an asserted interface — treating it
|
|
747
|
+
// as one produced P·C findings per hub FLOW and made reuse the expensive
|
|
748
|
+
// choice. The FCHAIN is the modelled claim; the test is owed on the claim.
|
|
734
749
|
// ---------------------------------------------------------------------------
|
|
735
750
|
function fchainMustHaveIntegrationTest(graph) {
|
|
736
751
|
const typeOf = new Map(graph.elements.map(e => [e.id, e.type]));
|
|
@@ -769,9 +784,15 @@ function fchainMustHaveIntegrationTest(graph) {
|
|
|
769
784
|
const seen = new Set();
|
|
770
785
|
for (const [p, c] of connections) {
|
|
771
786
|
const shared = [...(chainsOfFunc.get(p) ?? [])].filter(ch => chainsOfFunc.get(c)?.has(ch));
|
|
787
|
+
// No shared FCHAIN = no asserted integration (CR-GC-315). Sharing one FLOW
|
|
788
|
+
// between P producers and C consumers does not mean P·C interfaces exist —
|
|
789
|
+
// deriving connections from FLOW adjacency alone taxed reuse quadratically.
|
|
790
|
+
// The FCHAIN is the declared integration scope; only that is held to a test.
|
|
791
|
+
if (shared.length === 0)
|
|
792
|
+
continue;
|
|
772
793
|
if (shared.some(ch => testedChains.has(ch)))
|
|
773
794
|
continue;
|
|
774
|
-
const anchor = shared[0]
|
|
795
|
+
const anchor = shared[0];
|
|
775
796
|
const key = `${anchor}|${p}>${c}`;
|
|
776
797
|
if (seen.has(key))
|
|
777
798
|
continue;
|
|
@@ -781,10 +802,8 @@ function fchainMustHaveIntegrationTest(graph) {
|
|
|
781
802
|
rule_id: 'R-21',
|
|
782
803
|
severity: 'warning',
|
|
783
804
|
element_id: anchor,
|
|
784
|
-
message:
|
|
785
|
-
|
|
786
|
-
: `connection ${p} → ${c} is in no FCHAIN with an integration test`,
|
|
787
|
-
fix_hint: 'Group both FUNCs in an FCHAIN and verify an FCHAIN-satisfied REQ with an integration TEST',
|
|
805
|
+
message: `${anchor} has no integration test covering connection ${p} → ${c}`,
|
|
806
|
+
fix_hint: 'Verify an FCHAIN-satisfied REQ with an integration TEST',
|
|
788
807
|
context: { element_type: anchorEl?.type, element_name: anchorEl?.name },
|
|
789
808
|
});
|
|
790
809
|
}
|