@sun-asterisk/sungen 3.2.16-beta.7 → 3.2.17

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 (95) hide show
  1. package/dist/cli/commands/delivery.d.ts.map +1 -1
  2. package/dist/cli/commands/delivery.js +13 -197
  3. package/dist/cli/commands/delivery.js.map +1 -1
  4. package/dist/cli/commands/ingest.d.ts.map +1 -1
  5. package/dist/cli/commands/ingest.js +56 -4
  6. package/dist/cli/commands/ingest.js.map +1 -1
  7. package/dist/dashboard/templates/index.html +1 -1
  8. package/dist/exporters/feature-parser.js +1 -1
  9. package/dist/exporters/feature-parser.js.map +1 -1
  10. package/dist/exporters/scenario-merger.js +1 -1
  11. package/dist/exporters/scenario-merger.js.map +1 -1
  12. package/dist/exporters/spec-parser.js +1 -1
  13. package/dist/exporters/spec-parser.js.map +1 -1
  14. package/dist/exporters/xlsx-report-builder.d.ts +1 -1
  15. package/dist/exporters/xlsx-report-builder.d.ts.map +1 -1
  16. package/dist/exporters/xlsx-report-builder.js +3 -3
  17. package/dist/exporters/xlsx-report-builder.js.map +1 -1
  18. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/click-action.hbs +1 -1
  19. package/dist/generators/test-generator/adapters/playwright/templates/steps/actions/click-element-with-text.hbs +1 -1
  20. package/dist/generators/test-generator/adapters/playwright/templates/steps/navigation/wait-timeout.hbs +1 -1
  21. package/dist/generators/test-generator/utils/runtime-data-transformer.d.ts.map +1 -1
  22. package/dist/generators/test-generator/utils/runtime-data-transformer.js +28 -17
  23. package/dist/generators/test-generator/utils/runtime-data-transformer.js.map +1 -1
  24. package/dist/ingest/legacy-parser.d.ts +3 -0
  25. package/dist/ingest/legacy-parser.d.ts.map +1 -1
  26. package/dist/ingest/legacy-parser.js +52 -3
  27. package/dist/ingest/legacy-parser.js.map +1 -1
  28. package/dist/orchestrator/templates/ai-src/commands/delivery.md +120 -202
  29. package/dist/orchestrator/templates/ai-src/config/claude.md +1 -1
  30. package/dist/orchestrator/templates/ai-src/config/copilot.md +1 -1
  31. package/dist/orchestrator/templates/ai-src/skills/sungen-delivery/SKILL.md +6 -92
  32. package/dist/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +7 -0
  33. package/package.json +4 -4
  34. package/src/cli/commands/delivery.ts +15 -227
  35. package/src/cli/commands/ingest.ts +57 -5
  36. package/src/dashboard/templates/index.html +1 -1
  37. package/src/exporters/feature-parser.ts +1 -1
  38. package/src/exporters/scenario-merger.ts +1 -1
  39. package/src/exporters/spec-parser.ts +1 -1
  40. package/src/exporters/xlsx-report-builder.ts +2 -3
  41. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/click-action.hbs +1 -1
  42. package/src/generators/test-generator/adapters/playwright/templates/steps/actions/click-element-with-text.hbs +1 -1
  43. package/src/generators/test-generator/adapters/playwright/templates/steps/navigation/wait-timeout.hbs +1 -1
  44. package/src/generators/test-generator/utils/runtime-data-transformer.ts +29 -18
  45. package/src/ingest/legacy-parser.ts +48 -3
  46. package/src/orchestrator/templates/ai-src/commands/delivery.md +120 -202
  47. package/src/orchestrator/templates/ai-src/config/claude.md +1 -1
  48. package/src/orchestrator/templates/ai-src/config/copilot.md +1 -1
  49. package/src/orchestrator/templates/ai-src/skills/sungen-delivery/SKILL.md +6 -92
  50. package/src/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +7 -0
  51. package/dist/exporters/matrix/build.d.ts +0 -61
  52. package/dist/exporters/matrix/build.d.ts.map +0 -1
  53. package/dist/exporters/matrix/build.js +0 -472
  54. package/dist/exporters/matrix/build.js.map +0 -1
  55. package/dist/exporters/matrix/export.d.ts +0 -50
  56. package/dist/exporters/matrix/export.d.ts.map +0 -1
  57. package/dist/exporters/matrix/export.js +0 -152
  58. package/dist/exporters/matrix/export.js.map +0 -1
  59. package/dist/exporters/matrix/fingerprint.d.ts +0 -20
  60. package/dist/exporters/matrix/fingerprint.d.ts.map +0 -1
  61. package/dist/exporters/matrix/fingerprint.js +0 -83
  62. package/dist/exporters/matrix/fingerprint.js.map +0 -1
  63. package/dist/exporters/matrix/gates.d.ts +0 -21
  64. package/dist/exporters/matrix/gates.d.ts.map +0 -1
  65. package/dist/exporters/matrix/gates.js +0 -358
  66. package/dist/exporters/matrix/gates.js.map +0 -1
  67. package/dist/exporters/matrix/map-loader.d.ts +0 -22
  68. package/dist/exporters/matrix/map-loader.d.ts.map +0 -1
  69. package/dist/exporters/matrix/map-loader.js +0 -193
  70. package/dist/exporters/matrix/map-loader.js.map +0 -1
  71. package/dist/exporters/matrix/render-csv.d.ts +0 -9
  72. package/dist/exporters/matrix/render-csv.d.ts.map +0 -1
  73. package/dist/exporters/matrix/render-csv.js +0 -92
  74. package/dist/exporters/matrix/render-csv.js.map +0 -1
  75. package/dist/exporters/matrix/render-xlsx.d.ts +0 -41
  76. package/dist/exporters/matrix/render-xlsx.d.ts.map +0 -1
  77. package/dist/exporters/matrix/render-xlsx.js +0 -430
  78. package/dist/exporters/matrix/render-xlsx.js.map +0 -1
  79. package/dist/exporters/matrix/types.d.ts +0 -196
  80. package/dist/exporters/matrix/types.d.ts.map +0 -1
  81. package/dist/exporters/matrix/types.js +0 -15
  82. package/dist/exporters/matrix/types.js.map +0 -1
  83. package/dist/exporters/matrix/wording.d.ts +0 -51
  84. package/dist/exporters/matrix/wording.d.ts.map +0 -1
  85. package/dist/exporters/matrix/wording.js +0 -169
  86. package/dist/exporters/matrix/wording.js.map +0 -1
  87. package/src/exporters/matrix/build.ts +0 -503
  88. package/src/exporters/matrix/export.ts +0 -149
  89. package/src/exporters/matrix/fingerprint.ts +0 -49
  90. package/src/exporters/matrix/gates.ts +0 -391
  91. package/src/exporters/matrix/map-loader.ts +0 -163
  92. package/src/exporters/matrix/render-csv.ts +0 -94
  93. package/src/exporters/matrix/render-xlsx.ts +0 -420
  94. package/src/exporters/matrix/types.ts +0 -223
  95. package/src/exporters/matrix/wording.ts +0 -174
@@ -1,152 +0,0 @@
1
- "use strict";
2
- /**
3
- * Matrix export orchestration — the piece `sungen delivery` calls.
4
- *
5
- * Composes the existing parsing seams (feature-parser, spec-parser, test-data,
6
- * playwright report) with the map loader, builder, gates, and renderers. All
7
- * inputs arrive as resolved paths so the CLI's discovery logic stays the single
8
- * owner of unit-kind layout rules.
9
- */
10
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __importStar = (this && this.__importStar) || (function () {
27
- var ownKeys = function(o) {
28
- ownKeys = Object.getOwnPropertyNames || function (o) {
29
- var ar = [];
30
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
- return ar;
32
- };
33
- return ownKeys(o);
34
- };
35
- return function (mod) {
36
- if (mod && mod.__esModule) return mod;
37
- var result = {};
38
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
- })();
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.hasReview = exports.hasErrors = void 0;
45
- exports.loadMatrixModel = loadMatrixModel;
46
- exports.approveMatrix = approveMatrix;
47
- exports.writeMatrixDeliverables = writeMatrixDeliverables;
48
- const fs = __importStar(require("fs"));
49
- const feature_parser_1 = require("../feature-parser");
50
- const spec_parser_1 = require("../spec-parser");
51
- const test_data_resolver_1 = require("../test-data-resolver");
52
- const playwright_report_parser_1 = require("../playwright-report-parser");
53
- const scenario_merger_1 = require("../scenario-merger");
54
- const package_info_1 = require("../package-info");
55
- const csv_exporter_1 = require("../csv-exporter");
56
- const xlsx_exporter_1 = require("../xlsx-exporter");
57
- const map_loader_1 = require("./map-loader");
58
- const fingerprint_1 = require("./fingerprint");
59
- const build_1 = require("./build");
60
- const render_xlsx_1 = require("./render-xlsx");
61
- const render_csv_1 = require("./render-csv");
62
- function readSpecText(paths) {
63
- return paths.specMdFile && fs.existsSync(paths.specMdFile)
64
- ? fs.readFileSync(paths.specMdFile, 'utf-8')
65
- : '';
66
- }
67
- function loadMatrixModel(paths) {
68
- const { map, errors } = (0, map_loader_1.loadDeliveryMap)(paths.mapFile);
69
- if (!map) {
70
- return errors.length === 0 ? { mapMissing: true, mapErrors: [] } : { mapErrors: errors };
71
- }
72
- const feature = (0, feature_parser_1.parseFeatureMetadata)(paths.featureFile);
73
- const spec = (0, spec_parser_1.parseSpecFile)(paths.specFile);
74
- const merged = (0, scenario_merger_1.mergeFeatureAndSpec)(feature, spec);
75
- const testData = fs.existsSync(paths.testDataFile) ? (0, test_data_resolver_1.loadTestData)(paths.testDataFile, process.env.SUNGEN_ENV ?? null) : null;
76
- const results = paths.resultsPath ? (0, playwright_report_parser_1.loadPlaywrightReport)(paths.resultsPath) : null;
77
- const model = (0, build_1.buildMatrix)({
78
- unit: paths.unit,
79
- feature,
80
- merged,
81
- testData,
82
- results,
83
- map,
84
- transformerVersion: (0, package_info_1.getPackageVersion)(),
85
- specText: readSpecText(paths),
86
- });
87
- return { model, map, mapErrors: [] };
88
- }
89
- const hasErrors = (f) => f.some((x) => x.severity === 'error');
90
- exports.hasErrors = hasErrors;
91
- const hasReview = (f) => f.some((x) => x.severity === 'review');
92
- exports.hasReview = hasReview;
93
- /**
94
- * Stamp fingerprints + flip groups to `approved` (all groups, or just `groupIds`).
95
- * Refuses when gate ERRORs remain — an invalid map must not be frozen as approved.
96
- * Returns the findings so the caller reports what blocked or what was approved.
97
- */
98
- function approveMatrix(paths, groupIds) {
99
- const { map, errors } = (0, map_loader_1.loadDeliveryMap)(paths.mapFile);
100
- if (!map)
101
- throw new Error(errors.length > 0 ? `map is invalid:\n - ${errors.join('\n - ')}` : `no delivery map at ${paths.mapFile}`);
102
- const feature = (0, feature_parser_1.parseFeatureMetadata)(paths.featureFile);
103
- const spec = (0, spec_parser_1.parseSpecFile)(paths.specFile);
104
- const merged = (0, scenario_merger_1.mergeFeatureAndSpec)(feature, spec);
105
- const testData = fs.existsSync(paths.testDataFile) ? (0, test_data_resolver_1.loadTestData)(paths.testDataFile, process.env.SUNGEN_ENV ?? null) : null;
106
- const model = (0, build_1.buildMatrix)({
107
- unit: paths.unit, feature, merged, testData, results: null, map,
108
- transformerVersion: (0, package_info_1.getPackageVersion)(),
109
- specText: readSpecText(paths),
110
- });
111
- const blocking = model.findings.filter((f) => f.severity === 'error');
112
- if (blocking.length > 0)
113
- return { findings: blocking, approved: [] };
114
- const variants = (0, build_1.deriveVariants)({ feature, merged, testData, results: null });
115
- const byRef = new Map(variants.map((v) => [v.ref, v]));
116
- const byVp = new Map();
117
- for (const v of variants) {
118
- const list = byVp.get(v.vpId) ?? [];
119
- list.push(v);
120
- byVp.set(v.vpId, list);
121
- }
122
- const approved = [];
123
- for (const g of map.groups) {
124
- if (groupIds && groupIds.length > 0 && !groupIds.includes(g.id))
125
- continue;
126
- for (const ref of g.variants) {
127
- const expanded = ref.includes('#') ? [byRef.get(ref)].filter(Boolean) : (byVp.get(ref) ?? []);
128
- for (const v of expanded)
129
- map.fingerprints[v.ref] = v.fingerprint;
130
- }
131
- g.review = 'approved';
132
- approved.push(g.id);
133
- }
134
- // Freeze the reviewed map semantics as well (GAP-09) — computed AFTER the
135
- // review flips so re-running approve on an unchanged map is idempotent.
136
- map.fingerprints.__map__ = (0, fingerprint_1.mapContentFingerprint)(map.groups, map.dispositions);
137
- (0, map_loader_1.writeDeliveryMap)(paths.mapFile, map);
138
- return { findings: model.findings.filter((f) => f.severity !== 'error'), approved };
139
- }
140
- /** Render + write the requested format(s). Caller has already enforced the gate policy. */
141
- async function writeMatrixDeliverables(paths, model, format = 'xlsx') {
142
- const out = {};
143
- if (format === 'csv' || format === 'both') {
144
- out.csvPath = (0, csv_exporter_1.writeCsv)(paths.cwd, paths.unit, (0, render_csv_1.renderMatrixCsv)(model));
145
- }
146
- if (format === 'xlsx' || format === 'both') {
147
- const wb = (0, render_xlsx_1.renderMatrixXlsx)(model, (0, package_info_1.getPackageVersion)());
148
- out.xlsxPath = await (0, xlsx_exporter_1.writeXlsx)(paths.cwd, paths.unit, wb);
149
- }
150
- return out;
151
- }
152
- //# sourceMappingURL=export.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/exporters/matrix/export.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDH,0CAuBC;AAUD,sCAyCC;AAKD,0DAcC;AA3ID,uCAAyB;AACzB,sDAAyD;AACzD,gDAA+C;AAC/C,8DAAqD;AACrD,0EAAmE;AACnE,wDAAyD;AACzD,kDAAoD;AACpD,kDAA2C;AAC3C,oDAA6C;AAC7C,6CAAiE;AACjE,+CAAsD;AACtD,mCAAsD;AACtD,+CAAiD;AACjD,6CAA+C;AAkB/C,SAAS,YAAY,CAAC,KAAwB;IAC5C,OAAO,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC;QACxD,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC;QAC5C,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAWD,SAAgB,eAAe,CAAC,KAAwB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,4BAAe,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvD,IAAI,CA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KAAK,MAAM,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QAC3C,MAAM,EAAE,GAAG,IAAA,8BAAgB,EAAC,KAAK,EAAE,IAAA,gCAAiB,GAAE,CAAC,CAAC;QACxD,GAAG,CAAC,QAAQ,GAAG,MAAM,IAAA,yBAAS,EAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Canonical scenario fingerprints for the Delivery Map drift detector (Gate E).
3
- *
4
- * A fingerprint hashes what changes the MEANING of a variant: sorted tags + ordered
5
- * step text (+ the dataset row for a @cases variant). Formatting, comments, and
6
- * scenario order do NOT change it. `--approve` stamps these into the map; a later
7
- * mismatch drops the group back to review (stale grouping).
8
- */
9
- import { ScenarioMetadata } from '../types';
10
- /**
11
- * Fingerprint one scenario. Tags are sorted (order is presentation); steps keep
12
- * their order (order is meaning). Manual scenarios include their procedure
13
- * comments — for them the comments ARE the test.
14
- */
15
- export declare function scenarioFingerprint(sc: ScenarioMetadata, datasetRow?: Record<string, unknown>): string;
16
- /** Fingerprint of the whole source (all variants) — manifest `sourceFingerprint`. */
17
- export declare function combinedFingerprint(parts: string[]): string;
18
- /** Fingerprint of the map's semantic content (groups + dispositions, not stamps). */
19
- export declare function mapContentFingerprint(groups: unknown, dispositions: unknown): string;
20
- //# sourceMappingURL=fingerprint.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../../src/exporters/matrix/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAe5C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,gBAAgB,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQtG;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAE3D;AAED,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAEpF"}
@@ -1,83 +0,0 @@
1
- "use strict";
2
- /**
3
- * Canonical scenario fingerprints for the Delivery Map drift detector (Gate E).
4
- *
5
- * A fingerprint hashes what changes the MEANING of a variant: sorted tags + ordered
6
- * step text (+ the dataset row for a @cases variant). Formatting, comments, and
7
- * scenario order do NOT change it. `--approve` stamps these into the map; a later
8
- * mismatch drops the group back to review (stale grouping).
9
- */
10
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __importStar = (this && this.__importStar) || (function () {
27
- var ownKeys = function(o) {
28
- ownKeys = Object.getOwnPropertyNames || function (o) {
29
- var ar = [];
30
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
- return ar;
32
- };
33
- return ownKeys(o);
34
- };
35
- return function (mod) {
36
- if (mod && mod.__esModule) return mod;
37
- var result = {};
38
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
- })();
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.scenarioFingerprint = scenarioFingerprint;
45
- exports.combinedFingerprint = combinedFingerprint;
46
- exports.mapContentFingerprint = mapContentFingerprint;
47
- const crypto = __importStar(require("crypto"));
48
- /** Stable stringify: objects get sorted keys so row column order can't shift the hash. */
49
- function canonical(value) {
50
- if (value === null || typeof value !== 'object')
51
- return JSON.stringify(value);
52
- if (Array.isArray(value))
53
- return `[${value.map(canonical).join(',')}]`;
54
- const obj = value;
55
- const keys = Object.keys(obj).sort();
56
- return `{${keys.map((k) => `${JSON.stringify(k)}:${canonical(obj[k])}`).join(',')}}`;
57
- }
58
- function sha1(text) {
59
- return 'sha1:' + crypto.createHash('sha1').update(text, 'utf-8').digest('hex');
60
- }
61
- /**
62
- * Fingerprint one scenario. Tags are sorted (order is presentation); steps keep
63
- * their order (order is meaning). Manual scenarios include their procedure
64
- * comments — for them the comments ARE the test.
65
- */
66
- function scenarioFingerprint(sc, datasetRow) {
67
- const body = canonical({
68
- tags: [...sc.tags].sort(),
69
- steps: sc.orderedSteps.map((s) => `${s.bucket}:${s.text}`),
70
- comments: sc.tags.some((t) => t === '@manual' || t.startsWith('@manual:')) ? (sc.comments ?? []) : [],
71
- row: datasetRow ?? null,
72
- });
73
- return sha1(body);
74
- }
75
- /** Fingerprint of the whole source (all variants) — manifest `sourceFingerprint`. */
76
- function combinedFingerprint(parts) {
77
- return sha1(canonical([...parts].sort()));
78
- }
79
- /** Fingerprint of the map's semantic content (groups + dispositions, not stamps). */
80
- function mapContentFingerprint(groups, dispositions) {
81
- return sha1(canonical({ groups, dispositions }));
82
- }
83
- //# sourceMappingURL=fingerprint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../../src/exporters/matrix/fingerprint.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBH,kDAQC;AAGD,kDAEC;AAGD,sDAEC;AA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AAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;QACrG,GAAG,EAAE,UAAU,IAAI,IAAI;KACxB,CAAC,CAAC;IACH,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAED,qFAAqF;AACrF,SAAgB,mBAAmB,CAAC,KAAe;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,qFAAqF;AACrF,SAAgB,qBAAqB,CAAC,MAAe,EAAE,YAAqB;IAC1E,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Deterministic quality gates for the Test Case & Coverage Matrix
3
- * (docs/spec/delivery-coverage-matrix-spec.md §6).
4
- *
5
- * Severity behavior:
6
- * error → blocks any render
7
- * review → blocks the official render; `--preview` renders with a DRAFT watermark
8
- * warning → prints + renders
9
- *
10
- * The gates recompute every signature part from the .feature — the map is never
11
- * trusted for derivable facts, only for the semantic fields (target/intent/oracle).
12
- */
13
- import { CoverageVariant, MatrixFinding } from './types';
14
- import { BuildInputs } from './build';
15
- export interface GateContext {
16
- inputs: BuildInputs;
17
- variants: CoverageVariant[];
18
- variantsByVp: Map<string, CoverageVariant[]>;
19
- }
20
- export declare function runGates(ctx: GateContext): MatrixFinding[];
21
- //# sourceMappingURL=gates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/exporters/matrix/gates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAyB,MAAM,SAAS,CAAC;AAChF,OAAO,EAAgB,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;CAC9C;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,aAAa,EAAE,CAW1D"}
@@ -1,358 +0,0 @@
1
- "use strict";
2
- /**
3
- * Deterministic quality gates for the Test Case & Coverage Matrix
4
- * (docs/spec/delivery-coverage-matrix-spec.md §6).
5
- *
6
- * Severity behavior:
7
- * error → blocks any render
8
- * review → blocks the official render; `--preview` renders with a DRAFT watermark
9
- * warning → prints + renders
10
- *
11
- * The gates recompute every signature part from the .feature — the map is never
12
- * trusted for derivable facts, only for the semantic fields (target/intent/oracle).
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.runGates = runGates;
16
- const feature_parser_1 = require("../feature-parser");
17
- const fingerprint_1 = require("./fingerprint");
18
- const types_1 = require("./types");
19
- const build_1 = require("./build");
20
- function runGates(ctx) {
21
- const findings = [];
22
- gateASource(ctx, findings);
23
- gateBMapping(ctx, findings);
24
- gateCAggregation(ctx, findings);
25
- gateDExecutability(ctx, findings);
26
- gateEDrift(ctx, findings);
27
- gateGReviewState(ctx, findings);
28
- gateWWording(ctx, findings);
29
- gateKCategory(ctx, findings);
30
- return findings;
31
- }
32
- // --- Gate K — category vs the source viewpoint class -------------------------
33
- /** VP prefixes whose category is not a judgement call — the source decides it. */
34
- const VP_CATEGORY_RULE = [
35
- ['SEC', 'security'],
36
- ['NFR', 'nfr'],
37
- ];
38
- /**
39
- * A `VP-SEC-*` scenario filed under `normal`/`abnormal` empties the Coverage
40
- * sheet's `security` column — the grid then reports a gap the unit does not
41
- * have while hiding the security work it does have. Same for `VP-NFR-*`.
42
- * (normal vs abnormal stays a judgement call and is never checked.)
43
- */
44
- function gateKCategory(ctx, findings) {
45
- for (const g of ctx.inputs.map.groups) {
46
- const vs = g.variants.flatMap((ref) => (0, build_1.expandMapRef)(ref, ctx.variantsByVp));
47
- for (const [prefix, expected] of VP_CATEGORY_RULE) {
48
- const hits = vs.filter((v) => v.vpCategory === prefix);
49
- if (hits.length > 0 && g.category !== expected) {
50
- findings.push({
51
- gate: 'K', severity: 'warning', ref: g.id,
52
- message: `group ${g.id} is \`category: ${g.category}\` but ${hits.length}/${vs.length} of its variants are VP-${prefix}-* (${hits.slice(0, 3).map((v) => v.vpId).join(', ')}) — use \`category: ${expected}\` or the Coverage grid's ${expected} column stays empty`,
53
- });
54
- }
55
- }
56
- }
57
- }
58
- // --- Gate A — source quality ------------------------------------------------
59
- function gateASource(ctx, findings) {
60
- const { feature, merged } = ctx.inputs;
61
- if (feature.backgroundWhenSteps.length > 0 || feature.backgroundThenSteps.length > 0) {
62
- findings.push({
63
- gate: 'A', severity: 'error',
64
- message: 'Background contains When/Then steps — setup only; move the action/oracle into scenarios',
65
- });
66
- }
67
- const seen = new Map();
68
- for (const m of merged) {
69
- const { vpId } = (0, feature_parser_1.splitVpAndName)(m.feature.name);
70
- if (!vpId) {
71
- findings.push({
72
- gate: 'A', severity: 'error', ref: m.feature.name,
73
- message: `scenario "${m.feature.name}" has no VP-id prefix — matrix variants must be addressable`,
74
- });
75
- continue;
76
- }
77
- seen.set(vpId, (seen.get(vpId) ?? 0) + 1);
78
- const isManual = (0, feature_parser_1.extractTestcaseType)(m.feature.tags) === 'Manual';
79
- if (m.resolvedExpected.length === 0) {
80
- findings.push({
81
- gate: 'A', severity: 'error', ref: vpId,
82
- message: isManual
83
- ? `manual scenario ${vpId} has no observable oracle (no Then steps and no Observable/Oracle comment lines)`
84
- : `scenario ${vpId} has no Then step — a variant without an observable oracle cannot be delivered`,
85
- });
86
- }
87
- }
88
- for (const [vpId, n] of seen) {
89
- if (n > 1)
90
- findings.push({ gate: 'A', severity: 'error', ref: vpId, message: `duplicate VP-id ${vpId} (${n} scenarios)` });
91
- }
92
- }
93
- // --- Gate B — mapping completeness -------------------------------------------
94
- function gateBMapping(ctx, findings) {
95
- const { map } = ctx.inputs;
96
- const { variants, variantsByVp } = ctx;
97
- // Where each derived variant landed: 0 → unmapped, >1 → double-mapped.
98
- const owners = new Map();
99
- for (const g of map.groups) {
100
- for (const ref of g.variants) {
101
- const expanded = (0, build_1.expandMapRef)(ref, variantsByVp);
102
- if (expanded.length === 0) {
103
- findings.push({
104
- gate: 'B', severity: 'error', ref: g.id,
105
- message: `group ${g.id} references ${ref} which matches no scenario/@cases row in the .feature`,
106
- });
107
- continue;
108
- }
109
- for (const v of expanded) {
110
- const list = owners.get(v.ref) ?? [];
111
- list.push(g.id);
112
- owners.set(v.ref, list);
113
- }
114
- }
115
- }
116
- for (const [ref, groups] of owners) {
117
- if (groups.length > 1) {
118
- findings.push({
119
- gate: 'B', severity: 'error', ref,
120
- message: `variant ${ref} belongs to ${groups.length} groups (${groups.join(', ')}) — exactly one required`,
121
- });
122
- }
123
- }
124
- for (const v of variants) {
125
- const grouped = owners.has(v.ref);
126
- const disposed = v.vpId in map.dispositions;
127
- if (!grouped && !disposed) {
128
- findings.push({
129
- gate: 'B', severity: 'error', ref: v.ref,
130
- message: `variant ${v.ref} is in no group and has no disposition — 100% source disposition is required`,
131
- });
132
- }
133
- if (grouped && disposed) {
134
- findings.push({
135
- gate: 'B', severity: 'error', ref: v.ref,
136
- message: `variant ${v.ref} is grouped AND disposed (${map.dispositions[v.vpId].as}) — pick one`,
137
- });
138
- }
139
- }
140
- for (const vpId of Object.keys(map.dispositions)) {
141
- if (!variantsByVp.has(vpId)) {
142
- findings.push({
143
- gate: 'B', severity: 'warning', ref: vpId,
144
- message: `disposition for ${vpId} matches no scenario (stale entry?)`,
145
- });
146
- }
147
- }
148
- }
149
- // --- Gate C — aggregation safety ---------------------------------------------
150
- function gateCAggregation(ctx, findings) {
151
- const { map } = ctx.inputs;
152
- const { variantsByVp } = ctx;
153
- for (const g of map.groups) {
154
- const vs = g.variants.flatMap((ref) => (0, build_1.expandMapRef)(ref, variantsByVp));
155
- if (vs.length <= 1)
156
- continue;
157
- // Approval IS the QA confirmation of the heuristic parts (oracle family,
158
- // precondition equivalence, sequence safety) — once approved AND unchanged
159
- // (fingerprints intact), only the hard signature checks keep firing. A
160
- // drifted variant re-opens the heuristics (Gate E flips the item to
161
- // proposed at the same time).
162
- const stale = vs.some((v) => {
163
- const stamped = map.fingerprints[v.ref] ?? map.fingerprints[v.vpId];
164
- return !stamped || stamped !== v.fingerprint;
165
- });
166
- const heuristicsConfirmed = g.review === 'approved' && !stale;
167
- // Hard signature parts — recomputed, never trusted from the map. ERROR on mismatch.
168
- // Execution mode and priority are deliberately NOT here: they are coverage
169
- // dimensions (account states may need seeded manual variants next to auto ones;
170
- // an item takes the highest variant priority) — shown per variant, never split on.
171
- const hard = [
172
- ['test layer', (v) => [...v.layers].sort().join('+')],
173
- ];
174
- for (const [label, keyOf] of hard) {
175
- const distinct = new Set(vs.map(keyOf));
176
- if (distinct.size > 1) {
177
- findings.push({
178
- gate: 'C', severity: 'error', ref: g.id,
179
- message: `group ${g.id} mixes ${label}s (${[...distinct].join(' vs ')}) — mandatory split`,
180
- });
181
- }
182
- }
183
- // Heuristic signature parts — REVIEW_REQUIRED (equivalence was inferred, not declared).
184
- const preProfiles = new Set(vs.map((v) => v.preconditionProfile));
185
- if (!heuristicsConfirmed && preProfiles.size > 1) {
186
- findings.push({
187
- gate: 'C', severity: 'review', ref: g.id,
188
- message: `group ${g.id} variants have different precondition profiles — confirm the grouping is safe or split`,
189
- });
190
- }
191
- const oracleShapes = new Set(vs.map((v) => v.oracleShape.join(' ; ')));
192
- if (!heuristicsConfirmed && oracleShapes.size > 1) {
193
- findings.push({
194
- gate: 'C', severity: 'review', ref: g.id,
195
- message: `group ${g.id} variants assert different oracle shapes (${oracleShapes.size} shapes) — confirm they are one oracle family`,
196
- });
197
- }
198
- if (!heuristicsConfirmed && vs.some((v) => v.procedureProfile === 'sequence')) {
199
- findings.push({
200
- gate: 'C', severity: 'review', ref: g.id,
201
- message: `group ${g.id} contains a sequence-sensitive scenario — ordered flows stay solo items unless QA confirms`,
202
- });
203
- }
204
- if (vs.length > types_1.MAX_VARIANTS_PER_ITEM) {
205
- findings.push({
206
- gate: 'C', severity: 'warning', ref: g.id,
207
- message: `group ${g.id} has ${vs.length} variants (> ${types_1.MAX_VARIANTS_PER_ITEM}) — consider splitting for reviewability`,
208
- });
209
- }
210
- }
211
- }
212
- // --- Gate D — manual executability -------------------------------------------
213
- function gateDExecutability(ctx, findings) {
214
- const { map, testData, feature } = ctx.inputs;
215
- const { variantsByVp } = ctx;
216
- for (const g of map.groups) {
217
- const vs = g.variants.flatMap((ref) => (0, build_1.expandMapRef)(ref, variantsByVp));
218
- for (const v of vs) {
219
- const hasPrecondition = v.precondition.length > 0 || feature.backgroundGivenSteps.length > 0;
220
- if (!hasPrecondition) {
221
- findings.push({
222
- gate: 'D', severity: 'error', ref: v.ref,
223
- message: `${v.ref}: no precondition (no Background, auth tag, or Given) — a tester cannot establish the start state`,
224
- });
225
- }
226
- if (v.trigger.length === 0) {
227
- findings.push({
228
- gate: 'D', severity: 'error', ref: v.ref,
229
- message: `${v.ref}: no action/trigger (no When steps${v.mode === 'manual' ? ' and no Setup/Action comment lines' : ''})`,
230
- });
231
- }
232
- // Oracle emptiness is Gate A (source) — not repeated here.
233
- }
234
- }
235
- // Every {{var}} must resolve — data the tester cannot obtain is not executable.
236
- for (const [vpId, vs] of variantsByVp) {
237
- const scenario = ctx.inputs.merged.find((m) => (0, feature_parser_1.splitVpAndName)(m.feature.name).vpId === vpId);
238
- if (!scenario)
239
- continue;
240
- for (const varName of scenario.feature.referencedVars) {
241
- const inRows = vs.some((v) => v.caseLabel !== undefined); // dataset rows carry their own columns
242
- if (!inRows && (!testData || !(varName in testData))) {
243
- findings.push({
244
- gate: 'D', severity: 'error', ref: vpId,
245
- message: `${vpId}: {{${varName}}} does not resolve in test-data — the variant is not reproducible`,
246
- });
247
- }
248
- }
249
- }
250
- // No template token may survive into a RENDERED cell (review B-04) — this also
251
- // catches cross-referencing test-data values the one-level resolver couldn't close.
252
- for (const [, vs] of variantsByVp) {
253
- for (const v of vs) {
254
- const rendered = [...v.precondition, ...v.trigger, ...v.oracle, ...v.verification, ...v.data];
255
- const token = rendered.map((t) => t.match(/\{\{[^}]*\}\}/)).find(Boolean);
256
- if (token) {
257
- findings.push({
258
- gate: 'D', severity: 'error', ref: v.ref,
259
- message: `${v.ref}: unresolved template token ${token[0]} remains in the rendered output — the export is not deterministic for a tester`,
260
- });
261
- }
262
- }
263
- }
264
- }
265
- // --- Gate E — drift (stale approval) ------------------------------------------
266
- function gateEDrift(ctx, findings) {
267
- const { map } = ctx.inputs;
268
- const { variantsByVp } = ctx;
269
- // The map's own semantics (targets/intents/oracles/grouping) are part of what
270
- // was approved — an edit after approval must be re-reviewed, not silently
271
- // published (review GAP-09).
272
- const stampedMap = map.fingerprints.__map__;
273
- const liveMap = (0, fingerprint_1.mapContentFingerprint)(map.groups, map.dispositions);
274
- if (map.groups.some((g) => g.review === 'approved')) {
275
- if (!stampedMap) {
276
- findings.push({
277
- gate: 'E', severity: 'review',
278
- message: 'the delivery map has no stamped content fingerprint — run `sungen delivery --approve` to record the reviewed wording',
279
- });
280
- }
281
- else if (stampedMap !== liveMap) {
282
- findings.push({
283
- gate: 'E', severity: 'review',
284
- message: 'the delivery map wording/grouping changed since approval — re-review, then `sungen delivery --approve`',
285
- });
286
- }
287
- }
288
- for (const g of map.groups) {
289
- if (g.review !== 'approved')
290
- continue; // proposed groups are already under review
291
- for (const ref of g.variants) {
292
- const vs = (0, build_1.expandMapRef)(ref, variantsByVp);
293
- for (const v of vs) {
294
- const stamped = map.fingerprints[v.ref] ?? map.fingerprints[v.vpId];
295
- if (!stamped) {
296
- findings.push({
297
- gate: 'E', severity: 'review', ref: g.id,
298
- message: `group ${g.id}: ${v.ref} has no stamped fingerprint — run \`sungen delivery --approve\` after review`,
299
- });
300
- }
301
- else if (stamped !== v.fingerprint) {
302
- findings.push({
303
- gate: 'E', severity: 'review', ref: g.id,
304
- message: `group ${g.id}: ${v.ref} changed since approval (fingerprint drift) — re-review the grouping`,
305
- });
306
- }
307
- }
308
- }
309
- }
310
- }
311
- // --- Gate W — controlled-language lint on the map's semantic fields --------------
312
- /** Patterns that make customer-facing wording read machine-generated (review §10). */
313
- const WORDING_SMELLS = [
314
- [/\{\{[^}]*\}\}/, 'an unresolved {{token}}'],
315
- [/\b(?:Setup|Observable|Oracle):/, 'a generator label (Setup:/Observable:/Oracle:)'],
316
- [/\bUser (?:fill|click|press|see|wait)\b/i, 'DSL phrasing ("User fill/click/see…") — write plain product language'],
317
- [/\[[^\]]+\]/, 'a [selector-style] reference — use the visible UI label'],
318
- ];
319
- function gateWWording(ctx, findings) {
320
- for (const g of ctx.inputs.map.groups) {
321
- const variantCount = g.variants.flatMap((ref) => (0, build_1.expandMapRef)(ref, ctx.variantsByVp)).length;
322
- // Without a digest the parent row can only list variant refs — a reviewer
323
- // then has to expand the item to learn which dimensions it covers.
324
- if (variantCount > 3 && !g.dimensions) {
325
- findings.push({
326
- gate: 'W', severity: 'warning', ref: g.id,
327
- message: `group ${g.id} has ${variantCount} variants and no \`dimensions:\` digest — add a short one (e.g. "required ×3 · format ×9") so the collapsed view stays informative`,
328
- });
329
- }
330
- if (g.dimensions && g.dimensions.length > 120) {
331
- findings.push({
332
- gate: 'W', severity: 'warning', ref: g.id,
333
- message: `group ${g.id} \`dimensions:\` is ${g.dimensions.length} chars — keep the digest short (≤120)`,
334
- });
335
- }
336
- for (const [field, text] of [['intent', g.intent], ['oracle', g.oracle], ...(g.dimensions ? [['dimensions', g.dimensions]] : [])]) {
337
- for (const [re, what] of WORDING_SMELLS) {
338
- if (re.test(text)) {
339
- findings.push({
340
- gate: 'W', severity: 'warning', ref: g.id,
341
- message: `group ${g.id} ${field} contains ${what}`,
342
- });
343
- }
344
- }
345
- }
346
- }
347
- }
348
- // --- Gate G — review state -----------------------------------------------------
349
- function gateGReviewState(ctx, findings) {
350
- const proposed = ctx.inputs.map.groups.filter((g) => g.review !== 'approved');
351
- if (proposed.length > 0) {
352
- findings.push({
353
- gate: 'G', severity: 'review',
354
- message: `${proposed.length} group(s) still \`proposed\` (${proposed.slice(0, 5).map((g) => g.id).join(', ')}${proposed.length > 5 ? ', …' : ''}) — approve them or render with --preview`,
355
- });
356
- }
357
- }
358
- //# sourceMappingURL=gates.js.map