@sdd-method/sdd-cli 1.1.0 → 1.3.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.
Files changed (83) hide show
  1. package/dist/lib/catalogue/aggregate.d.ts.map +1 -1
  2. package/dist/lib/catalogue/aggregate.js +5 -4
  3. package/dist/lib/catalogue/aggregate.js.map +1 -1
  4. package/dist/lib/catalogue/build.d.ts.map +1 -1
  5. package/dist/lib/catalogue/build.js +16 -7
  6. package/dist/lib/catalogue/build.js.map +1 -1
  7. package/dist/lib/catalogue/builders/capability-edges.d.ts.map +1 -1
  8. package/dist/lib/catalogue/builders/capability-edges.js +10 -1
  9. package/dist/lib/catalogue/builders/capability-edges.js.map +1 -1
  10. package/dist/lib/catalogue/builders/capability-spec.d.ts +9 -3
  11. package/dist/lib/catalogue/builders/capability-spec.d.ts.map +1 -1
  12. package/dist/lib/catalogue/builders/capability-spec.js +9 -3
  13. package/dist/lib/catalogue/builders/capability-spec.js.map +1 -1
  14. package/dist/lib/catalogue/builders/index.d.ts +2 -0
  15. package/dist/lib/catalogue/builders/index.d.ts.map +1 -1
  16. package/dist/lib/catalogue/builders/index.js +1 -0
  17. package/dist/lib/catalogue/builders/index.js.map +1 -1
  18. package/dist/lib/catalogue/builders/quality-scores.d.ts +14 -0
  19. package/dist/lib/catalogue/builders/quality-scores.d.ts.map +1 -0
  20. package/dist/lib/catalogue/builders/quality-scores.js +321 -0
  21. package/dist/lib/catalogue/builders/quality-scores.js.map +1 -0
  22. package/dist/lib/catalogue/builders/services.d.ts.map +1 -1
  23. package/dist/lib/catalogue/builders/services.js +5 -1
  24. package/dist/lib/catalogue/builders/services.js.map +1 -1
  25. package/dist/lib/catalogue/canonical-schema.yaml +255 -6
  26. package/dist/lib/catalogue/coverage-predicates.d.ts +176 -0
  27. package/dist/lib/catalogue/coverage-predicates.d.ts.map +1 -0
  28. package/dist/lib/catalogue/coverage-predicates.js +603 -0
  29. package/dist/lib/catalogue/coverage-predicates.js.map +1 -0
  30. package/dist/lib/catalogue/coverage-render.d.ts +54 -0
  31. package/dist/lib/catalogue/coverage-render.d.ts.map +1 -0
  32. package/dist/lib/catalogue/coverage-render.js +432 -0
  33. package/dist/lib/catalogue/coverage-render.js.map +1 -0
  34. package/dist/lib/catalogue/coverage-run.d.ts +33 -0
  35. package/dist/lib/catalogue/coverage-run.d.ts.map +1 -0
  36. package/dist/lib/catalogue/coverage-run.js +97 -0
  37. package/dist/lib/catalogue/coverage-run.js.map +1 -0
  38. package/dist/lib/catalogue/ddl-generator.d.ts +80 -0
  39. package/dist/lib/catalogue/ddl-generator.d.ts.map +1 -0
  40. package/dist/lib/catalogue/ddl-generator.js +215 -0
  41. package/dist/lib/catalogue/ddl-generator.js.map +1 -0
  42. package/dist/lib/catalogue/engine-validator.d.ts +103 -0
  43. package/dist/lib/catalogue/engine-validator.d.ts.map +1 -0
  44. package/dist/lib/catalogue/engine-validator.js +221 -0
  45. package/dist/lib/catalogue/engine-validator.js.map +1 -0
  46. package/dist/lib/catalogue/enum-validator.d.ts.map +1 -1
  47. package/dist/lib/catalogue/enum-validator.js +15 -0
  48. package/dist/lib/catalogue/enum-validator.js.map +1 -1
  49. package/dist/lib/catalogue/fk-validator.d.ts +6 -0
  50. package/dist/lib/catalogue/fk-validator.d.ts.map +1 -1
  51. package/dist/lib/catalogue/fk-validator.js +6 -0
  52. package/dist/lib/catalogue/fk-validator.js.map +1 -1
  53. package/dist/lib/catalogue/gate-checks.d.ts +117 -0
  54. package/dist/lib/catalogue/gate-checks.d.ts.map +1 -0
  55. package/dist/lib/catalogue/gate-checks.js +261 -0
  56. package/dist/lib/catalogue/gate-checks.js.map +1 -0
  57. package/dist/lib/catalogue/parity-harness.d.ts +48 -0
  58. package/dist/lib/catalogue/parity-harness.d.ts.map +1 -0
  59. package/dist/lib/catalogue/parity-harness.js +76 -0
  60. package/dist/lib/catalogue/parity-harness.js.map +1 -0
  61. package/dist/lib/catalogue/schema-compat.d.ts +3 -3
  62. package/dist/lib/catalogue/schema-compat.js +3 -3
  63. package/dist/lib/catalogue/scores-coverage.d.ts +138 -0
  64. package/dist/lib/catalogue/scores-coverage.d.ts.map +1 -0
  65. package/dist/lib/catalogue/scores-coverage.js +346 -0
  66. package/dist/lib/catalogue/scores-coverage.js.map +1 -0
  67. package/dist/lib/catalogue/validate.d.ts.map +1 -1
  68. package/dist/lib/catalogue/validate.js +6 -11
  69. package/dist/lib/catalogue/validate.js.map +1 -1
  70. package/dist/lib/mcp/parse/gate-registry.d.ts +63 -4
  71. package/dist/lib/mcp/parse/gate-registry.d.ts.map +1 -1
  72. package/dist/lib/mcp/parse/gate-registry.js +127 -31
  73. package/dist/lib/mcp/parse/gate-registry.js.map +1 -1
  74. package/dist/lib/mcp/resources/gates.d.ts.map +1 -1
  75. package/dist/lib/mcp/resources/gates.js +13 -27
  76. package/dist/lib/mcp/resources/gates.js.map +1 -1
  77. package/dist/lib/mcp/tools/query-gate-status.d.ts.map +1 -1
  78. package/dist/lib/mcp/tools/query-gate-status.js +13 -27
  79. package/dist/lib/mcp/tools/query-gate-status.js.map +1 -1
  80. package/dist/verbs/catalogue.d.ts.map +1 -1
  81. package/dist/verbs/catalogue.js +24 -0
  82. package/dist/verbs/catalogue.js.map +1 -1
  83. package/package.json +3 -2
@@ -58,13 +58,105 @@
58
58
  # `[finding] external`) and validated by the aggregator after merge.
59
59
  # Default for unspecified `external` is `false` (internal FK).
60
60
  #
61
- # Conceptual model: see docs/method/methods/catalogue-metamodel.md.
62
- # Builder contract: see docs/method/methods/catalogue-builder-specification.md.
63
- # Category taxonomy: see docs/method/methods/product-category-taxonomy.md.
61
+ # Conceptual model: see docs/method/methods/guides/catalogue-metamodel.md.
62
+ # Builder contract: see docs/method/methods/guides/catalogue-builder-specification.md.
63
+ # Category taxonomy: see docs/method/methods/standards/product-category-taxonomy.md.
64
64
 
65
- schema_version: "3.1.0"
65
+ schema_version: "3.2.0"
66
66
  schema_owner: "sdd-method"
67
67
  schema_status: "canonical"
68
+ # Bump rationale (3.2.0 — additive minor, 2026-08-06, per M-ADR 0205 §4.5):
69
+ # the rubric score registries join the catalogue metamodel. Two new catalogues
70
+ # and four new enums; no existing column, catalogue or enum is touched.
71
+ #
72
+ # 1. `quality_scores` — one row per (target, rubric), derived from
73
+ # `orchestration/gate-registry/<rubric>-scores.yaml`. The authored surface
74
+ # stays YAML (a score is a judgment, authored where it asserts intent);
75
+ # these rows are derived and never edited.
76
+ # 2. `quality_score_dimensions` — the per-dimension child. A child catalogue
77
+ # is FORCED, not stylistic: the fifteen rubrics carry fifteen disjoint
78
+ # dimension vocabularies (45 distinct keys measured in one estate), so no
79
+ # fixed column set can hold them.
80
+ # 3. Enums `quality_gate`, `score_selection_method`, `staleness_basis`,
81
+ # `scoring_form`. NONE is bound via column_enums — see quality_gate for
82
+ # the measured reason, which is the opposite lesson to 3.1.3's: there the
83
+ # defect was a binding that checked nothing, here the defect would be a
84
+ # binding that hard-fails an estate over a value it deliberately declared
85
+ # in its own registry header.
86
+ #
87
+ # Three shapes the survey behind this bump found, recorded because a builder
88
+ # written from the templates alone would get all three wrong (full record:
89
+ # the Phase-B B0 survey, 2026-08-06):
90
+ # - The live forward-estate data is FLAT, not the nested current/reviews
91
+ # shape all fifteen method templates specify. Reading only the template
92
+ # shape catalogues 6 entries out of 204.
93
+ # - The registry container key is unreliable (4 of 10 drift from the method
94
+ # template) and non-unique (`domains` and `capabilities` each name two
95
+ # different rubrics), so rubric_id comes from registry_type-or-filename.
96
+ # - `corpus_ref` — which M-ADR 0205 §4.5 names and the coverage instrument's
97
+ # staleness rule depends on — is authored NOWHERE today. It is introduced
98
+ # here as new authoring with a computed `scored_at` fallback, and
99
+ # `staleness_basis` records which of the two a row can actually use. A
100
+ # staleness verdict whose basis is unstated is not a measurement.
101
+ # `evidence_ref`, also named in §4.5, is deliberately NOT added: nothing
102
+ # authors it in any registry in either estate, and shipping it would create
103
+ # exactly the inert column that 2.48.0 deprecated `products.status` over.
104
+ # ACTIVATION NOTE (M-ADR 0200 §4.6): additive only — no existing row changes
105
+ # value and no existing check changes verdict. The new catalogues emit
106
+ # headers-only in any SDD without a gate-registry directory, which is every
107
+ # SDD in the method repo's own estate except the roots.
108
+ # Backward-compatible; SCHEMA_COMPAT "^3.0.0".
109
+ # Bump rationale (3.1.3 — patch, 2026-08-05): `repositories.column_enums`
110
+ # bound `service_type` — the AUTHORING field's name — but the catalogue
111
+ # column that carries the value is `component_type` (the builder maps
112
+ # repo-config `service_type` into it). A binding to a column the catalogue
113
+ # does not declare validated as vacuously true from 3.0.0 on: the in-memory
114
+ # enum validator read an absent cell as empty and skipped it. Found by the
115
+ # M-ADR 0205 §4.3 schema-driven DDL generator, whose engine refused the
116
+ # binding instead of skipping it. The binding key is corrected to
117
+ # `component_type` and the service_type enum's description corrected to name
118
+ # the real column. ACTIVATION NOTE (M-ADR 0200 §4.6): correcting the key
119
+ # activates enum validation on values the wrong key never checked; measured
120
+ # before shipping across both estate classes' built repository catalogues —
121
+ # one estate carries 14 rows with an out-of-vocabulary improvised value, the
122
+ # other none. Those 14 become error-severity findings at that estate's first
123
+ # build on a CLI carrying this schema; the remedial route is re-declaring
124
+ # the repo-config `service_type` inside the enum (profile already conveys
125
+ # what the improvised value tried to say, per §7.1).
126
+ # Bump rationale (3.1.2 — comment-only patch, 2026-08-05): records the 3.1.0
127
+ # entry below, which shipped without one — the rationale lived only in
128
+ # M-ADR 0204 and the cut commit. No structural change; no column, enum, or
129
+ # catalogue touched.
130
+ # Bump rationale (3.1.1 — comment-only patch, 2026-08-05): corrects the three
131
+ # companion-doc pointers above, stale since the docs moved under
132
+ # methods/guides/ and methods/standards/. No structural change; no column,
133
+ # enum, or catalogue touched.
134
+ # Bump rationale (3.1.0 — additive minor, 2026-08-03, per M-ADR 0204): the
135
+ # target-locus change-set on `product_platform_dependencies`. A dependency row
136
+ # can now declare that its target is NOT the platform:
137
+ # 1. `target_locus` added (closed enum `platform | external | legacy`;
138
+ # absent/empty = platform, so every pre-3.1.0 row keeps its exact
139
+ # meaning). A statement about the TARGET only — never about the consuming
140
+ # product, and never a stability/lifecycle/quality claim. Before this
141
+ # column, off-platform targets had nowhere to go and corrupted other
142
+ # fields (external/legacy smuggled into required_stability; a product's
143
+ # own feature slug forced into target_capability_id).
144
+ # 2. `target_external_system_id` added: for external|legacy rows, the
145
+ # M-ADR 0189 external-system entry id the dependency targets. Authored in
146
+ # the source file's service_id slot; the builder routes it here so the FK
147
+ # columns stay clean. Deliberately NOT a declared FK — corroboration
148
+ # against c4_external_systems is WARNING-severity at aggregation
149
+ # (0204 §4.2) because the C4 surface may legitimately lag discovery, and
150
+ # a declared FK can only fail.
151
+ # 3. `target_capability_id` becomes conditionally nullable (0204 §4.3, the
152
+ # 2.36.0 / M-ADR 0192 precedent): EMPTY when target_locus is
153
+ # external|legacy — there is no platform capability to name. A
154
+ # platform-locus row still requires it.
155
+ # 4. The PK gains an off-platform form:
156
+ # {product_id}__{target_locus}__{target_external_system_id}, falling back
157
+ # to contract_path when no external-system id is named.
158
+ # external/legacy rows skip platform resolution and the F18 realiser-join,
159
+ # with every skip named.
68
160
  # Bump rationale (3.0.0 — BREAKING major, 2026-07-29, per M-ADR 0203): the 2.x line's
69
161
  # five deferred breaks land as one audited cut, each a complete change-set in the
70
162
  # M-ADR 0200 §4.1 sense. This entry records each break as its change-set lands:
@@ -514,6 +606,75 @@ schema_status: "canonical"
514
606
 
515
607
  enums:
516
608
 
609
+ quality_gate:
610
+ description: >
611
+ Gate verdict a rubric assessment records for a target, in
612
+ `quality_scores.gate` (per M-ADR 0205 §4.5). The vocabulary all fifteen
613
+ method-side gate registries declare.
614
+
615
+ DELIBERATELY NOT BOUND via `column_enums`, and the reason is measured
616
+ rather than assumed — do not "fix" this by binding it. These values come
617
+ from hand-authored score registries written by scoring runs, not from a
618
+ method-mandated authoring surface, and one estate's
619
+ `domain-architecture-scores.yaml` DECLARES AN EXTENDED VOCABULARY IN ITS
620
+ OWN FILE HEADER (`pass | pass-with-waiver | conditional | fail |
621
+ unscored`) and uses the extra value once. Binding would hard-fail that
622
+ estate's entire build over one deliberate, self-documented row. This
623
+ follows the `products.synthesis_band` precedent — the other column fed
624
+ from a rubric registry — where an out-of-vocabulary value is reported as
625
+ a convention finding and the cell left EMPTY, rather than emitting a
626
+ value no consumer can interpret. The builder names the file, the entry,
627
+ the value and the remedy, which is better diagnosis than a generic enum
628
+ violation could give. Contrast `service_type`, which IS bound: it comes
629
+ from repo-config, an authoring surface the method mandates.
630
+ values:
631
+ - { value: pass, description: "Meets the rubric's pass threshold with no hard gate triggered." }
632
+ - { value: conditional, description: "Below threshold or carrying flags — remediation required, not a failure." }
633
+ - { value: fail, description: "Below the fail threshold, or a hard gate triggered." }
634
+ - { value: unscored, description: "The entry exists but carries no assessment. Distinct from absent: an unscored row asserts that nothing has been judged, which is exactly the silence M-ADR 0205 §4.5's coverage instrument exists to make loud." }
635
+
636
+ score_selection_method:
637
+ description: >
638
+ How the effective review was chosen from a target's review history, in
639
+ `quality_scores.selection_method` — the `selection_policy.method` field
640
+ every gate registry carries. The catalogue models only the EFFECTIVE
641
+ score (one row per target/rubric); this column makes the row say WHICH
642
+ review it is rather than implying there was only one. Not bound, for the
643
+ same registry-authored reason as `quality_gate`.
644
+ values:
645
+ - { value: latest, description: "Most recent review by scored_at. The default and, at 2026-08-06, the only value in use across either estate." }
646
+ - { value: human-selected, description: "A human chose the effective review over the automatic pick." }
647
+ - { value: consensus, description: "Effective score reconciled across several reviews." }
648
+ - { value: highest-severity, description: "The most severe review wins — the conservative policy for gate-blocking rubrics." }
649
+
650
+ staleness_basis:
651
+ description: >
652
+ Which anchor a `quality_scores` row's staleness verdict can be computed
653
+ from, in `quality_scores.staleness_basis`. This column exists because a
654
+ staleness verdict whose basis is unstated is not a measurement — the
655
+ basis-error class that produced six wrong figures in a single day of this
656
+ method's own arc. The coverage predicate MUST NOT be able to emit a
657
+ staleness claim without naming which of these it used.
658
+ values:
659
+ - { value: corpus_ref, description: "The row carries the commit the assessment read — the precise anchor. Authored; introduced by the M-ADR 0205 §4.5 change-set, so absent from every score written before it." }
660
+ - { value: scored_at, description: "No corpus_ref; staleness computed from the assessment date against the target's last content change, resolved through target_path. Correct but coarser — it cannot distinguish a re-commit that changed nothing from a real edit." }
661
+ - { value: none, description: "Neither anchor available (no corpus_ref and no resolvable target_path). Staleness is UNKNOWN for this row and must be reported as unknown, never as fresh." }
662
+
663
+ scoring_form:
664
+ description: >
665
+ The scoring shape a rubric uses, in `quality_scores.scoring_form`.
666
+ Reserved by M-ADR 0205 §4.5 so the banded reverse family can arrive
667
+ additively without reshaping rows.
668
+
669
+ Only `weighted` is declared. The reverse estate's banded form (0-2 across
670
+ 5-6 dimensions with strong/working/weak/not-usable bands) is real and
671
+ measured — 142 registry files, 501 scored units — but is NOT modelled
672
+ yet, so its value is deliberately absent rather than declared-and-unemitted:
673
+ if a builder emits a banded row before that change-set lands, it should
674
+ fail loudly, not pass against a vocabulary entry nothing produces.
675
+ values:
676
+ - { value: weighted, description: "Weighted 1-5 dimensions rolled into a weighted_score against a pass threshold, with flags and hard gates. The forward house form; all fifteen method-side registries use it." }
677
+
517
678
  c4_system_kind:
518
679
  description: >
519
680
  Architectural kind of a C4 system. Derived 1:1 from the originating
@@ -556,7 +717,7 @@ enums:
556
717
  service_type:
557
718
  description: >
558
719
  Type of repository, declared in `orchestration/repo-config/*.yaml` as
559
- `service_type` and surfaced in `repositories.service_type` and
720
+ `service_type` and surfaced in `repositories.component_type` and
560
721
  `services.component_type`. The canonical builder uses this to decide
561
722
  which repos are runtime services (api_service, worker, gateway,
562
723
  frontend, mobile) and which are non-runtime (library, infrastructure,
@@ -1077,7 +1238,7 @@ catalogues:
1077
1238
  - { name: doc_path, type: string, nullable: false }
1078
1239
  - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per M-ADR 0134." }
1079
1240
  column_enums:
1080
- service_type: enums.service_type # canonical builder validates against the service_type enum above
1241
+ component_type: enums.service_type # the repo-config `service_type` value lands in THIS column (3.1.3 — the binding previously named the authoring field and checked nothing)
1081
1242
 
1082
1243
  domain_models:
1083
1244
  primary_key: id
@@ -1881,3 +2042,91 @@ catalogues:
1881
2042
  - { name: needs_triage, type: boolean, nullable: false, description: "True when any asymmetry exists. Triage, not auto-fail (M-ADR 0180 §2.3)." }
1882
2043
  - { name: run_date, type: string, nullable: false, description: "ISO date of the conformance run — the snapshot stamp enabling trend over time." }
1883
2044
  - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per M-ADR 0134." }
2045
+
2046
+ quality_scores:
2047
+ primary_key: id
2048
+ description: >
2049
+ Rubric assessment of a target artefact, one row per (target, rubric), per
2050
+ M-ADR 0205 §4.5. Source: `orchestration/gate-registry/<rubric>-scores.yaml`
2051
+ — the authored surface stays YAML because a score is a judgment, authored
2052
+ where it asserts intent; these rows are DERIVED and never edited.
2053
+
2054
+ Models the EFFECTIVE score only — `current`, as chosen by the registry's
2055
+ `selection_policy`. The authored `reviews[]` history is deliberately not
2056
+ catalogued: variable-length history in a fixed-grain catalogue would give
2057
+ two answers to "what is the score". `review_run_id` and
2058
+ `selection_method` make each row name which review it is.
2059
+
2060
+ THE BUILDER MUST READ TWO AUTHORED DIALECTS. All fifteen method-side
2061
+ templates specify a nested shape (`selection_policy` / `current` /
2062
+ `reviews`), but the live forward-estate data is overwhelmingly FLAT —
2063
+ `gate`/`weighted_score`/`scored_at`/`scored_by`/`scores`/`flags` directly
2064
+ on the entry. Measured 2026-08-06: reading only the template shape would
2065
+ catalogue 6 entries out of 204. The templates were modernised; the data
2066
+ was not migrated, and both are legitimate.
2067
+
2068
+ `rubric_id` comes from the file's `registry_type` when declared, else the
2069
+ filename stem minus `-scores` — NEVER the container key, which is
2070
+ unreliable (4 of 10 forward registries drift from the method template)
2071
+ and non-unique (`domains` names both domain-architecture and
2072
+ intent-quality; `capabilities` names both feature-grounding and
2073
+ traceability-manifest).
2074
+
2075
+ Scope: the weighted house form only. The banded reverse family is
2076
+ additive later via `scoring_form` (see that enum).
2077
+ foreign_keys:
2078
+ - { column: sdd_id, references: products.id, nullable: true }
2079
+ columns:
2080
+ - { name: id, type: string, nullable: false, description: "PK: {rubric_id}__{target_kind}__{target_ref}. Composite in one slug because the natural key is a triple and the rest of this schema keys on a single `id`." }
2081
+ - { name: rubric_id, type: string, nullable: false, description: "The rubric that produced the assessment, e.g. adr-quality, contract-quality. From the registry's `registry_type` when declared, else the filename stem minus `-scores`. A `registry_type` disagreeing with its filename is a convention finding, never a silent preference." }
2082
+ - { name: scoring_form, type: string, nullable: false, description: "Scoring shape — see the scoring_form enum. `weighted` for every row the current builder emits." }
2083
+ - { name: target_kind, type: string, nullable: false, description: "What kind of thing was scored: adr | contract | c4_diagram | capability | domain | feature | product | repository | persona | screen | glossary | integration | user_story | work_order | strategic_doc. Polymorphic because scored units span catalogue entities and non-catalogued artefacts (M-ADR 0205 §4.5)." }
2084
+ - { name: target_ref, type: string, nullable: false, description: "Identifier of the scored target, in the vocabulary of its kind. For ADRs this is the prefix-stripped catalogue id (M-ADR 0186 §4.4), matching `adrs.id`." }
2085
+ - { name: target_path, type: string, nullable: true, description: "Repo-relative path to the scored artefact, from the entry's `file_path` where authored (7 of 15 registry shapes carry it). Doubles as the resolution anchor for `scored_at`-basis staleness — which is why its absence downgrades a row's staleness_basis to `none` rather than being cosmetic. Empty when the registry does not author it." }
2086
+ - { name: gate, type: string, nullable: true, description: "Verdict — see the quality_gate enum, which is deliberately UNBOUND. An out-of-vocabulary value leaves this cell EMPTY and raises a convention finding naming the file, entry and value (the products.synthesis_band precedent). Empty therefore means either unauthored or out-of-vocabulary, and the finding distinguishes them." }
2087
+ - { name: weighted_score, type: number, nullable: true, description: "The rubric's rolled-up weighted score. Empty for an unscored entry — which is a real state the registries author deliberately, not a gap." }
2088
+ - { name: score_denominator, type: number, nullable: true, description: "Denominator the weighted_score was computed against, where the rubric records one (contract-quality does). Present so a score is never reported without its basis." }
2089
+ - { name: scored_at, type: date, nullable: true, description: "Date of the effective assessment, from `scored_at` (the forward house form's field name — NOT `assessed_at`, which is the reverse family's file-level field). Date-typed: per the M-ADR 0205 §4.1 engine's TRY_CAST semantics, a prose value here is reported as a type nonconformance rather than aborting the load or being smoothed away — the `adrs.decision_date` case, which reverse practice already exercises." }
2090
+ - { name: corpus_ref, type: string, nullable: true, description: "The commit the assessment read — the precise staleness anchor. NEW AUTHORING introduced by this change-set: no score written before it carries one, so this column is empty across both estates at introduction and fills forward as registries are rewritten. The reverse family already has the idea under a different name (`snapshot.source_revision`)." }
2091
+ - { name: staleness_basis, type: string, nullable: false, description: "Which anchor this row's staleness can be computed from — see the staleness_basis enum. Emitted by the builder, never authored. Exists so no consumer can state a staleness verdict without its basis." }
2092
+ - { name: review_run_id, type: string, nullable: true, description: "Identifier of the effective review run. Empty in the flat dialect, which records no run ids." }
2093
+ - { name: selection_method, type: string, nullable: true, description: "How the effective review was chosen — see the score_selection_method enum. Empty in the flat dialect, which carries no selection_policy: absence means 'the only review', not 'policy unknown'." }
2094
+ - { name: scorer_provider, type: string, nullable: true, description: "Provider of the scoring agent (e.g. anthropic), from `current.scorer.provider`. Every score in this method is agent-produced, so which agent produced a judgment is part of the judgment, not metadata about it." }
2095
+ - { name: scorer_tool, type: string, nullable: true, description: "Tool the scoring agent ran in, from `current.scorer.tool`." }
2096
+ - { name: scorer_model, type: string, nullable: true, description: "Model that produced the assessment, from `current.scorer.model`. In the flat dialect the whole provenance block collapses to a free-text `scored_by:`, which lands here — so a value like 'intent-quality-review — rfms-connector-library' is expected and correct for flat-dialect rows, not a parse defect." }
2097
+ - { name: scorer_model_family, type: string, nullable: true, description: "Optional grouping field from `current.scorer.model_family`." }
2098
+ - { name: scorer_prompt_version, type: string, nullable: true, description: "Optional prompt-wrapper version from `current.scorer.prompt_version` — the input that makes a score reproducible." }
2099
+ - { name: flag_count, type: int, nullable: false, description: "Number of heuristic flags raised. Normalises two authored dialects: `flags: {name: bool}` (count the true ones) and `flags_raised: [names]` (count the list). A per-flag child catalogue is deliberately NOT built — it arrives when a named query needs to filter by flag name, not by accretion." }
2100
+ - { name: hard_gate_triggered, type: boolean, nullable: false, description: "Whether any hard gate fired. Normalises `hard_gates: {triggered, reasons}` and `hard_gates_triggered: [reasons]`." }
2101
+ - { name: required_actions_count, type: int, nullable: false, description: "Number of remediation actions the assessment recorded." }
2102
+ - { name: sdd_id, type: string, nullable: true, description: "SDD whose gate-registry authored this row. Soft FK to products.id — nullable because a registry can score targets in an SDD that emits no product row." }
2103
+ - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per M-ADR 0134; left empty by per-SDD builders." }
2104
+
2105
+ quality_score_dimensions:
2106
+ primary_key: id
2107
+ description: >
2108
+ One row per (target, rubric, dimension) — the per-dimension detail behind
2109
+ a `quality_scores` row, per M-ADR 0205 §4.5.
2110
+
2111
+ A child catalogue rather than columns, and this is forced rather than
2112
+ stylistic: the fifteen rubrics carry FIFTEEN DISJOINT dimension
2113
+ vocabularies (`A1`-`A8`, `C1`-`C8`, `G1`-`G7`, `T1`-`T7`, `D1`-`D6`,
2114
+ `S1`-`S6`, `I1`-`I6`, plus five fully-named sets such as
2115
+ `definition_precision` and `intent_fidelity`) — 45 distinct keys measured
2116
+ in one estate alone. No fixed column set can hold them; serialised JSON in
2117
+ a cell would be unjoinable and break the relational metamodel; generic
2118
+ `d1..d8` columns would be lossy and re-create the positional-index failure
2119
+ class. A child table is what this metamodel already does for every
2120
+ one-to-many, and it joins natively on the M-ADR 0205 §4.1 engine.
2121
+ foreign_keys:
2122
+ - { column: quality_score_id, references: quality_scores.id, nullable: false }
2123
+ columns:
2124
+ - { name: id, type: string, nullable: false, description: "PK: {quality_score_id}__{dimension_key}." }
2125
+ - { name: quality_score_id, type: string, nullable: false, description: "The assessment this dimension belongs to." }
2126
+ - { name: rubric_id, type: string, nullable: false, description: "Denormalised from the parent so per-rubric dimension queries need no join." }
2127
+ - { name: target_kind, type: string, nullable: false, description: "Denormalised from the parent." }
2128
+ - { name: target_ref, type: string, nullable: false, description: "Denormalised from the parent." }
2129
+ - { name: dimension_key, type: string, nullable: false, description: "The rubric's own dimension identifier, verbatim — `A1` where the rubric uses codes, `definition_precision` where it uses names. NOT normalised into a method-wide vocabulary: the key is how the rubric and its registry refer to the dimension, and rewriting it here would make the row untraceable to the rubric that produced it." }
2130
+ - { name: dimension_score, type: number, nullable: true, description: "Score on that dimension. Empty for an unscored entry (the templates author explicit nulls)." }
2131
+ - { name: dimension_weight, type: number, nullable: true, description: "Weight the rubric assigns the dimension, where discoverable. Usually EMPTY: weights live in the rubric document and the registry header comment, not per entry — so this column is honest about the fact that a weighted_score cannot currently be recomputed from these rows alone." }
2132
+ - { name: source_sdd_id, type: string, nullable: true, description: "Originating SDD slug. Populated by the aggregator per M-ADR 0134." }
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Coverage predicates as SQL — M-ADR 0205 §4.4 (engine-evolution Phase A3).
3
+ *
4
+ * Declarative re-expressions of the participation-constraint predicates —
5
+ * the four catalogue-classics:
6
+ *
7
+ * - repo_capability (M-ADR 0188): every catalogued repository resolves
8
+ * to a capability or declares an exemption; orphans classified by
9
+ * whether the capability_service ⋈ services.primary_repo_id derivation
10
+ * COULD have fired (shape a / claimed-but-unresolved / shape b).
11
+ * - service_capability (M-ADR 0133 §4.2b): every catalogued service is
12
+ * claimed or exempt; tier is explicit and asymmetric per M-ADR 0196
13
+ * §4.3 (`orphaned` is aggregate-only; member tier reports
14
+ * `unresolved-locally`, cause-agnostic); the Path-X leverage axis is
15
+ * reported separately and only when repo_capability.csv exists.
16
+ * - event_coverage (WS3): every catalogued event is attributed to a
17
+ * runtime — service_event edge or resolving publisher column — with
18
+ * the contract-twin alternative route, the column-vs-edge disagreement
19
+ * controls, and the chain-readout/consumer-enumerability metric lines
20
+ * that are never verdicts.
21
+ * - contract_coverage (WS2): every catalogued contract is reachable —
22
+ * capability_contract or service_contract — with the three computed
23
+ * exclusions (deprecated / provider-surface / not-an-interface, the
24
+ * last a positive READ of the spec file), the covered-as-event
25
+ * alternative route, and the M-ADR 0202 availability-manifest info
26
+ * surface. File and YAML ingestion stay host-side; set logic is SQL.
27
+ *
28
+ * The shell scripts in sdd-method's orchestration/scripts/ remain the
29
+ * REFERENCE implementations until A4 cutover: any semantic change lands
30
+ * there first and here second, and the dual-run driver compares the two
31
+ * as structured findings — (kind, subject, classification, leverage) plus
32
+ * every metric integer — never as prose.
33
+ *
34
+ * The relations live in SQL; the classification branching mirrors the
35
+ * reference implementations statement-for-statement, including their
36
+ * duplicate-row semantics (a duplicated id is counted and reported per
37
+ * ROW, never deduplicated away).
38
+ */
39
+ import type { EngineSession } from "./engine-validator.js";
40
+ export type CoverageTier = "member" | "aggregate";
41
+ export interface CoverageFinding {
42
+ readonly predicate: "repo_capability" | "service_capability" | "event_coverage" | "contract_coverage";
43
+ /**
44
+ * M-ADR 0132 §4.3 vocabulary member — plus `report`, which mirrors the
45
+ * event predicate's member-tier `[report]` lines (deliberately NOT a
46
+ * finding in the reference implementation, per M-ADR 0199 §4.3).
47
+ */
48
+ readonly kind: "orphan" | "divergence" | "coverage" | "report";
49
+ readonly subjectId: string;
50
+ /**
51
+ * repo_capability: conflict | shape_a | claimed_unresolved | shape_b.
52
+ * service_capability: conflict | orphaned | unresolved-locally.
53
+ */
54
+ readonly classification: string;
55
+ /** service_capability unresolved rows only, when the axis is computable. */
56
+ readonly leverage?: "yes" | "no" | "na";
57
+ /** Rendering ingredients (A4): the prose the reference lines carry. */
58
+ readonly exemptionReason?: string;
59
+ /** shape_a only: sorted unclaimed service ids (first three) + the full count. */
60
+ readonly unclaimedServices?: readonly string[];
61
+ readonly unclaimedCount?: number;
62
+ /** service_capability unresolved rows: the row's primary_repo_id. */
63
+ readonly primaryRepo?: string;
64
+ }
65
+ export interface RepoCapabilityMetrics {
66
+ readonly total: number;
67
+ readonly byCapability: number;
68
+ readonly byExemption: number;
69
+ readonly conflicting: number;
70
+ readonly unresolved: number;
71
+ readonly shapeA: number;
72
+ readonly shapeB: number;
73
+ readonly other: number;
74
+ }
75
+ export interface ServiceCapabilityMetrics {
76
+ readonly total: number;
77
+ readonly claimed: number;
78
+ readonly exempt: number;
79
+ readonly conflicting: number;
80
+ readonly unresolved: number;
81
+ readonly leverage?: {
82
+ readonly yes: number;
83
+ readonly no: number;
84
+ readonly na: number;
85
+ };
86
+ }
87
+ export declare function runRepoCapabilityCoverage(session: EngineSession): Promise<{
88
+ findings: readonly CoverageFinding[];
89
+ metrics: RepoCapabilityMetrics;
90
+ }>;
91
+ export interface ServiceCoverageOptions {
92
+ readonly tier: CoverageTier;
93
+ /**
94
+ * True when repo_capability.csv EXISTS for this catalogue set (even
95
+ * empty) — file-level presence, exactly as the reference implementation
96
+ * keys the leverage axis. An empty present file means every unresolved
97
+ * service with a primary repo reads leverage=yes; an absent file means
98
+ * the axis is omitted entirely, metric included.
99
+ */
100
+ readonly repoCapabilityAvailable: boolean;
101
+ }
102
+ export declare function runServiceCapabilityCoverage(session: EngineSession, options: ServiceCoverageOptions): Promise<{
103
+ findings: readonly CoverageFinding[];
104
+ metrics: ServiceCapabilityMetrics;
105
+ }>;
106
+ export interface EventCoverageOptions {
107
+ readonly tier: CoverageTier;
108
+ }
109
+ export interface EventCoverageControls {
110
+ /** publisher column set but unresolving against services. */
111
+ readonly colUnresolving: readonly {
112
+ eventId: string;
113
+ publisher: string;
114
+ }[];
115
+ /** publisher resolves but no publishes/produces edge exists. */
116
+ readonly colNoEdge: readonly string[];
117
+ /** publishes edge exists but the row's publisher column is empty. */
118
+ readonly edgeNoCol: readonly string[];
119
+ }
120
+ export interface EventCoverageMetrics {
121
+ readonly total: number;
122
+ readonly covered: number;
123
+ readonly viaContract: number;
124
+ readonly unresolved: number;
125
+ /** Chain readout, never a verdict (M-ADR 0199 §4.1). */
126
+ readonly capReach: number;
127
+ /** M-ADR 0057 analogue, never a verdict. */
128
+ readonly consumerEnum: number;
129
+ }
130
+ export interface EventCoverageResult {
131
+ /** True when the unit holds no event rows — a recorded state, not a rate. */
132
+ readonly na: boolean;
133
+ readonly findings: readonly CoverageFinding[];
134
+ readonly metrics?: EventCoverageMetrics;
135
+ readonly controls?: EventCoverageControls;
136
+ }
137
+ export declare function runEventCoverage(session: EngineSession, options: EventCoverageOptions): Promise<EventCoverageResult>;
138
+ export interface ContractCoverageOptions {
139
+ readonly tier: CoverageTier;
140
+ /**
141
+ * The SDD root spec_path values are relative to. At aggregate tier a
142
+ * member's spec_path is relative to ITS OWN root, so the file is
143
+ * legitimately absent under the aggregate's root — the not-an-interface
144
+ * scope-out then simply does not fire, exactly as in the reference.
145
+ */
146
+ readonly sddRoot: string;
147
+ }
148
+ export interface ContractCoverageMetrics {
149
+ readonly total: number;
150
+ readonly covered: number;
151
+ readonly viaEvent: number;
152
+ readonly excluded: number;
153
+ readonly conflicting: number;
154
+ readonly unresolved: number;
155
+ readonly byExclusion: Readonly<Record<string, number>>;
156
+ /** M-ADR 0057 property — reported, never verdicted. May exceed the ids in contracts.csv. */
157
+ readonly consumersNamed: number;
158
+ readonly ownedOnly: number;
159
+ readonly attrOnly: number;
160
+ readonly both: number;
161
+ }
162
+ export interface ContractAvailabilityInfo {
163
+ readonly attested: number;
164
+ /** Manifest order, duplicates preserved — mirror of the reference list. */
165
+ readonly unmodelled: readonly string[];
166
+ }
167
+ export interface ContractCoverageResult {
168
+ readonly na: boolean;
169
+ readonly findings: readonly CoverageFinding[];
170
+ readonly metrics?: ContractCoverageMetrics;
171
+ /** Informational, never verdict-changing (M-ADR 0202). */
172
+ readonly availability?: ContractAvailabilityInfo;
173
+ readonly availabilityWarning?: string;
174
+ }
175
+ export declare function runContractCoverage(session: EngineSession, options: ContractCoverageOptions): Promise<ContractCoverageResult>;
176
+ //# sourceMappingURL=coverage-predicates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-predicates.d.ts","sourceRoot":"","sources":["../../../src/lib/catalogue/coverage-predicates.ts"],"names":[],"mappings":"AAAA;;;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