@radicaltools/cli 0.6.0 → 0.6.2
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/README.md +46 -7
- package/dist/{chunk-CWKX2ULF.js → chunk-5EK2V6G3.js} +1 -1
- package/dist/{dist-KTTOUFHF.js → dist-BJQ35APN.js} +2 -2
- package/dist/hub-catalogue/concern/concern-accessibility.radical +85 -1
- package/dist/hub-catalogue/concern/concern-api-collections.radical +78 -1
- package/dist/hub-catalogue/concern/concern-api-errors.radical +78 -1
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +78 -1
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +121 -3
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +78 -1
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +78 -1
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +83 -7
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +77 -1
- package/dist/hub-catalogue/concern/concern-authentication.radical +178 -8
- package/dist/hub-catalogue/concern/concern-authorization.radical +133 -7
- package/dist/hub-catalogue/concern/concern-availability.radical +156 -6
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +71 -8
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +136 -6
- package/dist/hub-catalogue/concern/concern-caching.radical +73 -1
- package/dist/hub-catalogue/concern/concern-capacity.radical +124 -5
- package/dist/hub-catalogue/concern/concern-ci-cd-pipeline.radical +154 -15
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +131 -13
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +116 -7
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +174 -13
- package/dist/hub-catalogue/concern/concern-code-style.radical +148 -16
- package/dist/hub-catalogue/concern/concern-communication-style.radical +94 -7
- package/dist/hub-catalogue/concern/concern-data-classification.radical +77 -1
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +87 -5
- package/dist/hub-catalogue/concern/concern-data-store.radical +87 -5
- package/dist/hub-catalogue/concern/concern-decomposition.radical +78 -1
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +150 -11
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +130 -5
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +127 -10
- package/dist/hub-catalogue/concern/concern-deployment.radical +113 -9
- package/dist/hub-catalogue/concern/concern-encryption.radical +146 -5
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +118 -12
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +69 -1
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +148 -9
- package/dist/hub-catalogue/concern/concern-incident-management.radical +122 -1
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +54 -1
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +110 -5
- package/dist/hub-catalogue/concern/concern-messaging.radical +89 -2
- package/dist/hub-catalogue/concern/concern-mobile-performance.radical +67 -1
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +92 -5
- package/dist/hub-catalogue/concern/concern-observability.radical +105 -1
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +140 -5
- package/dist/hub-catalogue/concern/concern-personal-data.radical +206 -7
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +104 -12
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +110 -1
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +99 -7
- package/dist/hub-catalogue/concern/concern-retention.radical +130 -9
- package/dist/hub-catalogue/concern/concern-secrets.radical +196 -12
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +122 -1
- package/dist/hub-catalogue/concern/concern-secure-development.radical +118 -1
- package/dist/hub-catalogue/concern/concern-security-detection.radical +124 -1
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +116 -1
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +162 -19
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +152 -18
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +111 -1
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +83 -7
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +120 -1
- package/dist/hub-catalogue/concern/concern-usability.radical +84 -5
- package/dist/index.js +299 -100
- package/dist/{pdfjs-ABY3IR7F.js → pdfjs-4U3YUAVN.js} +1 -1
- package/dist/{undici-7Z7ZFI7Q.js → undici-7IHHEPSO.js} +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
define_RADICAL_BUILD_default,
|
|
4
4
|
init_define_RADICAL_BUILD
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5EK2V6G3.js";
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
init_define_RADICAL_BUILD();
|
|
@@ -766,7 +766,11 @@ function builtInGovernanceMetamodel() {
|
|
|
766
766
|
{ key: "alternatives", label: "Alternatives considered", type: "textarea" },
|
|
767
767
|
// The Hub concern pack the decision settles (its concern id), for the
|
|
768
768
|
// check's concern-unaddressed rule; set by a pack's import.
|
|
769
|
-
{ key: "concern", label: "Concern (Hub)", type: "text" }
|
|
769
|
+
{ key: "concern", label: "Concern (Hub)", type: "text" },
|
|
770
|
+
// How it settles that concern: `not-needed` records that the system does
|
|
771
|
+
// not need it (Radical Forge, when the person leaves an open concern out):
|
|
772
|
+
// nothing to check, so no fitness function implements it.
|
|
773
|
+
{ key: "concern_outcome", label: "Concern outcome", type: "enum", options: ["settled", "not-needed"] }
|
|
770
774
|
];
|
|
771
775
|
const adr = {
|
|
772
776
|
id: "adr",
|
|
@@ -2407,14 +2411,17 @@ function capitalize(s2) {
|
|
|
2407
2411
|
function earsActionIsClause(action) {
|
|
2408
2412
|
return /\S\s+shall\s+\S/i.test(action);
|
|
2409
2413
|
}
|
|
2414
|
+
function withoutKeyword(text3, keyword) {
|
|
2415
|
+
return text3.trim().replace(new RegExp(`^${keyword}\\s+`, "i"), "").replace(/,\s*(then)?\s*$/i, "").trim();
|
|
2416
|
+
}
|
|
2410
2417
|
function composeEarsSentence(node, subject, statePrecondition) {
|
|
2411
2418
|
const earsType = String(node.ears_type ?? "ubiquitous");
|
|
2412
2419
|
const subj = (subject || "the system").trim();
|
|
2413
2420
|
const action = String(node.action ?? "").trim();
|
|
2414
|
-
const trigger = String(node.trigger ?? "")
|
|
2415
|
-
const precondition = (statePrecondition ?? "").trim() || String(node.precondition ?? "")
|
|
2416
|
-
const unwanted = String(node.unwanted_condition ?? "")
|
|
2417
|
-
const feature = String(node.feature ?? "")
|
|
2421
|
+
const trigger = withoutKeyword(String(node.trigger ?? ""), "when");
|
|
2422
|
+
const precondition = withoutKeyword((statePrecondition ?? "").trim() || String(node.precondition ?? ""), "while");
|
|
2423
|
+
const unwanted = withoutKeyword(String(node.unwanted_condition ?? ""), "if");
|
|
2424
|
+
const feature = withoutKeyword(String(node.feature ?? ""), "where");
|
|
2418
2425
|
const actionPart = action.replace(/\.+$/, "") || "\u2039action\u203A";
|
|
2419
2426
|
const ownClause2 = earsActionIsClause(actionPart);
|
|
2420
2427
|
const shallClause = ownClause2 ? actionPart.replace(/^(The|A|An)\b/, (w) => w.toLowerCase()) : `${subj} shall ${actionPart}`;
|
|
@@ -5340,6 +5347,8 @@ same turn.
|
|
|
5340
5347
|
Syntax:
|
|
5341
5348
|
- LIST NODES
|
|
5342
5349
|
- LIST NODES WHERE <expr> [LIMIT n]
|
|
5350
|
+
- LIST <type, plural or not> [WHERE <expr>] [LIMIT n] \u2014 the same as
|
|
5351
|
+
LIST NODES WHERE type = "<type>" (LIST REQUIREMENTS, LIST FITNESS-FNS)
|
|
5343
5352
|
- LIST RELATIONS
|
|
5344
5353
|
- LIST RELATIONS WHERE <expr> [LIMIT n]
|
|
5345
5354
|
- LIST VIEWS
|
|
@@ -6067,14 +6076,38 @@ function runFullQuery(raw, ctx) {
|
|
|
6067
6076
|
result: summarizeTraversalResults(nodeId, reached, ctx.nodes, relations)
|
|
6068
6077
|
};
|
|
6069
6078
|
}
|
|
6079
|
+
const byType = typeListQuery(raw, ctx);
|
|
6080
|
+
if (byType) return { ...runFullQuery(byType, ctx), query: raw };
|
|
6070
6081
|
throw new Error(`Unsupported query: ${raw}`);
|
|
6071
6082
|
}
|
|
6083
|
+
function nodeTypeNamed(word, ctx) {
|
|
6084
|
+
const types2 = /* @__PURE__ */ new Set([...Object.keys(ctx.metamodel?.nodeTypes ?? {}), ...Object.values(ctx.nodes).map((n) => n.type)]);
|
|
6085
|
+
const w = word.trim().toLowerCase().replace(/[\s_]+/g, "-");
|
|
6086
|
+
const candidates = [w, w.replace(/ies$/, "y"), w.replace(/es$/, ""), w.replace(/s$/, "")];
|
|
6087
|
+
for (const c of candidates) if (c && types2.has(c)) return c;
|
|
6088
|
+
return null;
|
|
6089
|
+
}
|
|
6090
|
+
function typeListQuery(raw, ctx) {
|
|
6091
|
+
const m = /^LIST\s+([A-Za-z][\w-]*(?:[ _][A-Za-z][\w-]*)?)(?:\s+WHERE\s+(.+?))?(?:\s+LIMIT\s+(\d+))?$/i.exec(raw);
|
|
6092
|
+
if (!m || /^(NODES|RELATIONS|VIEWS|SEQUENCES|TECHNOLOGIES)$/i.test(m[1])) return null;
|
|
6093
|
+
const type2 = nodeTypeNamed(m[1], ctx);
|
|
6094
|
+
if (!type2) return null;
|
|
6095
|
+
return `LIST NODES WHERE type = "${type2}"${m[2] ? ` AND (${m[2]})` : ""}${m[3] ? ` LIMIT ${m[3]}` : ""}`;
|
|
6096
|
+
}
|
|
6072
6097
|
|
|
6073
6098
|
// ../../packages/common/src/hubImport.ts
|
|
6074
6099
|
init_define_RADICAL_BUILD();
|
|
6075
6100
|
|
|
6101
|
+
// ../../packages/common/src/concernScope.ts
|
|
6102
|
+
init_define_RADICAL_BUILD();
|
|
6103
|
+
|
|
6076
6104
|
// ../../packages/common/src/concerns.ts
|
|
6077
6105
|
var CONCERN_KEY = "concern";
|
|
6106
|
+
function concernsOf(node) {
|
|
6107
|
+
const value = node[CONCERN_KEY];
|
|
6108
|
+
return typeof value === "string" ? value.split(",").map((c) => c.trim()).filter(Boolean) : [];
|
|
6109
|
+
}
|
|
6110
|
+
var CONCERN_OUTCOME_KEY = "concern_outcome";
|
|
6078
6111
|
var isConcernPack = (meta) => meta.category === "concern" && !!meta.concern;
|
|
6079
6112
|
function questionLine(param) {
|
|
6080
6113
|
const choices = param.options?.length ? ` (${param.options.map((o) => `${o.value}: ${o.label}`).join(" | ")})` : "";
|
|
@@ -6097,10 +6130,11 @@ function concernStatuses(packs, nodes, relations) {
|
|
|
6097
6130
|
const adrsBy = /* @__PURE__ */ new Map();
|
|
6098
6131
|
for (const n of Object.values(nodes)) {
|
|
6099
6132
|
if (n.type !== "adr") continue;
|
|
6100
|
-
const concern
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6133
|
+
for (const concern of concernsOf(n)) {
|
|
6134
|
+
const list = adrsBy.get(concern);
|
|
6135
|
+
if (list) list.push(n);
|
|
6136
|
+
else adrsBy.set(concern, [n]);
|
|
6137
|
+
}
|
|
6104
6138
|
}
|
|
6105
6139
|
const constrained = /* @__PURE__ */ new Map();
|
|
6106
6140
|
for (const r of Object.values(relations)) {
|
|
@@ -6143,7 +6177,8 @@ function unboundDecisions(packs, nodes, relations, metamodel) {
|
|
|
6143
6177
|
if (r.relationType === "implements" && nodes[r.sourceId]?.type === "fitness-fn") implementedBy.set(r.targetId, [...implementedBy.get(r.targetId) ?? [], r.sourceId]);
|
|
6144
6178
|
}
|
|
6145
6179
|
return Object.values(nodes).filter((n) => n.type === "adr" && prop2(n, CONCERN_KEY) && prop2(n, "status") === "accepted" && !constraining.has(n.id)).map((adr) => {
|
|
6146
|
-
const
|
|
6180
|
+
const marked = concernsOf(adr);
|
|
6181
|
+
const pack = marked.length === 1 ? packs.find((p) => p.concern.id === marked[0]) : void 0;
|
|
6147
6182
|
return {
|
|
6148
6183
|
adr,
|
|
6149
6184
|
concern: prop2(adr, CONCERN_KEY),
|
|
@@ -6623,7 +6658,8 @@ function testRule(outcome, message) {
|
|
|
6623
6658
|
if (!model.tests) return [];
|
|
6624
6659
|
return Object.values(model.nodes).filter((n) => TESTED_TYPES.includes(n.type)).flatMap((node) => testOutcomes(node, model).filter((o) => o.outcome === outcome).map((o) => {
|
|
6625
6660
|
const related = failing ? affectedBy(model, node).map((n) => n.id) : [];
|
|
6626
|
-
|
|
6661
|
+
const reason = outcome === "failed" ? findTests(o.id, model.tests ?? []).matches.find((c) => c.status === "failed" && c.message)?.message : void 0;
|
|
6662
|
+
return { nodeId: node.id, test: o.id.raw, message: message(node, o.id.raw, model), ...reason ? { reason } : {}, ...related.length ? { relatedIds: related } : {} };
|
|
6627
6663
|
}));
|
|
6628
6664
|
};
|
|
6629
6665
|
}
|
|
@@ -6646,6 +6682,9 @@ function metricRule(outcome, message) {
|
|
|
6646
6682
|
const origin = originOf(node);
|
|
6647
6683
|
return elements.flatMap((element) => elementConditions(node, model, element).filter((r) => r.outcome === outcome).map((r) => ({
|
|
6648
6684
|
nodeId: origin ? element.id : node.id,
|
|
6685
|
+
condition: r.condition,
|
|
6686
|
+
...r.measurement ? { measured: r.measurement } : {},
|
|
6687
|
+
...r.detail ? { why: r.detail } : {},
|
|
6649
6688
|
message: `${message(node, r.condition, seen(r), r.detail).replace(/\.$/, "")} for ${TYPE_NAME[element.type] ?? element.type} ${quote(element)}${origin ? ` (a fitness function of ${origin})` : ""}.`,
|
|
6650
6689
|
...origin ? { relatedIds: [node.id] } : outcome === "failed" ? { relatedIds: [element.id] } : {}
|
|
6651
6690
|
})));
|
|
@@ -6653,7 +6692,14 @@ function metricRule(outcome, message) {
|
|
|
6653
6692
|
const metricLines = new Set(conditionsOf(node).filter((c) => c.kind === "metric").map((c) => c.raw));
|
|
6654
6693
|
return conditionResults(node, model).filter((r) => r.outcome === outcome && metricLines.has(r.condition)).map((r) => {
|
|
6655
6694
|
const related = outcome === "failed" ? affectedBy(model, node).map((n) => n.id) : [];
|
|
6656
|
-
return {
|
|
6695
|
+
return {
|
|
6696
|
+
nodeId: node.id,
|
|
6697
|
+
condition: r.condition,
|
|
6698
|
+
...r.measurement ? { measured: r.measurement } : {},
|
|
6699
|
+
...r.detail ? { why: r.detail } : {},
|
|
6700
|
+
message: message(node, r.condition, seen(r), r.detail),
|
|
6701
|
+
...related.length ? { relatedIds: related } : {}
|
|
6702
|
+
};
|
|
6657
6703
|
});
|
|
6658
6704
|
});
|
|
6659
6705
|
};
|
|
@@ -6864,7 +6910,7 @@ var sourceReading = (text3) => reading(text3.replace(/(\d)_(?=\d)/g, "$1").repla
|
|
|
6864
6910
|
var CHECK_RULES = [
|
|
6865
6911
|
{
|
|
6866
6912
|
id: "metamodel",
|
|
6867
|
-
description: 'The model follows its metamodel
|
|
6913
|
+
description: '**The model follows its metamodel**: types, parents, relation pairs, required properties, references and the state machine rules. The Validation list in Studio and get_issues over MCP, with their severities: an unknown type or a relation to no element is an error, a relation pair the metamodel does not allow a warning (`"metamodel": "error"` makes every issue one).',
|
|
6868
6914
|
severity: "error",
|
|
6869
6915
|
dimension: "consistency",
|
|
6870
6916
|
run: (model) => validateModel(model.nodes, model.relations, model.metamodel).map((issue) => ({
|
|
@@ -6877,42 +6923,42 @@ var CHECK_RULES = [
|
|
|
6877
6923
|
},
|
|
6878
6924
|
{
|
|
6879
6925
|
id: "requirement-incomplete",
|
|
6880
|
-
description: "A requirement has an action and every field its EARS type reads (an event-driven one a trigger, a state-driven one a precondition, \u2026).",
|
|
6926
|
+
description: "**A requirement has an action and every field its EARS type reads** (an event-driven one a trigger, a state-driven one a precondition, \u2026).",
|
|
6881
6927
|
severity: "warning",
|
|
6882
6928
|
dimension: "completeness",
|
|
6883
6929
|
run: (model) => nodesOf(model, "requirement").filter((n) => !composeEarsSentence(n, void 0, requirementStatePhrase(n, model.nodes, model.relations)).complete).map((n) => ({ nodeId: n.id, message: `Requirement ${quote(n)} (${prop3(n, "ears_type") || "ubiquitous"}) misses the action or a field its EARS type needs.` }))
|
|
6884
6930
|
},
|
|
6885
6931
|
{
|
|
6886
6932
|
id: "requirement-without-scenario",
|
|
6887
|
-
description: "Every requirement is verified by at least one scenario
|
|
6933
|
+
description: "**Every requirement is verified by at least one scenario**.",
|
|
6888
6934
|
severity: "warning",
|
|
6889
6935
|
dimension: "traceability",
|
|
6890
6936
|
run: (model) => model.metamodel.nodeTypes.scenario ? unlinked(model, "requirement", "verifies", "in", ["scenario"]).map((n) => ({ nodeId: n.id, message: `No scenario verifies requirement ${quote(n)}.` })) : []
|
|
6891
6937
|
},
|
|
6892
6938
|
{
|
|
6893
6939
|
id: "requirement-unsatisfied",
|
|
6894
|
-
description: "Every requirement is satisfied by an element of the architecture
|
|
6940
|
+
description: "**Every requirement is satisfied by an element of the architecture**.",
|
|
6895
6941
|
severity: "warning",
|
|
6896
6942
|
dimension: "traceability",
|
|
6897
6943
|
run: (model) => unlinked(model, "requirement", "satisfies", "in").map((n) => ({ nodeId: n.id, message: `Nothing satisfies requirement ${quote(n)}.` }))
|
|
6898
6944
|
},
|
|
6899
6945
|
{
|
|
6900
6946
|
id: "requirement-without-origin",
|
|
6901
|
-
description: "Every requirement derives from a need or from another requirement
|
|
6947
|
+
description: "**Every requirement derives from a need or from another requirement**.",
|
|
6902
6948
|
severity: "warning",
|
|
6903
6949
|
dimension: "traceability",
|
|
6904
6950
|
run: (model) => unlinked(model, "requirement", "derives", "out", ["need", "requirement"]).map((n) => ({ nodeId: n.id, message: `Requirement ${quote(n)} derives from no need and no other requirement.` }))
|
|
6905
6951
|
},
|
|
6906
6952
|
{
|
|
6907
6953
|
id: "need-without-requirement",
|
|
6908
|
-
description: "Every need has at least one requirement derived from it
|
|
6954
|
+
description: "**Every need has at least one requirement derived from it**, or from a need inside it (a need that derives from it, Part of).",
|
|
6909
6955
|
severity: "warning",
|
|
6910
6956
|
dimension: "traceability",
|
|
6911
6957
|
run: (model) => unlinked(model, "need", "derives", "in", ["requirement"]).filter((n) => !requirementsOfNeed(model, n.id).length).map((n) => ({ nodeId: n.id, message: `No requirement derives from need ${quote(n)}.` }))
|
|
6912
6958
|
},
|
|
6913
6959
|
{
|
|
6914
6960
|
id: "derives-quote-missing",
|
|
6915
|
-
description: "A requirement's derives relation to a need quotes the words of the need it rests on (property quote, one verbatim fragment per line). Off unless check.json turns it on; the goal requirements-quoting-need follows it in percent.",
|
|
6961
|
+
description: "A requirement's derives relation to a need **quotes the words of the need it rests on** (property quote, one verbatim fragment per line). Off unless check.json turns it on; the goal requirements-quoting-need follows it in percent.",
|
|
6916
6962
|
severity: "warning",
|
|
6917
6963
|
off: true,
|
|
6918
6964
|
dimension: "traceability",
|
|
@@ -6920,7 +6966,7 @@ var CHECK_RULES = [
|
|
|
6920
6966
|
},
|
|
6921
6967
|
{
|
|
6922
6968
|
id: "derives-quote-not-in-need",
|
|
6923
|
-
description: "Every fragment a derives relation quotes is in the need's text outside its superseded answers, as whole words (case, white space, Markdown marks, dashes and quotation marks aside; an ellipsis joins pieces that must be there in that order, within one question, answer or the text before the questions), and holds at least two words; only a relation to a need quotes.",
|
|
6969
|
+
description: "**Every fragment a derives relation quotes is in the need's text** outside its superseded answers, as whole words (case, white space, Markdown marks, dashes and quotation marks aside; an ellipsis joins pieces that must be there in that order, within one question, answer or the text before the questions), and holds at least two words; only a relation to a need quotes.",
|
|
6924
6970
|
severity: "error",
|
|
6925
6971
|
dimension: "traceability",
|
|
6926
6972
|
run: (model) => Object.values(model.relations).filter((r) => r.relationType === "derives" && relationQuote(r).trim() && model.nodes[r.sourceId]?.type === "requirement" && !originOf(model.nodes[r.sourceId])).flatMap((r) => {
|
|
@@ -6935,7 +6981,7 @@ var CHECK_RULES = [
|
|
|
6935
6981
|
},
|
|
6936
6982
|
{
|
|
6937
6983
|
id: "quote-value-missing",
|
|
6938
|
-
description: "Every hard value a derives relation quotes (a number, null, true or false, a date or time, an identifier in backticks or quotation marks) is in the requirement's sentence
|
|
6984
|
+
description: "**Every hard value a derives relation quotes** (a number, null, true or false, a date or time, an identifier in backticks or quotation marks) **is in the requirement's sentence**, in that form or another (20 percent as 20%, 15 minutes as 900 seconds, 12.30 \u20AC as 1230 cents).",
|
|
6939
6985
|
severity: "warning",
|
|
6940
6986
|
dimension: "traceability",
|
|
6941
6987
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => {
|
|
@@ -6946,14 +6992,14 @@ var CHECK_RULES = [
|
|
|
6946
6992
|
},
|
|
6947
6993
|
{
|
|
6948
6994
|
id: "quote-value-differs",
|
|
6949
|
-
description: "A requirement keeps the sense the words it quotes give a value
|
|
6995
|
+
description: "**A requirement keeps the sense the words it quotes give a value**: the same side of a limit (at most, more than, from \u2026 to; a refusal speaks of the other side), the same unit, the same order of a list, the same rounding.",
|
|
6950
6996
|
severity: "warning",
|
|
6951
6997
|
dimension: "traceability",
|
|
6952
6998
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => quoteSenseGaps(model, req))
|
|
6953
6999
|
},
|
|
6954
7000
|
{
|
|
6955
7001
|
id: "requirement-value-unquoted",
|
|
6956
|
-
description: "Every hard value a requirement states that quotes its need is in those quotes (or in those of the requirements it derives from), in that form or another, or its rationale names it as a decision of the model.",
|
|
7002
|
+
description: "**Every hard value a requirement states that quotes its need is in those quotes** (or in those of the requirements it derives from), in that form or another, or its rationale names it as a decision of the model.",
|
|
6957
7003
|
severity: "warning",
|
|
6958
7004
|
dimension: "traceability",
|
|
6959
7005
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => {
|
|
@@ -6963,7 +7009,7 @@ var CHECK_RULES = [
|
|
|
6963
7009
|
},
|
|
6964
7010
|
{
|
|
6965
7011
|
id: "scenario-value-missing",
|
|
6966
|
-
description: "Every hard value a requirement takes from the words it quotes is in a scenario that verifies it (its given, when, then or Gherkin text): what the person said reaches a check.",
|
|
7012
|
+
description: "**Every hard value a requirement takes from the words it quotes is in a scenario that verifies it** (its given, when, then or Gherkin text): what the person said reaches a check.",
|
|
6967
7013
|
severity: "warning",
|
|
6968
7014
|
dimension: "traceability",
|
|
6969
7015
|
run: (model) => nodesOf(model, "requirement").filter((n) => !originOf(n)).flatMap((req) => {
|
|
@@ -6980,7 +7026,7 @@ var CHECK_RULES = [
|
|
|
6980
7026
|
},
|
|
6981
7027
|
{
|
|
6982
7028
|
id: "example-not-in-scenario",
|
|
6983
|
-
description:
|
|
7029
|
+
description: `**Every example a need gives with values** ("for example", "e.g.", "Example:") **is whole in one scenario** of the requirements derived from the need: the person's own case checks what they meant.`,
|
|
6984
7030
|
severity: "warning",
|
|
6985
7031
|
dimension: "traceability",
|
|
6986
7032
|
run: (model) => nodesOf(model, "need").filter((n) => !originOf(n)).flatMap((need) => {
|
|
@@ -6998,9 +7044,9 @@ var CHECK_RULES = [
|
|
|
6998
7044
|
},
|
|
6999
7045
|
{
|
|
7000
7046
|
id: "scenario-value-untested",
|
|
7001
|
-
description: "With the test sources (radical check reads the files of the tests .radical/radical.json binds): every hard value a scenario names that tells a case apart (not a count below 10) is in the file of a test bound to it
|
|
7047
|
+
description: "With the test sources (radical check reads the files of the tests .radical/radical.json binds): **every hard value a scenario names that tells a case apart** (not a count below 10) **is in the file of a test bound to it**.",
|
|
7002
7048
|
severity: "warning",
|
|
7003
|
-
dimension: "
|
|
7049
|
+
dimension: "behaviour",
|
|
7004
7050
|
run: (model) => {
|
|
7005
7051
|
const sources = model.testSources;
|
|
7006
7052
|
if (!sources) return [];
|
|
@@ -7018,7 +7064,7 @@ var CHECK_RULES = [
|
|
|
7018
7064
|
},
|
|
7019
7065
|
{
|
|
7020
7066
|
id: "need-answer-unquoted",
|
|
7021
|
-
description: "Every paragraph and list item of an answer of a person in a need (from a line that starts with A:, Answer: or A1:, or an answer on its question's line; lead-ins and lines of fewer than four words aside) is quoted by a requirement that derives from the need
|
|
7067
|
+
description: "**Every paragraph and list item of an answer of a person in a need** (from a line that starts with A:, Answer: or A1:, or an answer on its question's line; lead-ins and lines of fewer than four words aside) **is quoted by a requirement that derives from the need**, or the answer is marked (no requirement) or (superseded).",
|
|
7022
7068
|
severity: "warning",
|
|
7023
7069
|
dimension: "traceability",
|
|
7024
7070
|
run: (model) => {
|
|
@@ -7036,7 +7082,7 @@ var CHECK_RULES = [
|
|
|
7036
7082
|
},
|
|
7037
7083
|
{
|
|
7038
7084
|
id: "need-answer-changed",
|
|
7039
|
-
description: "With the model at the base (radical check in git, the Inspector with the branch's base): every answer of a person a need held there it still holds, word for word
|
|
7085
|
+
description: "With the model at the base (radical check in git, the Inspector with the branch's base): **every answer of a person a need held there it still holds, word for word**; a person's words are only added to, and an answer a later one replaces is marked (superseded).",
|
|
7040
7086
|
severity: "error",
|
|
7041
7087
|
dimension: "traceability",
|
|
7042
7088
|
run: (model) => {
|
|
@@ -7050,21 +7096,21 @@ var CHECK_RULES = [
|
|
|
7050
7096
|
},
|
|
7051
7097
|
{
|
|
7052
7098
|
id: "scenario-verifies-nothing",
|
|
7053
|
-
description: "Every scenario verifies a requirement or a state machine
|
|
7099
|
+
description: "**Every scenario verifies a requirement or a state machine**.",
|
|
7054
7100
|
severity: "warning",
|
|
7055
7101
|
dimension: "traceability",
|
|
7056
7102
|
run: (model) => unlinked(model, "scenario", "verifies", "out").map((n) => ({ nodeId: n.id, message: `Scenario ${quote(n)} verifies no requirement and no state machine.` }))
|
|
7057
7103
|
},
|
|
7058
7104
|
{
|
|
7059
7105
|
id: "adr-without-fitness-fn",
|
|
7060
|
-
description: "Every accepted ADR is implemented by a fitness function that checks it.",
|
|
7106
|
+
description: "**Every accepted ADR is implemented by a fitness function** that checks it.",
|
|
7061
7107
|
severity: "warning",
|
|
7062
7108
|
dimension: "decisions",
|
|
7063
|
-
run: (model) => model.metamodel.nodeTypes["fitness-fn"] ? unlinked(model, "adr", "implements", "in", ["fitness-fn"]).filter((n) => prop3(n, "status") === "accepted").filter((n) => !relationsOf(model, "waives").from.has(n.id)).map((n) => ({ nodeId: n.id, message: `No fitness function implements accepted ADR ${quote(n)}.` })) : []
|
|
7109
|
+
run: (model) => model.metamodel.nodeTypes["fitness-fn"] ? unlinked(model, "adr", "implements", "in", ["fitness-fn"]).filter((n) => prop3(n, "status") === "accepted").filter((n) => !relationsOf(model, "waives").from.has(n.id) && prop3(n, CONCERN_OUTCOME_KEY) !== "not-needed").map((n) => ({ nodeId: n.id, message: `No fitness function implements accepted ADR ${quote(n)}.` })) : []
|
|
7064
7110
|
},
|
|
7065
7111
|
{
|
|
7066
7112
|
id: "inherited-adr-unapplied",
|
|
7067
|
-
description: "Every accepted ADR of a model this one depends on (deps.json) binds it
|
|
7113
|
+
description: "**Every accepted ADR of a model this one depends on** (deps.json) **binds it**: it constrains at least one of this model's elements, or an accepted ADR of this model waives it and says why.",
|
|
7068
7114
|
severity: "error",
|
|
7069
7115
|
dimension: "decisions",
|
|
7070
7116
|
run: (model) => inheritedDecisions(model).filter((d) => !d.elements.length).map(({ adr, origin }) => ({
|
|
@@ -7074,7 +7120,7 @@ var CHECK_RULES = [
|
|
|
7074
7120
|
},
|
|
7075
7121
|
{
|
|
7076
7122
|
id: "inherited-adr-unchecked",
|
|
7077
|
-
description: "Every element an accepted ADR of a model this one depends on constrains is checked
|
|
7123
|
+
description: "**Every element an accepted ADR of a model this one depends on constrains is checked**: a fitness function implements the ADR (this model's or the other's) and names its check (metric conditions, or tests .radical/radical.json binds to it).",
|
|
7078
7124
|
severity: "error",
|
|
7079
7125
|
dimension: "decisions",
|
|
7080
7126
|
run: (model) => inheritedDecisions(model).flatMap(({ adr, origin, elements }) => {
|
|
@@ -7088,7 +7134,7 @@ var CHECK_RULES = [
|
|
|
7088
7134
|
},
|
|
7089
7135
|
{
|
|
7090
7136
|
id: "adr-incomplete",
|
|
7091
|
-
description: "An accepted ADR records its date, context, decision and consequences
|
|
7137
|
+
description: "**An accepted ADR records its date, context, decision and consequences**.",
|
|
7092
7138
|
severity: "warning",
|
|
7093
7139
|
dimension: "completeness",
|
|
7094
7140
|
run: (model) => nodesOf(model, "adr").filter((n) => prop3(n, "status") === "accepted").flatMap((n) => {
|
|
@@ -7098,7 +7144,7 @@ var CHECK_RULES = [
|
|
|
7098
7144
|
},
|
|
7099
7145
|
{
|
|
7100
7146
|
id: "adr-superseded-unlinked",
|
|
7101
|
-
description: "An ADR is superseded exactly when a newer ADR supersedes it
|
|
7147
|
+
description: "**An ADR is superseded exactly when a newer ADR supersedes it**.",
|
|
7102
7148
|
severity: "warning",
|
|
7103
7149
|
dimension: "consistency",
|
|
7104
7150
|
run: (model) => {
|
|
@@ -7115,7 +7161,7 @@ var CHECK_RULES = [
|
|
|
7115
7161
|
},
|
|
7116
7162
|
{
|
|
7117
7163
|
id: "fitness-fn-unlinked",
|
|
7118
|
-
description: "Every fitness function implements an ADR or constrains an element
|
|
7164
|
+
description: "**Every fitness function implements an ADR or constrains an element**.",
|
|
7119
7165
|
severity: "warning",
|
|
7120
7166
|
dimension: "decisions",
|
|
7121
7167
|
run: (model) => {
|
|
@@ -7126,7 +7172,7 @@ var CHECK_RULES = [
|
|
|
7126
7172
|
},
|
|
7127
7173
|
{
|
|
7128
7174
|
id: "concern-unaddressed",
|
|
7129
|
-
description: "Every concern a Hub concern pack finds in the model is settled by an accepted ADR marked with it (property `concern`) that constrains the elements it applies to, or what contains them.",
|
|
7175
|
+
description: "**Every concern a Hub concern pack finds in the model is settled by an accepted ADR marked with it** (property `concern`) that constrains the elements it applies to, or what contains them.",
|
|
7130
7176
|
severity: "warning",
|
|
7131
7177
|
dimension: "decisions",
|
|
7132
7178
|
run: (model) => openConcerns(model.concerns ?? [], model.nodes, model.relations, model.metamodel).map(({ pack, open: open4, pending }) => {
|
|
@@ -7143,7 +7189,7 @@ var CHECK_RULES = [
|
|
|
7143
7189
|
},
|
|
7144
7190
|
{
|
|
7145
7191
|
id: "concern-unbound",
|
|
7146
|
-
description: "Every accepted ADR marked with a concern (property `concern`, set by a Hub concern pack) constrains the elements it settles the concern for
|
|
7192
|
+
description: "**Every accepted ADR marked with a concern** (property `concern`, set by a Hub concern pack) **constrains the elements it settles the concern for**.",
|
|
7147
7193
|
severity: "warning",
|
|
7148
7194
|
dimension: "decisions",
|
|
7149
7195
|
run: (model) => unboundDecisions(model.concerns ?? [], model.nodes, model.relations, model.metamodel).map(({ adr, concern, checks, bindTo }) => ({
|
|
@@ -7155,21 +7201,21 @@ var CHECK_RULES = [
|
|
|
7155
7201
|
},
|
|
7156
7202
|
{
|
|
7157
7203
|
id: "scenario-without-metrics",
|
|
7158
|
-
description: "Every scenario has what checks it
|
|
7204
|
+
description: "**Every scenario has what checks it**: tests the repository's .radical/radical.json binds to it, or metric conditions (property `metrics`, one per line: `<metric>{<labels>} <op> <number> [unit]`). One the repository must verify is scenario-not-verified-here's.",
|
|
7159
7205
|
severity: "warning",
|
|
7160
|
-
dimension: "
|
|
7206
|
+
dimension: "behaviour",
|
|
7161
7207
|
run: (model) => nodesOf(model, "scenario").filter((n) => !conditionsOf(n).length && !verifiedHere(model, n)).map((n) => ({ nodeId: n.id, message: `Scenario ${quote(n)} names no check.` }))
|
|
7162
7208
|
},
|
|
7163
7209
|
{
|
|
7164
7210
|
id: "scenario-not-verified-here",
|
|
7165
|
-
description: "With the repository's .radical/radical.json (the CLI): every scenario of a requirement an element the repository builds satisfies has tests the file binds to it, or metric conditions
|
|
7211
|
+
description: "With the repository's .radical/radical.json (the CLI): **every scenario of a requirement an element the repository builds satisfies has tests the file binds to it, or metric conditions**.",
|
|
7166
7212
|
severity: "warning",
|
|
7167
|
-
dimension: "
|
|
7213
|
+
dimension: "behaviour",
|
|
7168
7214
|
run: (model) => nodesOf(model, "scenario").filter((n) => !conditionsOf(n).length && verifiedHere(model, n)).map((n) => ({ nodeId: n.id, message: `Scenario ${quote(n)} is this repository's to verify (an element it builds satisfies its requirement), and ${model.repository.file} binds no test to it: radical verify ${n.id} --test "<file> \u203A <title>".` }))
|
|
7169
7215
|
},
|
|
7170
7216
|
{
|
|
7171
7217
|
id: "model-names-tests",
|
|
7172
|
-
description: "A scenario or fitness function names no test in its Metrics
|
|
7218
|
+
description: "**A scenario or fitness function names no test in its Metrics**: the repository binds its tests in .radical/radical.json (radical setup moves them there). A test named in Metrics still counts.",
|
|
7173
7219
|
severity: "warning",
|
|
7174
7220
|
dimension: "traceability",
|
|
7175
7221
|
run: (model) => Object.values(model.nodes).filter((n) => TESTED_TYPES.includes(n.type) && !originOf(n)).flatMap((n) => {
|
|
@@ -7179,14 +7225,14 @@ var CHECK_RULES = [
|
|
|
7179
7225
|
},
|
|
7180
7226
|
{
|
|
7181
7227
|
id: "fitness-fn-without-metrics",
|
|
7182
|
-
description: "Every fitness function states what checks it and when it passes (property `metrics`, one condition per line).",
|
|
7228
|
+
description: "**Every fitness function states what checks it and when it passes** (property `metrics`, one condition per line).",
|
|
7183
7229
|
severity: "warning",
|
|
7184
|
-
dimension: "
|
|
7230
|
+
dimension: "fitness",
|
|
7185
7231
|
run: (model) => nodesOf(model, "fitness-fn").filter((n) => !conditionsOf(n).length).map((n) => ({ nodeId: n.id, message: `Fitness function ${quote(n)} names no check.` }))
|
|
7186
7232
|
},
|
|
7187
7233
|
{
|
|
7188
7234
|
id: "fitness-fn-unclassified",
|
|
7189
|
-
description: "Every fitness function states its characteristic (ISO/IEC 25010), scope, cadence (with the event it is triggered on, or how often a temporal one falls due) and invocation.",
|
|
7235
|
+
description: "**Every fitness function states its characteristic** (ISO/IEC 25010), scope, cadence (with the event it is triggered on, or how often a temporal one falls due) and invocation.",
|
|
7190
7236
|
severity: "warning",
|
|
7191
7237
|
dimension: "decisions",
|
|
7192
7238
|
run: (model) => nodesOf(model, "fitness-fn").flatMap((n) => {
|
|
@@ -7199,7 +7245,7 @@ var CHECK_RULES = [
|
|
|
7199
7245
|
},
|
|
7200
7246
|
{
|
|
7201
7247
|
id: "fitness-fn-measure-invalid",
|
|
7202
|
-
description:
|
|
7248
|
+
description: `**Every line of a fitness function's \`measure\` names a sensor** of radical sense (${SENSOR_NAMES.join(", ")}) or, run by the CLI, one of the repository's .radical/sensors/sensors.json.`,
|
|
7203
7249
|
severity: "error",
|
|
7204
7250
|
dimension: "completeness",
|
|
7205
7251
|
run: (model) => model.sensors === void 0 ? [] : nodesOf(model, "fitness-fn").flatMap((n) => parseMeasure(n.measure).filter((line) => !isSensorName(line.sensor) && !model.sensors?.names.includes(line.sensor)).map((line) => ({
|
|
@@ -7209,14 +7255,14 @@ var CHECK_RULES = [
|
|
|
7209
7255
|
},
|
|
7210
7256
|
{
|
|
7211
7257
|
id: "repository-mapping",
|
|
7212
|
-
description: "With the repository's .radical/radical.json (the CLI): each entry names an element of the model
|
|
7258
|
+
description: "With the repository's .radical/radical.json (the CLI): **each entry names an element of the model**, its own or another model's of the federation, under the element's name, with paths the repository has; tests are bound to scenarios and fitness functions.",
|
|
7213
7259
|
severity: "warning",
|
|
7214
7260
|
dimension: "traceability",
|
|
7215
7261
|
run: repositoryMapping
|
|
7216
7262
|
},
|
|
7217
7263
|
{
|
|
7218
7264
|
id: "repository-settings-in-model",
|
|
7219
|
-
description: `The model's check.json holds the model's rules and goals; the repository's test files (test-unbound's include and exclude) and CI's artifacts belong in .radical/radical.json ("tests", "ci"). Those in check.json are still read.`,
|
|
7265
|
+
description: `The model's check.json holds the model's rules and goals; **the repository's test files** (test-unbound's include and exclude) and CI's artifacts **belong in .radical/radical.json** ("tests", "ci"). Those in check.json are still read.`,
|
|
7220
7266
|
severity: "warning",
|
|
7221
7267
|
dimension: "completeness",
|
|
7222
7268
|
run: (model) => (model.settingsInModel ?? []).map((what) => ({
|
|
@@ -7226,7 +7272,7 @@ var CHECK_RULES = [
|
|
|
7226
7272
|
},
|
|
7227
7273
|
{
|
|
7228
7274
|
id: "description-path-missing",
|
|
7229
|
-
description: "With the repository (the CLI): a path from the repository's root an element's description names (apps/cli/src/sense.ts) is in the repository
|
|
7275
|
+
description: "With the repository (the CLI): **a path from the repository's root an element's description names** (apps/cli/src/sense.ts) **is in the repository**; one that is gone tells of code that moved.",
|
|
7230
7276
|
severity: "warning",
|
|
7231
7277
|
dimension: "consistency",
|
|
7232
7278
|
run: (model) => Object.entries(model.missingPaths ?? {}).flatMap(([id, paths]) => {
|
|
@@ -7236,21 +7282,21 @@ var CHECK_RULES = [
|
|
|
7236
7282
|
},
|
|
7237
7283
|
{
|
|
7238
7284
|
id: "measure-with-arguments",
|
|
7239
|
-
description:
|
|
7285
|
+
description: `**A fitness function's measure lines name sensors only**: an adapter's arguments (files, options of the repository) belong to a sensor of .radical/sensors/sensors.json ({ "adapter": "playwright", "args": [...] }). A line with arguments still runs.`,
|
|
7240
7286
|
severity: "warning",
|
|
7241
7287
|
dimension: "completeness",
|
|
7242
7288
|
run: (model) => nodesOf(model, "fitness-fn").flatMap((n) => parseMeasure(n.measure).filter((line) => line.args.length > 0).map((line) => ({ nodeId: n.id, message: `Fitness function ${quote(n)}: measure "${line.raw}" has the repository's arguments; name a sensor of .radical/sensors/sensors.json that holds them ({ "adapter": "${line.sensor}", "args": [...] }).` })))
|
|
7243
7289
|
},
|
|
7244
7290
|
{
|
|
7245
7291
|
id: "metric-invalid",
|
|
7246
|
-
description: "Every line of a scenario's or fitness function's `metrics` reads as a condition
|
|
7292
|
+
description: "**Every line of a scenario's or fitness function's `metrics` reads as a condition**, its unit converts to the unit of the measurement it matches, and `combine` and `max_age` read.",
|
|
7247
7293
|
severity: "error",
|
|
7248
7294
|
dimension: "completeness",
|
|
7249
7295
|
run: invalidChecks
|
|
7250
7296
|
},
|
|
7251
7297
|
{
|
|
7252
7298
|
id: "test-failed",
|
|
7253
|
-
description: "With --report: every test a scenario or fitness function names passed
|
|
7299
|
+
description: "With --report: **every test a scenario or fitness function names passed**.",
|
|
7254
7300
|
severity: "error",
|
|
7255
7301
|
dimension: "tests",
|
|
7256
7302
|
readsReports: true,
|
|
@@ -7258,7 +7304,7 @@ var CHECK_RULES = [
|
|
|
7258
7304
|
},
|
|
7259
7305
|
{
|
|
7260
7306
|
id: "test-not-found",
|
|
7261
|
-
description: "With --report: every test a scenario or fitness function names is in the report of its file (a renamed or deleted test is not).",
|
|
7307
|
+
description: "With --report: **every test a scenario or fitness function names is in the report of its file** (a renamed or deleted test is not).",
|
|
7262
7308
|
severity: "error",
|
|
7263
7309
|
dimension: "tests",
|
|
7264
7310
|
readsReports: true,
|
|
@@ -7266,7 +7312,7 @@ var CHECK_RULES = [
|
|
|
7266
7312
|
},
|
|
7267
7313
|
{
|
|
7268
7314
|
id: "test-skipped",
|
|
7269
|
-
description: "With --report: no test a scenario or fitness function names was skipped
|
|
7315
|
+
description: "With --report: **no test a scenario or fitness function names was skipped**.",
|
|
7270
7316
|
severity: "warning",
|
|
7271
7317
|
dimension: "tests",
|
|
7272
7318
|
readsReports: true,
|
|
@@ -7274,15 +7320,15 @@ var CHECK_RULES = [
|
|
|
7274
7320
|
},
|
|
7275
7321
|
{
|
|
7276
7322
|
id: "test-not-run",
|
|
7277
|
-
description: "With --report: every file a scenario or fitness function names a test in is in the reports
|
|
7323
|
+
description: "With --report: **every file a scenario or fitness function names a test in is in the reports**.",
|
|
7278
7324
|
severity: "warning",
|
|
7279
7325
|
dimension: "tests",
|
|
7280
7326
|
readsReports: true,
|
|
7281
|
-
run: testRule("not-run", (node, id) => `${testedName(node)}: no report has
|
|
7327
|
+
run: testRule("not-run", (node, id) => `${testedName(node)}: test ${id} did not run: no report has its file.`)
|
|
7282
7328
|
},
|
|
7283
7329
|
{
|
|
7284
7330
|
id: "metric-failed",
|
|
7285
|
-
description: "With measurements: every metric condition a scenario or fitness function states holds for the latest measurement it matches.",
|
|
7331
|
+
description: "With measurements: **every metric condition a scenario or fitness function states holds** for the latest measurement it matches.",
|
|
7286
7332
|
severity: "error",
|
|
7287
7333
|
dimension: "tests",
|
|
7288
7334
|
readsMeasurements: true,
|
|
@@ -7290,7 +7336,7 @@ var CHECK_RULES = [
|
|
|
7290
7336
|
},
|
|
7291
7337
|
{
|
|
7292
7338
|
id: "metric-stale",
|
|
7293
|
-
description: "With measurements: the latest measurement each metric condition matches is no older than the element's max_age (a stale one never passes).",
|
|
7339
|
+
description: "With measurements: **the latest measurement each metric condition matches is no older than the element's max_age** (a stale one never passes).",
|
|
7294
7340
|
severity: "warning",
|
|
7295
7341
|
dimension: "tests",
|
|
7296
7342
|
readsMeasurements: true,
|
|
@@ -7298,7 +7344,7 @@ var CHECK_RULES = [
|
|
|
7298
7344
|
},
|
|
7299
7345
|
{
|
|
7300
7346
|
id: "metric-not-measured",
|
|
7301
|
-
description: "With measurements: a measurement matches every metric condition a scenario or fitness function states
|
|
7347
|
+
description: "With measurements: **a measurement matches every metric condition a scenario or fitness function states**.",
|
|
7302
7348
|
severity: "warning",
|
|
7303
7349
|
dimension: "tests",
|
|
7304
7350
|
readsMeasurements: true,
|
|
@@ -7306,7 +7352,7 @@ var CHECK_RULES = [
|
|
|
7306
7352
|
},
|
|
7307
7353
|
{
|
|
7308
7354
|
id: "test-unbound",
|
|
7309
|
-
description: "With --report and an include in check.json: every test in the files it includes is named by a scenario or a fitness function
|
|
7355
|
+
description: "With --report and an include in check.json: **every test in the files it includes is named by a scenario or a fitness function**, by its title or its describe block (a whole file or directory does not count). One finding per test file.",
|
|
7310
7356
|
severity: "warning",
|
|
7311
7357
|
dimension: "tests",
|
|
7312
7358
|
readsReports: true,
|
|
@@ -7346,7 +7392,7 @@ function testBinding(model) {
|
|
|
7346
7392
|
init_define_RADICAL_BUILD();
|
|
7347
7393
|
var ADOPT_RULE = {
|
|
7348
7394
|
id: "baselines-pending",
|
|
7349
|
-
description: 'check.json does not wait for the baselines of its first run ("adopt": true); radical check --adopt takes them once.',
|
|
7395
|
+
description: '**check.json does not wait for the baselines of its first run** ("adopt": true); radical check --adopt takes them once.',
|
|
7350
7396
|
severity: "error",
|
|
7351
7397
|
dimension: "consistency"
|
|
7352
7398
|
};
|
|
@@ -7399,7 +7445,7 @@ function adoptBaselines(config, result) {
|
|
|
7399
7445
|
init_define_RADICAL_BUILD();
|
|
7400
7446
|
var GOAL_RULE = {
|
|
7401
7447
|
id: "goal-unmet",
|
|
7402
|
-
description: 'Every metric check.json sets a goal for ("goals": { "<metric>": { "min": <percent> } }) reaches it
|
|
7448
|
+
description: '**Every metric check.json sets a goal for** ("goals": { "<metric>": { "min": <percent> } }) **reaches it**. One finding per goal, with the metric as its code.',
|
|
7403
7449
|
severity: "error"
|
|
7404
7450
|
};
|
|
7405
7451
|
var without = (rule) => (population) => (ctx) => {
|
|
@@ -7428,6 +7474,21 @@ var CHECK_METRICS = [
|
|
|
7428
7474
|
byRule("elements-valid", "Elements the metamodel allows", "Elements no metamodel issue points at.", "consistency", "metamodel", (m) => Object.values(m.nodes)),
|
|
7429
7475
|
byRule("requirements-complete", "Complete requirements", "Requirements with an action and every field their EARS type reads.", "completeness", "requirement-incomplete", (m) => nodesOf(m, "requirement")),
|
|
7430
7476
|
byRule("adrs-complete", "Complete accepted ADRs", "Accepted ADRs with a date, context, decision and consequences.", "completeness", "adr-incomplete", acceptedAdrs),
|
|
7477
|
+
{
|
|
7478
|
+
// The rules of unreadable checks had no metric, so Completeness read 100%
|
|
7479
|
+
// beside findings to fix (the user, 2026-11-29: "the numbers don't add up").
|
|
7480
|
+
id: "checks-readable",
|
|
7481
|
+
label: "Checks that can be read",
|
|
7482
|
+
dimension: "completeness",
|
|
7483
|
+
rule: "metric-invalid",
|
|
7484
|
+
description: "Fitness functions and scenarios whose Metrics and Measure lines the check can read.",
|
|
7485
|
+
measure: (ctx) => {
|
|
7486
|
+
const nodes = [...nodesOf(ctx.model, "fitness-fn"), ...nodesOf(ctx.model, "scenario")];
|
|
7487
|
+
if (!nodes.length) return null;
|
|
7488
|
+
const unreadable = new Set(ctx.found.filter((f) => (f.rule === "metric-invalid" || f.rule === "fitness-fn-measure-invalid") && f.nodeId).map((f) => f.nodeId));
|
|
7489
|
+
return { count: nodes.filter((n) => !unreadable.has(n.id)).length, total: nodes.length };
|
|
7490
|
+
}
|
|
7491
|
+
},
|
|
7431
7492
|
byRule("needs-with-requirement", "Needs with a requirement", "Needs at least one requirement derives from, directly or through a need inside them.", "traceability", "need-without-requirement", (m) => nodesOf(m, "need")),
|
|
7432
7493
|
byRule("requirements-with-origin", "Requirements with an origin", "Requirements that derive from a need or another requirement.", "traceability", "requirement-without-origin", (m) => nodesOf(m, "requirement")),
|
|
7433
7494
|
byRule("requirements-quoting-need", "Requirements that quote their need", "Requirements derived from a need whose Derives from relation quotes the words they rest on; measured once a relation of the model quotes.", "traceability", "derives-quote-missing", (m) => {
|
|
@@ -7439,10 +7500,10 @@ var CHECK_METRICS = [
|
|
|
7439
7500
|
byRule("requirements-satisfied", "Requirements satisfied", "Requirements an element of the architecture satisfies.", "traceability", "requirement-unsatisfied", (m) => nodesOf(m, "requirement")),
|
|
7440
7501
|
byRule("requirements-with-scenario", "Requirements with a scenario", "Requirements at least one scenario verifies.", "traceability", "requirement-without-scenario", (m) => hasType(m, "scenario") ? nodesOf(m, "requirement") : null),
|
|
7441
7502
|
byRule("scenarios-verifying", "Scenarios that verify something", "Scenarios that verify a requirement or a state machine.", "traceability", "scenario-verifies-nothing", (m) => nodesOf(m, "scenario")),
|
|
7442
|
-
byRule("scenarios-with-metrics", "Scenarios that name a check", "Scenarios
|
|
7503
|
+
byRule("scenarios-with-metrics", "Scenarios that name a check", "Scenarios with a check: tests the repository binds to them, or metric conditions measured on the running system.", "behaviour", "scenario-without-metrics", (m) => nodesOf(m, "scenario")),
|
|
7443
7504
|
byRule("adrs-with-fitness-fn", "Accepted ADRs with a fitness function", "Accepted ADRs a fitness function implements.", "decisions", "adr-without-fitness-fn", (m) => hasType(m, "fitness-fn") ? acceptedAdrs(m) : null),
|
|
7444
7505
|
byRule("fitness-fns-linked", "Fitness functions linked", "Fitness functions that implement an ADR or constrain an element.", "decisions", "fitness-fn-unlinked", (m) => nodesOf(m, "fitness-fn")),
|
|
7445
|
-
byRule("fitness-fns-with-metrics", "Fitness functions that name a check", "Fitness functions
|
|
7506
|
+
byRule("fitness-fns-with-metrics", "Fitness functions that name a check", "Fitness functions with a check: tests the repository binds to them, or metric conditions measured on the running system.", "fitness", "fitness-fn-without-metrics", (m) => nodesOf(m, "fitness-fn")),
|
|
7446
7507
|
{
|
|
7447
7508
|
id: "requirements-verified",
|
|
7448
7509
|
label: "Requirements verified",
|
|
@@ -7543,10 +7604,41 @@ init_define_RADICAL_BUILD();
|
|
|
7543
7604
|
var CHECK_CONFIG_FILE = "check.json";
|
|
7544
7605
|
var TEST_RESULTS_FILE = `${STATE_DIR}/test-results.json`;
|
|
7545
7606
|
var MEASUREMENTS_FILE = `${STATE_DIR}/measurements.json`;
|
|
7607
|
+
var CI_FETCH_FILE = `${STATE_DIR}/ci-fetch.json`;
|
|
7546
7608
|
function serializeTestResults(cases, reports, readAt = /* @__PURE__ */ new Date(), from = {}) {
|
|
7547
|
-
const results = {
|
|
7609
|
+
const results = {
|
|
7610
|
+
version: 1,
|
|
7611
|
+
readAt: readAt.toISOString(),
|
|
7612
|
+
reports,
|
|
7613
|
+
cases,
|
|
7614
|
+
...from.commit ? { commit: from.commit } : {},
|
|
7615
|
+
...from.ci ? { ci: from.ci } : {},
|
|
7616
|
+
...from.kept ? { kept: from.kept } : {}
|
|
7617
|
+
};
|
|
7548
7618
|
return JSON.stringify(results);
|
|
7549
7619
|
}
|
|
7620
|
+
var sameTestFile = (a2, b) => a2 === b || a2.endsWith("/" + b) || b.endsWith("/" + a2);
|
|
7621
|
+
function withEarlierResults(cases, earlier) {
|
|
7622
|
+
if (!earlier?.cases.length) return { cases };
|
|
7623
|
+
const slash = (file) => file.replace(/\\/g, "/");
|
|
7624
|
+
const ran = [...new Set(cases.map((c) => slash(c.file)))];
|
|
7625
|
+
const ranSet = new Set(ran);
|
|
7626
|
+
const replaced = /* @__PURE__ */ new Map();
|
|
7627
|
+
const isReplaced = (file) => {
|
|
7628
|
+
let r = replaced.get(file);
|
|
7629
|
+
if (r === void 0) {
|
|
7630
|
+
r = ranSet.has(file) || ran.some((f) => sameTestFile(f, file));
|
|
7631
|
+
replaced.set(file, r);
|
|
7632
|
+
}
|
|
7633
|
+
return r;
|
|
7634
|
+
};
|
|
7635
|
+
const left = earlier.cases.filter((c) => !isReplaced(slash(c.file)));
|
|
7636
|
+
if (!left.length) return { cases };
|
|
7637
|
+
return {
|
|
7638
|
+
cases: [...cases, ...left],
|
|
7639
|
+
kept: { since: earlier.kept?.since ?? testsRanAt(earlier), cases: left.length, files: new Set(left.map((c) => slash(c.file))).size }
|
|
7640
|
+
};
|
|
7641
|
+
}
|
|
7550
7642
|
function testsRanAt(results) {
|
|
7551
7643
|
const runs = results.ci?.runs.map((r) => r.ranAt).filter((at) => !Number.isNaN(Date.parse(at))).sort() ?? [];
|
|
7552
7644
|
return runs.length ? runs[runs.length - 1] : results.readAt;
|
|
@@ -7555,7 +7647,7 @@ function ciSourceOf(value) {
|
|
|
7555
7647
|
const ci = value;
|
|
7556
7648
|
if (!ci || ci.provider !== "github" || typeof ci.commit !== "string" || typeof ci.behind !== "number" || !Array.isArray(ci.runs)) return void 0;
|
|
7557
7649
|
const runs = ci.runs.filter((r) => !!r && typeof r.id === "number" && typeof r.url === "string" && typeof r.sha === "string" && typeof r.ranAt === "string" && typeof r.workflow === "string" && Array.isArray(r.artifacts));
|
|
7558
|
-
return { provider: "github", commit: ci.commit, behind: ci.behind, runs };
|
|
7650
|
+
return { provider: "github", commit: ci.commit, behind: ci.behind, runs, ...typeof ci.measurements === "number" ? { measurements: ci.measurements } : {} };
|
|
7559
7651
|
}
|
|
7560
7652
|
var STATUSES = /* @__PURE__ */ new Set(["passed", "failed", "skipped"]);
|
|
7561
7653
|
function parseTestResults(text3) {
|
|
@@ -7569,13 +7661,16 @@ function parseTestResults(text3) {
|
|
|
7569
7661
|
if (r?.version !== 1 || typeof r.readAt !== "string" || !Array.isArray(r.cases)) return null;
|
|
7570
7662
|
const cases = r.cases.filter((c) => !!c && typeof c.file === "string" && Array.isArray(c.title) && c.title.every((t) => typeof t === "string") && STATUSES.has(c.status));
|
|
7571
7663
|
const ci = ciSourceOf(r.ci);
|
|
7664
|
+
const k = r.kept;
|
|
7665
|
+
const kept2 = k && typeof k.since === "string" && typeof k.cases === "number" && typeof k.files === "number" ? { since: k.since, cases: k.cases, files: k.files } : void 0;
|
|
7572
7666
|
return {
|
|
7573
7667
|
version: 1,
|
|
7574
7668
|
readAt: r.readAt,
|
|
7575
7669
|
reports: Array.isArray(r.reports) ? r.reports.filter((x) => typeof x === "string") : [],
|
|
7576
7670
|
cases,
|
|
7577
7671
|
...typeof r.commit === "string" ? { commit: r.commit } : {},
|
|
7578
|
-
...ci ? { ci } : {}
|
|
7672
|
+
...ci ? { ci } : {},
|
|
7673
|
+
...kept2 ? { kept: kept2 } : {}
|
|
7579
7674
|
};
|
|
7580
7675
|
}
|
|
7581
7676
|
function parseCheckConfig(text3) {
|
|
@@ -7601,6 +7696,37 @@ function parseCheckConfig(text3) {
|
|
|
7601
7696
|
}
|
|
7602
7697
|
return data;
|
|
7603
7698
|
}
|
|
7699
|
+
var CI_ARTIFACTS_HINT = `CI has to keep its test reports (and its radical sense --out files) as artifacts of the run, named in .radical/radical.json's "ci": { "artifacts": [...] }`;
|
|
7700
|
+
var serializeCiFetch = (fetch2) => JSON.stringify({ version: 1, ...fetch2 }, null, 2) + "\n";
|
|
7701
|
+
var OUTCOMES = /* @__PURE__ */ new Set(["read", "same", "kept", "failed"]);
|
|
7702
|
+
function parseCiFetch(text3) {
|
|
7703
|
+
let data;
|
|
7704
|
+
try {
|
|
7705
|
+
data = JSON.parse(text3);
|
|
7706
|
+
} catch {
|
|
7707
|
+
return null;
|
|
7708
|
+
}
|
|
7709
|
+
const f = data;
|
|
7710
|
+
if (f?.version !== 1 || typeof f.at !== "string" || Number.isNaN(Date.parse(f.at)) || !OUTCOMES.has(f.outcome) || typeof f.message !== "string") return null;
|
|
7711
|
+
const runs = Array.isArray(f.runs) ? f.runs.filter((r) => !!r && typeof r.id === "number" && typeof r.url === "string").map((r) => ({ id: r.id, url: r.url })) : void 0;
|
|
7712
|
+
return {
|
|
7713
|
+
version: 1,
|
|
7714
|
+
at: f.at,
|
|
7715
|
+
outcome: f.outcome,
|
|
7716
|
+
message: f.message,
|
|
7717
|
+
...typeof f.head === "string" ? { head: f.head } : {},
|
|
7718
|
+
...typeof f.commit === "string" ? { commit: f.commit } : {},
|
|
7719
|
+
...runs?.length ? { runs } : {},
|
|
7720
|
+
...typeof f.tests === "number" ? { tests: f.tests } : {},
|
|
7721
|
+
...typeof f.measurements === "number" ? { measurements: f.measurements } : {}
|
|
7722
|
+
};
|
|
7723
|
+
}
|
|
7724
|
+
function ciFetchProblem(fetch2) {
|
|
7725
|
+
if (!fetch2) return null;
|
|
7726
|
+
if (fetch2.outcome === "failed") return fetch2.message;
|
|
7727
|
+
if (fetch2.outcome === "read" && fetch2.tests === 0) return fetch2.message;
|
|
7728
|
+
return null;
|
|
7729
|
+
}
|
|
7604
7730
|
|
|
7605
7731
|
// ../../packages/common/src/check/testSource.ts
|
|
7606
7732
|
init_define_RADICAL_BUILD();
|
|
@@ -7867,17 +7993,21 @@ function evidenceSummary(result) {
|
|
|
7867
7993
|
return lines;
|
|
7868
7994
|
}
|
|
7869
7995
|
|
|
7996
|
+
// ../../packages/common/src/check/findingWords.ts
|
|
7997
|
+
init_define_RADICAL_BUILD();
|
|
7998
|
+
var plainRuleText = (description) => description.replace(/\*\*/g, "");
|
|
7999
|
+
|
|
7870
8000
|
// ../../packages/common/src/check/configChanges.ts
|
|
7871
8001
|
init_define_RADICAL_BUILD();
|
|
7872
8002
|
|
|
7873
8003
|
// ../../packages/common/src/check/index.ts
|
|
7874
8004
|
var FOLDER_RULES = [
|
|
7875
|
-
{ id: "folder-manifest", description: "The folder has a radical.md manifest of the Markdown-folder format, version 1.", severity: "error", dimension: "consistency" },
|
|
7876
|
-
{ id: "folder-json", description: "Every JSON sidecar (relations.json, views.json, \u2026) parses
|
|
7877
|
-
{ id: "folder-conflict", description: "No node file holds git conflict markers
|
|
7878
|
-
{ id: "folder-not-a-node", description: "A node file with frontmatter has an id and a type (one without them is skipped on loading, and its element is gone).", severity: "error", dimension: "consistency" },
|
|
7879
|
-
{ id: "folder-duplicate-id", description: "No two node files hold the same id
|
|
7880
|
-
{ id: "stale-reference", description: "Views, sequences and slides point only at elements, relations and views the model has
|
|
8005
|
+
{ id: "folder-manifest", description: "**The folder has a radical.md manifest** of the Markdown-folder format, version 1.", severity: "error", dimension: "consistency" },
|
|
8006
|
+
{ id: "folder-json", description: "**Every JSON sidecar** (relations.json, views.json, \u2026) **parses**.", severity: "error", dimension: "consistency" },
|
|
8007
|
+
{ id: "folder-conflict", description: "**No node file holds git conflict markers**.", severity: "error", dimension: "consistency" },
|
|
8008
|
+
{ id: "folder-not-a-node", description: "**A node file with frontmatter has an id and a type** (one without them is skipped on loading, and its element is gone).", severity: "error", dimension: "consistency" },
|
|
8009
|
+
{ id: "folder-duplicate-id", description: "**No two node files hold the same id**.", severity: "error", dimension: "consistency" },
|
|
8010
|
+
{ id: "stale-reference", description: "**Views, sequences and slides point only at elements, relations and views the model has**.", severity: "warning", dimension: "consistency" }
|
|
7881
8011
|
];
|
|
7882
8012
|
var FATAL = /* @__PURE__ */ new Set(["folder-manifest", "folder-json", "folder-conflict"]);
|
|
7883
8013
|
var STALE_REFERENCE = "stale-reference";
|
|
@@ -13271,7 +13401,7 @@ After review, repeat this command with --apply --expect ${preview.token}`);
|
|
|
13271
13401
|
// src/check.ts
|
|
13272
13402
|
init_define_RADICAL_BUILD();
|
|
13273
13403
|
import { existsSync as existsSync2 } from "fs";
|
|
13274
|
-
import { mkdir as mkdir5, readFile as readFile10, readdir as readdir4, realpath as realpath4, stat as stat7, writeFile as writeFile5 } from "fs/promises";
|
|
13404
|
+
import { mkdir as mkdir5, readFile as readFile10, readdir as readdir4, realpath as realpath4, rename as rename4, stat as stat7, writeFile as writeFile5 } from "fs/promises";
|
|
13275
13405
|
import { basename as basename3, dirname as dirname8, join as join13, relative as relative5, resolve as resolve10 } from "path";
|
|
13276
13406
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
13277
13407
|
import { parseArgs as parseArgs4 } from "util";
|
|
@@ -13405,14 +13535,21 @@ async function downloadCiReports(root, gh, source) {
|
|
|
13405
13535
|
try {
|
|
13406
13536
|
const cases = [];
|
|
13407
13537
|
const reports = [];
|
|
13538
|
+
const measurements = [];
|
|
13408
13539
|
for (const run3 of source.runs) {
|
|
13409
13540
|
for (const artifact of run3.artifacts) {
|
|
13410
13541
|
const into = join9(dir, String(run3.id), artifact);
|
|
13411
13542
|
await gh(["run", "download", String(run3.id), "--name", artifact, "--dir", into], root);
|
|
13412
13543
|
for (const file of await filesUnder(into)) {
|
|
13544
|
+
const text3 = await readFile6(file, "utf8");
|
|
13545
|
+
const measured = metricsIn(text3, file);
|
|
13546
|
+
if (measured) {
|
|
13547
|
+
measurements.push(...measured.map((m) => ({ ...m, context: { ...m.context, "ci.run": String(run3.id), "ci.commit": source.commit } })));
|
|
13548
|
+
continue;
|
|
13549
|
+
}
|
|
13413
13550
|
let read2;
|
|
13414
13551
|
try {
|
|
13415
|
-
read2 = parseTestReport(
|
|
13552
|
+
read2 = parseTestReport(text3, file);
|
|
13416
13553
|
} catch {
|
|
13417
13554
|
continue;
|
|
13418
13555
|
}
|
|
@@ -13422,15 +13559,24 @@ async function downloadCiReports(root, gh, source) {
|
|
|
13422
13559
|
}
|
|
13423
13560
|
}
|
|
13424
13561
|
}
|
|
13425
|
-
if (!reports.length) throw new CiError(`the artifacts of run${source.runs.length > 1 ? "s" : ""} ${source.runs.map((r) => r.id).join(", ")} hold no test report`);
|
|
13426
|
-
return { cases, reports };
|
|
13562
|
+
if (!reports.length && !measurements.length) throw new CiError(`the artifacts of run${source.runs.length > 1 ? "s" : ""} ${source.runs.map((r) => r.id).join(", ")} hold no test report and no radical-metrics/1 file`);
|
|
13563
|
+
return { cases, reports, measurements };
|
|
13427
13564
|
} finally {
|
|
13428
13565
|
await rm4(dir, { recursive: true, force: true });
|
|
13429
13566
|
}
|
|
13430
13567
|
}
|
|
13568
|
+
function metricsIn(text3, file) {
|
|
13569
|
+
if (!text3.includes(METRICS_FORMAT)) return null;
|
|
13570
|
+
try {
|
|
13571
|
+
const data = JSON.parse(text3);
|
|
13572
|
+
return data?.format === METRICS_FORMAT ? parseMetricsFile(text3, file) : null;
|
|
13573
|
+
} catch {
|
|
13574
|
+
return null;
|
|
13575
|
+
}
|
|
13576
|
+
}
|
|
13431
13577
|
function sameRuns(results, source) {
|
|
13432
13578
|
const key = (s2) => s2.runs.map((r) => `${r.id}:${r.artifacts.join(",")}`).join(" ");
|
|
13433
|
-
return !!results?.ci && key(results.ci) === key(source);
|
|
13579
|
+
return !!results?.ci && results.ci.measurements !== void 0 && key(results.ci) === key(source);
|
|
13434
13580
|
}
|
|
13435
13581
|
async function readLater(root, results, commit) {
|
|
13436
13582
|
return !!results && !results.ci && !!results.commit && isAncestor(root, commit, results.commit);
|
|
@@ -14175,8 +14321,19 @@ its own ("model": { "repo": \u2026 }), it judges that repository's part of the m
|
|
|
14175
14321
|
the run. They are kept for Studio as --report keeps
|
|
14176
14322
|
them, with the commit and runs they come from, unless
|
|
14177
14323
|
the results there were read with --report at that
|
|
14178
|
-
commit or a later one. radical
|
|
14324
|
+
commit or a later one. The radical-metrics/1 files in
|
|
14325
|
+
the artifacts (radical sense --out) are added to the
|
|
14326
|
+
measurements, as --metrics adds them. What it found,
|
|
14327
|
+
or why it found nothing, is kept in the folder's
|
|
14328
|
+
.state/ci-fetch.json, with --quiet too, for Studio and
|
|
14329
|
+
radical setup --status. CI has to keep the reports as
|
|
14330
|
+
artifacts of the run. radical hooks install fetches
|
|
14179
14331
|
them after a checkout, a commit, a pull and a rebase
|
|
14332
|
+
--no-keep read the reports and measurements given and judge with
|
|
14333
|
+
them, but keep nothing beside the model: what Studio
|
|
14334
|
+
shows stays as it was (a check used as a gate, a test
|
|
14335
|
+
of the gate). --evidence, --ratchet and --adopt still
|
|
14336
|
+
write the file they name
|
|
14180
14337
|
--quiet print nothing (the git hooks fetch with --from-ci --quiet)
|
|
14181
14338
|
--detach start this check in the background and return at once
|
|
14182
14339
|
(the git hooks, which git waits for)
|
|
@@ -14247,6 +14404,7 @@ async function checkCommand(args, io2) {
|
|
|
14247
14404
|
format: { type: "string", default: "text" },
|
|
14248
14405
|
report: { type: "string", multiple: true },
|
|
14249
14406
|
"from-ci": { type: "boolean", default: false },
|
|
14407
|
+
"no-keep": { type: "boolean", default: false },
|
|
14250
14408
|
quiet: { type: "boolean", default: false },
|
|
14251
14409
|
detach: { type: "boolean", default: false },
|
|
14252
14410
|
metrics: { type: "string", multiple: true },
|
|
@@ -14274,12 +14432,13 @@ ${CHECK_USAGE}`);
|
|
|
14274
14432
|
return 0;
|
|
14275
14433
|
}
|
|
14276
14434
|
if (values["list-rules"]) {
|
|
14277
|
-
for (const rule of [...FOLDER_RULES, ...CHECK_RULES, GOAL_RULE]) io2.out(`${rule.id.padEnd(30)} ${(rule.off ? "off" : rule.severity).padEnd(8)} ${rule.description}`);
|
|
14435
|
+
for (const rule of [...FOLDER_RULES, ...CHECK_RULES, GOAL_RULE]) io2.out(`${rule.id.padEnd(30)} ${(rule.off ? "off" : rule.severity).padEnd(8)} ${plainRuleText(rule.description)}`);
|
|
14278
14436
|
io2.out("\nMetrics for goals (in percent):");
|
|
14279
14437
|
for (const metric of CHECK_METRICS) io2.out(`${metric.id.padEnd(30)} ${(metric.tests ? "evidence" : "").padEnd(8)} ${metric.description}`);
|
|
14280
14438
|
return 0;
|
|
14281
14439
|
}
|
|
14282
14440
|
const fromCi = values["from-ci"];
|
|
14441
|
+
const keepBeside = !values["no-keep"];
|
|
14283
14442
|
if (positionals.length > 1 || !["text", "json", "github"].includes(values.format) || fromCi && values.report?.length || values.evidence && !values.report?.length && !fromCi && !values.metrics?.length || values.trace !== void 0 && (!values.trace.trim() || values.format === "github" || values.ratchet || values.adopt)) {
|
|
14284
14443
|
io2.err(CHECK_USAGE);
|
|
14285
14444
|
return 2;
|
|
@@ -14348,23 +14507,32 @@ ${CHECK_USAGE}`);
|
|
|
14348
14507
|
let tests;
|
|
14349
14508
|
let testsReadAt;
|
|
14350
14509
|
let keep;
|
|
14510
|
+
let keptCases;
|
|
14511
|
+
let ciMeasurements = [];
|
|
14351
14512
|
if (fromCi) {
|
|
14352
14513
|
const say = (text3) => {
|
|
14353
14514
|
if (!values.quiet) io2.err(text3);
|
|
14354
14515
|
};
|
|
14355
|
-
const resultsPath = join13(root, TEST_RESULTS_FILE);
|
|
14356
14516
|
const existing = parseTestResults(await readEditorStateFile(root, TEST_RESULTS_FILE) ?? "");
|
|
14357
14517
|
const gh = io2.gh ?? ghCli(io2.env ?? process.env);
|
|
14518
|
+
const head = await headOf(root) ?? void 0;
|
|
14519
|
+
const record3 = async (fetch2) => {
|
|
14520
|
+
if (keepBeside) await writeBeside(join13(root, CI_FETCH_FILE), serializeCiFetch({ at: (/* @__PURE__ */ new Date()).toISOString(), ...head ? { head } : {}, ...fetch2 }));
|
|
14521
|
+
};
|
|
14358
14522
|
let got;
|
|
14359
14523
|
try {
|
|
14360
14524
|
got = await withFetchLock(root, async () => {
|
|
14361
14525
|
const source2 = await findCiRuns(root, gh, repository?.ci?.artifacts ?? config.ci?.artifacts);
|
|
14362
14526
|
if (await readLater(root, existing, source2.commit)) return { source: source2, kept: existing };
|
|
14363
|
-
if (sameRuns(existing, source2)) return { source: source2, cases: existing.cases, reports: existing.reports };
|
|
14364
|
-
|
|
14527
|
+
if (sameRuns(existing, source2)) return { source: { ...source2, measurements: existing.ci.measurements }, same: true, cases: existing.cases, reports: existing.reports, measurements: [] };
|
|
14528
|
+
const read3 = await downloadCiReports(root, gh, source2);
|
|
14529
|
+
return { source: { ...source2, measurements: read3.measurements.length }, ...read3 };
|
|
14365
14530
|
});
|
|
14366
14531
|
} catch (error) {
|
|
14367
|
-
|
|
14532
|
+
const message = error instanceof CiError ? error.message : error.message;
|
|
14533
|
+
await record3({ outcome: "failed", message: `radical check --from-ci: ${message}` }).catch(() => {
|
|
14534
|
+
});
|
|
14535
|
+
say(`radical check --from-ci: ${message}`);
|
|
14368
14536
|
return 2;
|
|
14369
14537
|
}
|
|
14370
14538
|
if (!got) {
|
|
@@ -14373,15 +14541,29 @@ ${CHECK_USAGE}`);
|
|
|
14373
14541
|
}
|
|
14374
14542
|
const { source } = got;
|
|
14375
14543
|
const runs = `run${source.runs.length > 1 ? "s" : ""} ${source.runs.map((r) => r.id).join(", ")}${source.runs[0]?.pr ? ` (pull request #${source.runs[0].pr})` : ""}`;
|
|
14544
|
+
const from = { commit: source.commit, runs: source.runs.map((r) => ({ id: r.id, url: r.url })) };
|
|
14545
|
+
const behind = source.behind ? `, ${source.behind} commit${source.behind > 1 ? "s" : ""} before HEAD` : "";
|
|
14376
14546
|
if (got.kept) {
|
|
14377
14547
|
tests = got.kept.cases;
|
|
14378
14548
|
testsReadAt = got.kept.readAt;
|
|
14379
|
-
|
|
14549
|
+
const message = `Kept the test results read with --report at ${got.kept.commit.slice(0, 7)}: CI's (${runs}) are of ${source.commit.slice(0, 7)}, before it.`;
|
|
14550
|
+
await record3({ outcome: "kept", message, ...from });
|
|
14551
|
+
say(message);
|
|
14380
14552
|
} else {
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
|
|
14553
|
+
ciMeasurements = got.measurements;
|
|
14554
|
+
const measured = ciMeasurements.length ? `; ${ciMeasurements.length} measurement${ciMeasurements.length === 1 ? "" : "s"}` : "";
|
|
14555
|
+
if (got.cases.length) {
|
|
14556
|
+
tests = got.cases;
|
|
14557
|
+
testsReadAt = testsRanAt({ version: 1, readAt: (/* @__PURE__ */ new Date()).toISOString(), reports: [], cases: [], ci: source });
|
|
14558
|
+
keep = { reports: got.reports, ci: source, commit: head };
|
|
14559
|
+
const message = `${got.same ? "The same test results of CI" : "Test results of CI"} ${runs} for ${source.commit.slice(0, 7)}${behind}${measured}.`;
|
|
14560
|
+
await record3({ outcome: got.same ? "same" : "read", message, ...from, tests: tests.length, ...got.same ? {} : { measurements: ciMeasurements.length } });
|
|
14561
|
+
say(message);
|
|
14562
|
+
} else {
|
|
14563
|
+
const message = `The artifacts of CI ${runs} for ${source.commit.slice(0, 7)}${behind} hold no test report${measured}.`;
|
|
14564
|
+
await record3({ outcome: "read", message, ...from, tests: 0, measurements: ciMeasurements.length });
|
|
14565
|
+
say(message);
|
|
14566
|
+
}
|
|
14385
14567
|
}
|
|
14386
14568
|
} else if (values.report?.length) {
|
|
14387
14569
|
tests = [];
|
|
@@ -14402,6 +14584,12 @@ ${CHECK_USAGE}`);
|
|
|
14402
14584
|
return 2;
|
|
14403
14585
|
}
|
|
14404
14586
|
}
|
|
14587
|
+
const merged = withEarlierResults(tests, parseTestResults(await readEditorStateFile(root, TEST_RESULTS_FILE) ?? ""));
|
|
14588
|
+
if (merged.kept) {
|
|
14589
|
+
tests = merged.cases;
|
|
14590
|
+
keptCases = merged.kept;
|
|
14591
|
+
if (!values.quiet) io2.err(`Kept the results of ${merged.kept.cases} test${merged.kept.cases === 1 ? "" : "s"} in ${merged.kept.files} file${merged.kept.files === 1 ? "" : "s"} the reports here do not have, read since ${merged.kept.since.slice(0, 10)}.`);
|
|
14592
|
+
}
|
|
14405
14593
|
}
|
|
14406
14594
|
let fromKept = false;
|
|
14407
14595
|
if (values.trace && !tests) {
|
|
@@ -14415,16 +14603,18 @@ ${CHECK_USAGE}`);
|
|
|
14415
14603
|
const kept2 = await readEditorStateFile(root, MEASUREMENTS_FILE);
|
|
14416
14604
|
const stored = kept2 === null ? null : parseMeasurementStore(kept2);
|
|
14417
14605
|
let measurements = stored ?? void 0;
|
|
14606
|
+
const read2 = [...ciMeasurements];
|
|
14418
14607
|
if (values.metrics?.length) {
|
|
14419
|
-
const read2 = [];
|
|
14420
14608
|
try {
|
|
14421
14609
|
for (const file of await reportFiles(values.metrics, io2.cwd, /\.json$/i, "measurement")) read2.push(...parseMetricsFile(await readFile10(resolve10(io2.cwd, file), "utf8"), file));
|
|
14422
14610
|
} catch (error) {
|
|
14423
14611
|
io2.err(error.code === "ENOENT" ? `Cannot read the measurements ${error.path}: no such file.` : error.message);
|
|
14424
14612
|
return 2;
|
|
14425
14613
|
}
|
|
14614
|
+
}
|
|
14615
|
+
if (read2.length) {
|
|
14426
14616
|
measurements = mergeMeasurements(stored ?? [], read2);
|
|
14427
|
-
await writeBeside(join13(root, MEASUREMENTS_FILE), serializeMeasurementStore(measurements));
|
|
14617
|
+
if (keepBeside) await writeBeside(join13(root, MEASUREMENTS_FILE), serializeMeasurementStore(measurements));
|
|
14428
14618
|
}
|
|
14429
14619
|
for (const [where2, path] of [[REVIEWS_FILE, join13(await mappingRoot(root), REVIEWS_FILE)], [REVIEWS_FILE2, join13(root, REVIEWS_FILE2)]]) {
|
|
14430
14620
|
const reviewsText = await readFile10(path, "utf8").catch(() => null);
|
|
@@ -14486,12 +14676,12 @@ ${CHECK_USAGE}`);
|
|
|
14486
14676
|
if (adopted.notRun.length) io2.err(`Not run, so no baseline taken (give the test reports with --report, the measurements with --metrics): ${adopted.notRun.join(", ")}.`);
|
|
14487
14677
|
}
|
|
14488
14678
|
}
|
|
14489
|
-
if (tests && !fromKept && (keep || !fromCi)) {
|
|
14679
|
+
if (tests && keepBeside && !fromKept && (keep || !fromCi)) {
|
|
14490
14680
|
await writeBeside(join13(root, TEST_RESULTS_FILE), serializeTestResults(
|
|
14491
14681
|
tests,
|
|
14492
14682
|
keep?.reports ?? values.report ?? [],
|
|
14493
14683
|
/* @__PURE__ */ new Date(),
|
|
14494
|
-
keep ?? { commit: await headOf(root) ?? void 0 }
|
|
14684
|
+
keep ?? { commit: await headOf(root) ?? void 0, ...keptCases ? { kept: keptCases } : {} }
|
|
14495
14685
|
));
|
|
14496
14686
|
}
|
|
14497
14687
|
if (values.evidence && result.evidence) await writeBeside(resolve10(io2.cwd, values.evidence), JSON.stringify(result.evidence, null, 2) + "\n");
|
|
@@ -14547,7 +14737,9 @@ async function writeBeside(path, content) {
|
|
|
14547
14737
|
if (error.code !== "EEXIST") throw error;
|
|
14548
14738
|
});
|
|
14549
14739
|
}
|
|
14550
|
-
|
|
14740
|
+
const partial = join13(dir, `.${basename3(path)}.${process.pid}.tmp`);
|
|
14741
|
+
await writeFile5(partial, content);
|
|
14742
|
+
await rename4(partial, path);
|
|
14551
14743
|
}
|
|
14552
14744
|
function concernPacks() {
|
|
14553
14745
|
const bundled = join13(dirname8(fileURLToPath2(import.meta.url)), "hub-catalogue");
|
|
@@ -16711,6 +16903,13 @@ async function statusCommand(options, io2) {
|
|
|
16711
16903
|
const fromTop = relative12(top, folder).replace(/\\/g, "/");
|
|
16712
16904
|
if (await hooksSaveBase(hooksDir, fromTop)) ok("the git hooks save its base for Studio's Changes on branch");
|
|
16713
16905
|
else warn(`the git hooks do not save its base for Studio's Changes on branch: radical hooks install ${shown2(folder, place)}`);
|
|
16906
|
+
const fetch2 = parseCiFetch(await readEditorStateFile(folder, CI_FETCH_FILE).catch(() => null) ?? "");
|
|
16907
|
+
if (fetch2) {
|
|
16908
|
+
const when = `the last fetch from CI (${formatAge(Date.now() - Date.parse(fetch2.at))} ago)`;
|
|
16909
|
+
const problem = ciFetchProblem(fetch2);
|
|
16910
|
+
if (problem) warn(`${when} found no test results: ${problem.replace(/^radical check --from-ci: /, "").replace(/\.$/, "")}. ${CI_ARTIFACTS_HINT}`);
|
|
16911
|
+
else ok(`${when}: ${fetch2.message}`);
|
|
16912
|
+
}
|
|
16714
16913
|
}
|
|
16715
16914
|
}
|
|
16716
16915
|
}
|
|
@@ -16785,7 +16984,7 @@ ${problems} problem${problems > 1 ? "s" : ""} found.` : "\nNothing is broken.");
|
|
|
16785
16984
|
init_define_RADICAL_BUILD();
|
|
16786
16985
|
import { execFile as execFile7 } from "child_process";
|
|
16787
16986
|
import { existsSync as existsSync11 } from "fs";
|
|
16788
|
-
import { mkdir as mkdir10, readFile as readFile15, rename as
|
|
16987
|
+
import { mkdir as mkdir10, readFile as readFile15, rename as rename5, writeFile as writeFile10 } from "fs/promises";
|
|
16789
16988
|
import { dirname as dirname17, join as join21, relative as relative13, resolve as resolve19 } from "path";
|
|
16790
16989
|
import { promisify as promisify7 } from "util";
|
|
16791
16990
|
var exec7 = promisify7(execFile7);
|
|
@@ -16806,7 +17005,7 @@ async function moveToRadical(root, parts2) {
|
|
|
16806
17005
|
for (const part of parts2) {
|
|
16807
17006
|
const to2 = MOVES[part];
|
|
16808
17007
|
await mkdir10(dirname17(join21(root, to2)), { recursive: true });
|
|
16809
|
-
await git6("mv", part, to2).catch(() =>
|
|
17008
|
+
await git6("mv", part, to2).catch(() => rename5(join21(root, part), join21(root, to2)));
|
|
16810
17009
|
said.push(`moved ${part} to ${to2}`);
|
|
16811
17010
|
}
|
|
16812
17011
|
if (!existsSync11(join21(root, RADICAL_DIR, ".gitignore"))) {
|
|
@@ -16815,7 +17014,7 @@ async function moveToRadical(root, parts2) {
|
|
|
16815
17014
|
}
|
|
16816
17015
|
const model = join21(root, MODEL_FOLDER);
|
|
16817
17016
|
if (parts2.includes(OLD_MODEL_FOLDER) && existsSync11(join21(model, OLD_STATE_DIR)) && !existsSync11(join21(model, STATE_DIR))) {
|
|
16818
|
-
await
|
|
17017
|
+
await rename5(join21(model, OLD_STATE_DIR), join21(model, STATE_DIR));
|
|
16819
17018
|
said.push(`renamed the model's ${OLD_STATE_DIR}/ to ${STATE_DIR}/`);
|
|
16820
17019
|
}
|
|
16821
17020
|
const plan = join21(root, CRUCIBLE_FILE);
|