sela-core 0.1.0-alpha.44 → 0.1.0-alpha.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/merge.d.ts.map +1 -1
- package/dist/cli/commands/merge.js +3 -1
- package/dist/cli/commands/pr.d.ts +18 -8
- package/dist/cli/commands/pr.d.ts.map +1 -1
- package/dist/cli/commands/pr.js +68 -42
- package/dist/cli/commands/report.d.ts +23 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +132 -0
- package/dist/cli/index.js +4 -1
- package/dist/cli/ui/ConventionsTable.d.ts.map +1 -1
- package/dist/cli/ui/ConventionsTable.js +1 -1
- package/dist/config/ConfigLoader.d.ts.map +1 -1
- package/dist/config/ConfigLoader.js +1 -0
- package/dist/config/SelaConfig.d.ts +28 -0
- package/dist/config/SelaConfig.d.ts.map +1 -1
- package/dist/config/SelaConfig.js +4 -0
- package/dist/reporter/SelaReporter.d.ts +23 -0
- package/dist/reporter/SelaReporter.d.ts.map +1 -1
- package/dist/reporter/SelaReporter.js +118 -31
- package/dist/services/ArtifactAggregator.d.ts +72 -0
- package/dist/services/ArtifactAggregator.d.ts.map +1 -0
- package/dist/services/ArtifactAggregator.js +222 -0
- package/dist/services/ArtifactNaming.d.ts +84 -0
- package/dist/services/ArtifactNaming.d.ts.map +1 -0
- package/dist/services/ArtifactNaming.js +231 -0
- package/dist/services/HealReportService.d.ts +35 -9
- package/dist/services/HealReportService.d.ts.map +1 -1
- package/dist/services/HealReportService.js +52 -14
- package/dist/services/PRAutomationService.d.ts +7 -0
- package/dist/services/PRAutomationService.d.ts.map +1 -1
- package/dist/services/PRAutomationService.js +9 -2
- package/dist/services/PendingPromptLedger.d.ts +33 -4
- package/dist/services/PendingPromptLedger.d.ts.map +1 -1
- package/dist/services/PendingPromptLedger.js +92 -18
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0GpD"}
|
|
@@ -52,13 +52,15 @@ function registerMerge(program) {
|
|
|
52
52
|
.command("merge")
|
|
53
53
|
.argument("[files...]", "Explicit shard report JSON files (sela-report.json shape). " +
|
|
54
54
|
"When omitted, --shard-dir is scanned with --shard-glob.")
|
|
55
|
-
.description("Merge sharded Sela reports into a single history + HTML report (CI fan-in)")
|
|
55
|
+
.description("[deprecated — use 'sela report generate'] Merge sharded Sela reports into a single history + HTML report (CI fan-in)")
|
|
56
56
|
.option("--dir <path>", "Output dir for the merged report + rolling history (and where the prior .sela-history.json lives)", process.cwd())
|
|
57
57
|
.option("--shard-dir <path>", "Directory to scan for shard reports when no explicit files are given", process.cwd())
|
|
58
58
|
.option("--shard-glob <pattern>", "Filename glob (single * wildcard) used when scanning --shard-dir", "sela-shard-*.json")
|
|
59
59
|
.option("--run-id <id>", "Single dedup id for the merged history row (defaults to GITHUB_RUN_ID / CI_PIPELINE_ID)")
|
|
60
60
|
.option("--expected-shards <n>", "Number of shards launched; a smaller readable count flags a partial merge")
|
|
61
61
|
.action(async (files, opts) => {
|
|
62
|
+
process.stderr.write("[sela] 'sela merge' is deprecated — use 'sela report generate' " +
|
|
63
|
+
"(scans .sela/artifacts, auto-computes --expected-shards).\n");
|
|
62
64
|
const targetDir = path.resolve(opts.dir ?? process.cwd());
|
|
63
65
|
const shardDir = path.resolve(opts.shardDir ?? process.cwd());
|
|
64
66
|
const shardFiles = files && files.length > 0
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
/**
|
|
3
|
-
* `sela pr
|
|
3
|
+
* `sela pr generate --artifacts-dir <path>`
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Phase 2 of the two-phase pipeline (RFC: docs/rfc-two-phase-reporting.md).
|
|
6
|
+
* After all sharded Playwright runners complete and upload their
|
|
7
|
+
* `.sela/artifacts` (v3 PR-intent artifacts; v2 pending-prompts ledgers are
|
|
8
|
+
* still accepted), the fan-in job downloads everything into one directory
|
|
9
|
+
* and calls this command to open a single unified PR for the entire suite.
|
|
10
|
+
*
|
|
11
|
+
* Dedup layers (RFC §5):
|
|
12
|
+
* 1. Intent identity — same stableId across shards collapses; divergent
|
|
13
|
+
* heals resolve to the highest (auditor, AI) confidence winner, with
|
|
14
|
+
* every rejected candidate disclosed in the PR body.
|
|
15
|
+
* 2. Patch merge — the winner's granular patch is preferred when shards
|
|
16
|
+
* disagree; identical duplicate patches are explicit no-ops.
|
|
17
|
+
* 3. Git idempotency — deterministic fingerprint branch + open-PR upsert
|
|
18
|
+
* gate live in PRAutomationService (P0-2).
|
|
9
19
|
*
|
|
10
20
|
* Typical GHA usage:
|
|
11
|
-
* - Upload: actions/upload-artifact@v4 path: .sela/
|
|
12
|
-
* - Download: actions/download-artifact@v4 merge-multiple: true path: sela
|
|
13
|
-
* - Run: npx sela pr
|
|
21
|
+
* - Upload: actions/upload-artifact@v4 path: .sela/artifacts/
|
|
22
|
+
* - Download: actions/download-artifact@v4 merge-multiple: true path: .sela/artifacts/
|
|
23
|
+
* - Run: npx sela pr generate
|
|
14
24
|
*/
|
|
15
25
|
export declare function registerPr(parent: Command): void;
|
|
16
26
|
//# sourceMappingURL=pr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkDhD"}
|
package/dist/cli/commands/pr.js
CHANGED
|
@@ -36,61 +36,87 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.registerPr = registerPr;
|
|
37
37
|
const path = __importStar(require("path"));
|
|
38
38
|
const PendingPromptLedger_js_1 = require("../../services/PendingPromptLedger.js");
|
|
39
|
-
const
|
|
39
|
+
const ArtifactAggregator_js_1 = require("../../services/ArtifactAggregator.js");
|
|
40
40
|
const PRAutomationService_js_1 = require("../../services/PRAutomationService.js");
|
|
41
41
|
/**
|
|
42
|
-
* `sela pr
|
|
42
|
+
* `sela pr generate --artifacts-dir <path>`
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
44
|
+
* Phase 2 of the two-phase pipeline (RFC: docs/rfc-two-phase-reporting.md).
|
|
45
|
+
* After all sharded Playwright runners complete and upload their
|
|
46
|
+
* `.sela/artifacts` (v3 PR-intent artifacts; v2 pending-prompts ledgers are
|
|
47
|
+
* still accepted), the fan-in job downloads everything into one directory
|
|
48
|
+
* and calls this command to open a single unified PR for the entire suite.
|
|
49
|
+
*
|
|
50
|
+
* Dedup layers (RFC §5):
|
|
51
|
+
* 1. Intent identity — same stableId across shards collapses; divergent
|
|
52
|
+
* heals resolve to the highest (auditor, AI) confidence winner, with
|
|
53
|
+
* every rejected candidate disclosed in the PR body.
|
|
54
|
+
* 2. Patch merge — the winner's granular patch is preferred when shards
|
|
55
|
+
* disagree; identical duplicate patches are explicit no-ops.
|
|
56
|
+
* 3. Git idempotency — deterministic fingerprint branch + open-PR upsert
|
|
57
|
+
* gate live in PRAutomationService (P0-2).
|
|
48
58
|
*
|
|
49
59
|
* Typical GHA usage:
|
|
50
|
-
* - Upload: actions/upload-artifact@v4 path: .sela/
|
|
51
|
-
* - Download: actions/download-artifact@v4 merge-multiple: true path: sela
|
|
52
|
-
* - Run: npx sela pr
|
|
60
|
+
* - Upload: actions/upload-artifact@v4 path: .sela/artifacts/
|
|
61
|
+
* - Download: actions/download-artifact@v4 merge-multiple: true path: .sela/artifacts/
|
|
62
|
+
* - Run: npx sela pr generate
|
|
53
63
|
*/
|
|
54
64
|
function registerPr(parent) {
|
|
55
65
|
const pr = parent
|
|
56
66
|
.command("pr")
|
|
57
67
|
.description("Pull-request automation commands");
|
|
68
|
+
pr.command("generate")
|
|
69
|
+
.description("Aggregate shard PR-intent artifacts and open a single unified PR (CI fan-in)")
|
|
70
|
+
.option("--artifacts-dir <path>", "Directory containing all downloaded shard artifact JSON files", path.join(".sela", "artifacts"))
|
|
71
|
+
.option("--cwd <path>", "Repository root used for git operations (defaults to process.cwd())", process.cwd())
|
|
72
|
+
.action(async (opts) => {
|
|
73
|
+
await runPrFanIn(path.resolve(opts.cwd, opts.artifactsDir ?? path.join(".sela", "artifacts")), opts.cwd, "pr generate");
|
|
74
|
+
});
|
|
58
75
|
pr.command("aggregate")
|
|
59
|
-
.description("Aggregate sharded ledger files and open a single unified PR
|
|
76
|
+
.description("[deprecated — use 'sela pr generate'] Aggregate sharded ledger files and open a single unified PR")
|
|
60
77
|
.requiredOption("--ledger-dir <path>", "Directory containing all downloaded shard ledger JSON files")
|
|
61
78
|
.option("--cwd <path>", "Repository root used for git operations (defaults to process.cwd())", process.cwd())
|
|
62
79
|
.action(async (opts) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
80
|
+
console.error("[sela] 'sela pr aggregate' is deprecated — use 'sela pr generate --artifacts-dir <path>'.");
|
|
81
|
+
await runPrFanIn(path.resolve(opts.cwd, opts.ledgerDir), opts.cwd, "pr aggregate");
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async function runPrFanIn(resolvedDir, cwd, label) {
|
|
85
|
+
const aggregation = (0, ArtifactAggregator_js_1.aggregateIntents)(resolvedDir);
|
|
86
|
+
if (aggregation.artifactsRead === 0) {
|
|
87
|
+
console.error(`[sela ${label}] No intent/ledger payloads found in ${resolvedDir} — nothing to do.`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (aggregation.healedEvents.length === 0) {
|
|
91
|
+
console.error(`[sela ${label}] No healed events after deduplication — nothing to do.`);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (aggregation.advisories.length > 0) {
|
|
95
|
+
console.error(`[sela ${label}] ${aggregation.advisories.length} divergent heal(s) across shards — ` +
|
|
96
|
+
`highest-confidence candidates applied; all alternatives disclosed in the PR body.`);
|
|
97
|
+
}
|
|
98
|
+
// Re-apply AST heals to disk before the git flow runs a diff.
|
|
99
|
+
// The aggregator machine checked out the original (broken) source files
|
|
100
|
+
// and never ran tests itself, so we must physically write the patched
|
|
101
|
+
// code here — otherwise git sees 0 mutations and skips the PR entirely.
|
|
102
|
+
//
|
|
103
|
+
// mergeLedgerEntriesByFile applies each shard's granular patches
|
|
104
|
+
// sequentially against the shared baseline so ALL shards' fixes are
|
|
105
|
+
// preserved (no last-write-wins clobber); the preference map keeps the
|
|
106
|
+
// patch merge consistent with the intent winners above. Falls back to
|
|
107
|
+
// the contentAfter blob for legacy ledgers that predate the patches field.
|
|
108
|
+
const patchedCount = await (0, PendingPromptLedger_js_1.mergeLedgerEntriesByFile)(resolvedDir, cwd, {
|
|
109
|
+
preferredSourceByStableId: aggregation.preferredSourceByStableId,
|
|
110
|
+
});
|
|
111
|
+
if (patchedCount === 0) {
|
|
112
|
+
console.error(`[sela ${label}] No source patches could be applied to disk — skipping PR.`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
console.log(`[sela ${label}] Applied ${patchedCount} source patch(es) to disk.`);
|
|
116
|
+
await (0, PRAutomationService_js_1.runCentralizedGitFlow)({
|
|
117
|
+
cwd,
|
|
118
|
+
healedEvents: aggregation.healedEvents,
|
|
119
|
+
protectedEvents: aggregation.protectedEvents,
|
|
120
|
+
bodyAppendix: (0, ArtifactAggregator_js_1.renderDivergenceAdvisories)(aggregation.advisories) || undefined,
|
|
95
121
|
});
|
|
96
122
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* `sela report generate [files...]`
|
|
4
|
+
*
|
|
5
|
+
* Phase 2 of the two-phase pipeline (RFC: docs/rfc-two-phase-reporting.md).
|
|
6
|
+
* Reads every raw report artifact the shards emitted
|
|
7
|
+
* (`sela-report-{shardId}-{workerId}-….json`, plus legacy `sela-shard-*.json`)
|
|
8
|
+
* from ONE directory and compiles them into the single unified
|
|
9
|
+
* `sela-report.html` / `sela-report.json` / `.sela-history.json` — the
|
|
10
|
+
* one-and-only writer of those files in a distributed CI run.
|
|
11
|
+
*
|
|
12
|
+
* `expectedShards` is auto-derived from the `sela-run-meta-*.json` fragments
|
|
13
|
+
* each shard's reporter emitted; `--expected-shards` overrides. Stateless and
|
|
14
|
+
* idempotent: re-running against the same directory reproduces the same
|
|
15
|
+
* output.
|
|
16
|
+
*
|
|
17
|
+
* Typical GHA usage:
|
|
18
|
+
* - Per shard: actions/upload-artifact@v4 path: .sela/artifacts/
|
|
19
|
+
* - Fan-in: actions/download-artifact@v4 merge-multiple: true path: .sela/artifacts/
|
|
20
|
+
* - Run: npx sela report generate
|
|
21
|
+
*/
|
|
22
|
+
export declare function registerReport(program: Command): void;
|
|
23
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqGrD"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.registerReport = registerReport;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const ReportMergeService_js_1 = require("../../services/ReportMergeService.js");
|
|
39
|
+
const ArtifactAggregator_js_1 = require("../../services/ArtifactAggregator.js");
|
|
40
|
+
const SelaError_js_1 = require("../../errors/SelaError.js");
|
|
41
|
+
/**
|
|
42
|
+
* `sela report generate [files...]`
|
|
43
|
+
*
|
|
44
|
+
* Phase 2 of the two-phase pipeline (RFC: docs/rfc-two-phase-reporting.md).
|
|
45
|
+
* Reads every raw report artifact the shards emitted
|
|
46
|
+
* (`sela-report-{shardId}-{workerId}-….json`, plus legacy `sela-shard-*.json`)
|
|
47
|
+
* from ONE directory and compiles them into the single unified
|
|
48
|
+
* `sela-report.html` / `sela-report.json` / `.sela-history.json` — the
|
|
49
|
+
* one-and-only writer of those files in a distributed CI run.
|
|
50
|
+
*
|
|
51
|
+
* `expectedShards` is auto-derived from the `sela-run-meta-*.json` fragments
|
|
52
|
+
* each shard's reporter emitted; `--expected-shards` overrides. Stateless and
|
|
53
|
+
* idempotent: re-running against the same directory reproduces the same
|
|
54
|
+
* output.
|
|
55
|
+
*
|
|
56
|
+
* Typical GHA usage:
|
|
57
|
+
* - Per shard: actions/upload-artifact@v4 path: .sela/artifacts/
|
|
58
|
+
* - Fan-in: actions/download-artifact@v4 merge-multiple: true path: .sela/artifacts/
|
|
59
|
+
* - Run: npx sela report generate
|
|
60
|
+
*/
|
|
61
|
+
function registerReport(program) {
|
|
62
|
+
const report = program
|
|
63
|
+
.command("report")
|
|
64
|
+
.description("Two-phase report commands (CI fan-in)");
|
|
65
|
+
report
|
|
66
|
+
.command("generate")
|
|
67
|
+
.argument("[files...]", "Explicit raw report artifact files. When omitted, --artifacts-dir is scanned.")
|
|
68
|
+
.description("Compile all raw shard report artifacts into one unified sela-report.html (CI fan-in)")
|
|
69
|
+
.option("--artifacts-dir <path>", "Directory containing the downloaded shard artifacts", path.join(".sela", "artifacts"))
|
|
70
|
+
.option("--dir <path>", "Output dir for the merged report + rolling history", process.cwd())
|
|
71
|
+
.option("--run-id <id>", "Single dedup id for the merged history row (defaults to GITHUB_RUN_ID / CI_PIPELINE_ID)")
|
|
72
|
+
.option("--expected-shards <n>", "Override the auto-computed shard expectation (from sela-run-meta-*.json)")
|
|
73
|
+
.action(async (files, opts) => {
|
|
74
|
+
const targetDir = path.resolve(opts.dir ?? process.cwd());
|
|
75
|
+
const artifactsDir = path.resolve(targetDir, opts.artifactsDir ?? path.join(".sela", "artifacts"));
|
|
76
|
+
const shardFiles = files && files.length > 0
|
|
77
|
+
? files.map((f) => path.resolve(f))
|
|
78
|
+
: (0, ArtifactAggregator_js_1.discoverReportArtifacts)(artifactsDir);
|
|
79
|
+
if (shardFiles.length === 0) {
|
|
80
|
+
process.stderr.write(`[sela] No report artifacts found in ${artifactsDir}.\n` +
|
|
81
|
+
` A merged report with a healed:0 history row will still be written ` +
|
|
82
|
+
`to keep the trend cadence intact.\n`);
|
|
83
|
+
}
|
|
84
|
+
const expectedShards = parsePositiveInt(opts.expectedShards) ??
|
|
85
|
+
(0, ArtifactAggregator_js_1.discoverExpectedShards)(artifactsDir);
|
|
86
|
+
let result;
|
|
87
|
+
try {
|
|
88
|
+
result = ReportMergeService_js_1.ReportMergeService.merge({
|
|
89
|
+
shardFiles,
|
|
90
|
+
targetDir,
|
|
91
|
+
runId: opts.runId,
|
|
92
|
+
expectedShards,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
// A corrupt prior history (HISTORY_CORRUPT) is the one hard-fail: we
|
|
97
|
+
// must not silently overwrite a durable rolling window.
|
|
98
|
+
if ((0, SelaError_js_1.isSelaError)(err)) {
|
|
99
|
+
process.stderr.write(`[sela] report generate aborted: ${err.message}\n`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
103
|
+
process.stderr.write(`[sela] report generate failed: ${msg}\n`);
|
|
104
|
+
}
|
|
105
|
+
process.exit(1);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
process.stdout.write(`[sela] Unified report written: ${result.htmlPath}\n` +
|
|
109
|
+
` shards: ${result.shardsRead}` +
|
|
110
|
+
(result.shardsExpected != null ? `/${result.shardsExpected}` : "") +
|
|
111
|
+
` events: ${result.uniqueEvents}` +
|
|
112
|
+
(result.duplicatesDropped > 0
|
|
113
|
+
? ` (${result.duplicatesDropped} dup dropped)`
|
|
114
|
+
: "") +
|
|
115
|
+
` history: ${result.data.historical_runs.length} run(s)\n`);
|
|
116
|
+
if (result.manifestPath) {
|
|
117
|
+
process.stdout.write(`[sela] Unified regression manifest: ${result.manifestPath} ` +
|
|
118
|
+
`(${result.manifestRecords} bypass record(s))\n` +
|
|
119
|
+
` Verify with: npx sela shadow-regression\n`);
|
|
120
|
+
}
|
|
121
|
+
// Partial merges are surfaced but DO NOT fail the job (aggregate-and-flag).
|
|
122
|
+
if (result.partial) {
|
|
123
|
+
process.exitCode = 0;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function parsePositiveInt(raw) {
|
|
128
|
+
if (raw == null)
|
|
129
|
+
return undefined;
|
|
130
|
+
const n = Number.parseInt(raw, 10);
|
|
131
|
+
return Number.isFinite(n) && n > 0 ? n : undefined;
|
|
132
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -54,6 +54,7 @@ const bulk_js_1 = require("./commands/bulk.js");
|
|
|
54
54
|
const sync_js_1 = require("./commands/sync.js");
|
|
55
55
|
const dnaSync_js_1 = require("./commands/dnaSync.js");
|
|
56
56
|
const showReport_js_1 = require("./commands/showReport.js");
|
|
57
|
+
const report_js_1 = require("./commands/report.js");
|
|
57
58
|
const merge_js_1 = require("./commands/merge.js");
|
|
58
59
|
const shadowRegression_js_1 = require("./commands/shadowRegression.js");
|
|
59
60
|
const pr_js_1 = require("./commands/pr.js");
|
|
@@ -78,7 +79,9 @@ program
|
|
|
78
79
|
(0, list_js_1.registerList)(program);
|
|
79
80
|
// ── sela show-report - open Sela Insights HTML ───────────────────────────────
|
|
80
81
|
(0, showReport_js_1.registerShowReport)(program);
|
|
81
|
-
// ── sela
|
|
82
|
+
// ── sela report generate - two-phase CI fan-in (RFC) ──────────────────────────
|
|
83
|
+
(0, report_js_1.registerReport)(program);
|
|
84
|
+
// ── sela merge - [deprecated] CI fan-in: aggregate sharded reports into one ───
|
|
82
85
|
(0, merge_js_1.registerMerge)(program);
|
|
83
86
|
// ── sela shadow-regression - Job 2: verify bypassed shared-locator heals ──────
|
|
84
87
|
(0, shadowRegression_js_1.registerShadowRegression)(program);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConventionsTable.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/ConventionsTable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"ConventionsTable.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/ConventionsTable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CA6B7D"}
|
|
@@ -19,7 +19,7 @@ function renderConventionsTable(c) {
|
|
|
19
19
|
});
|
|
20
20
|
const conf = c._meta.confidence;
|
|
21
21
|
const confColor = conf >= 0.8 ? chalk_1.default.green : conf >= 0.6 ? chalk_1.default.yellow : chalk_1.default.red;
|
|
22
|
-
table.push([chalk_1.default.cyan("Strategy"), c.strategies.preferred.join(chalk_1.default.dim(" › "))], [
|
|
22
|
+
table.push([chalk_1.default.cyan("Strategy"), c.strategies.preferred.join(chalk_1.default.dim(" › "))], [
|
|
23
23
|
chalk_1.default.cyan("Architecture"),
|
|
24
24
|
c.architecture.selectorSource
|
|
25
25
|
? `${c.architecture.mode} ${chalk_1.default.dim(`(${c.architecture.selectorSource})`)}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigLoader.d.ts","sourceRoot":"","sources":["../../src/config/ConfigLoader.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,cAAc,CAAC;AAiSzE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA+B;IACtD,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuB;IAK5C,OAAO,CAAC,MAAM,CAAC,aAAa,CAA2B;IAEvD;;;;;;;;OAQG;IACH,MAAM,CAAC,WAAW,IAAI,cAAc;IAqCpC;;;;OAIG;IACH,MAAM,CAAC,YAAY,IAAI,UAAU;IAKjC,OAAO,CAAC,MAAM,CAAC,aAAa;IAsB5B,yEAAyE;IACzE,MAAM,CAAC,SAAS,IAAI,MAAM,GAAG,IAAI;IAKjC,uDAAuD;IACvD,MAAM,CAAC,KAAK,IAAI,IAAI;CAKrB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReportMode } from "../services/ArtifactNaming";
|
|
1
2
|
export type PRStrategy = "directCommit" | "pr" | "draftPR" | "readOnly";
|
|
2
3
|
export type BugAction = "failCI" | "createIssue" | "labelOnly";
|
|
3
4
|
export interface SelaPRAutomationConfig {
|
|
@@ -154,9 +155,27 @@ export interface SelaHealingConfig {
|
|
|
154
155
|
/** Honor `@sela-no-heal` tags / `{ type:'sela' }` annotations. Default true. */
|
|
155
156
|
annotations?: boolean;
|
|
156
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Two-Phase Reporting (RFC: docs/rfc-two-phase-reporting.md).
|
|
160
|
+
* Controls WHEN the HTML report + git/PR flow execute.
|
|
161
|
+
*/
|
|
162
|
+
export interface SelaReportingConfig {
|
|
163
|
+
/**
|
|
164
|
+
* - 'auto' (default): local runs and single-machine CI stay eager
|
|
165
|
+
* (report + PR flow in the reporter's onEnd); CI runs with a shard
|
|
166
|
+
* signal (`--shard=N/M` or `SELA_SHARD_ID`) defer to the fan-in job.
|
|
167
|
+
* - 'eager': always finalize in onEnd (legacy behavior).
|
|
168
|
+
* - 'deferred': onEnd only emits raw JSON artifacts under `.sela/artifacts/`;
|
|
169
|
+
* `sela report generate` + `sela pr generate` own the fan-in.
|
|
170
|
+
* Env `SELA_REPORT_MODE` overrides this value.
|
|
171
|
+
*/
|
|
172
|
+
mode?: ReportMode;
|
|
173
|
+
}
|
|
157
174
|
export interface SelaConfig {
|
|
158
175
|
/** Shorthand preset that expands to concrete threshold values. */
|
|
159
176
|
healingPolicy?: "conservative" | "balanced" | "aggressive";
|
|
177
|
+
/** Two-phase reporting mode (Allure pattern). Default: { mode: 'auto' }. */
|
|
178
|
+
reporting?: SelaReportingConfig;
|
|
160
179
|
/** Fine-grained threshold overrides. Explicit values always win over preset expansion. */
|
|
161
180
|
thresholds?: {
|
|
162
181
|
/** Minimum AI confidence to attempt a heal. Default: 85. Maps to CONFIDENCE_HARD_STOP. */
|
|
@@ -349,8 +368,17 @@ export interface ResolvedPlaywrightRules {
|
|
|
349
368
|
testIdAttribute: string;
|
|
350
369
|
preferGetByRoleOverCss: boolean;
|
|
351
370
|
}
|
|
371
|
+
export interface ResolvedReporting {
|
|
372
|
+
/**
|
|
373
|
+
* The CONFIGURED mode after the `SELA_REPORT_MODE` env override. `auto` is
|
|
374
|
+
* collapsed into eager/deferred at the reporter layer, where the Playwright
|
|
375
|
+
* shard signal is known (see ArtifactNaming.resolveEffectiveReportMode).
|
|
376
|
+
*/
|
|
377
|
+
mode: ReportMode;
|
|
378
|
+
}
|
|
352
379
|
export interface ResolvedConfig {
|
|
353
380
|
thresholds: ResolvedThresholds;
|
|
381
|
+
reporting: ResolvedReporting;
|
|
354
382
|
updateStrategy: "inPlace" | "commentOnly" | "branch";
|
|
355
383
|
autoCommit: boolean;
|
|
356
384
|
dnaStoragePath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaConfig.d.ts","sourceRoot":"","sources":["../../src/config/SelaConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelaConfig.d.ts","sourceRoot":"","sources":["../../src/config/SelaConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AAOpC,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,UAAU,CAAC;AACxE,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,UAAU,CAAC;IAEtB,qEAAqE;IACrE,iBAAiB,CAA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
9
9
|
exports.resolveLargeDomNodeThreshold = resolveLargeDomNodeThreshold;
|
|
10
10
|
exports.resolveHealing = resolveHealing;
|
|
11
11
|
exports.resolveConfig = resolveConfig;
|
|
12
|
+
const ArtifactNaming_1 = require("../services/ArtifactNaming");
|
|
12
13
|
const PRESET_MAP = {
|
|
13
14
|
conservative: {
|
|
14
15
|
minHealerConfidence: 92,
|
|
@@ -279,6 +280,9 @@ function resolveConfig(config, env = process.env) {
|
|
|
279
280
|
const largeDomNodeThreshold = resolveLargeDomNodeThreshold(config.largeDomNodeThreshold);
|
|
280
281
|
return {
|
|
281
282
|
thresholds: resolveThresholds(config),
|
|
283
|
+
reporting: {
|
|
284
|
+
mode: (0, ArtifactNaming_1.resolveConfiguredReportMode)(config.reporting?.mode, env),
|
|
285
|
+
},
|
|
282
286
|
updateStrategy: config.updateStrategy ?? "inPlace",
|
|
283
287
|
autoCommit,
|
|
284
288
|
dnaStoragePath: config.dnaStoragePath ?? ".sela/snapshots",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Reporter, TestCase, TestResult, FullConfig, Suite, FullResult } from "@playwright/test/reporter";
|
|
2
2
|
import { HealReportService, type BypassedEvent } from "../services/HealReportService.js";
|
|
3
|
+
import { type ReportMode } from "../services/ArtifactNaming.js";
|
|
3
4
|
import type { SelaEngine } from "../engine/SelaEngine.js";
|
|
4
5
|
import { type PendingPromptEntry, type WorkerGitPayload } from "../services/PendingPromptLedger.js";
|
|
5
6
|
import { type PrintReviewDeps } from "../services/InteractiveReview.js";
|
|
@@ -73,6 +74,18 @@ export interface SelaReporterOpts {
|
|
|
73
74
|
* disk fallback in readBypassedEvents().
|
|
74
75
|
*/
|
|
75
76
|
readBypassedEventsFn?: () => BypassedEvent[];
|
|
77
|
+
/**
|
|
78
|
+
* Override the CONFIGURED report mode (two-phase pipeline, RFC:
|
|
79
|
+
* docs/rfc-two-phase-reporting.md). Defaults to the resolved config
|
|
80
|
+
* (`reporting.mode` after the `SELA_REPORT_MODE` env override). Tests
|
|
81
|
+
* inject this to drive the eager/deferred gate without a config file.
|
|
82
|
+
*/
|
|
83
|
+
reportMode?: () => ReportMode;
|
|
84
|
+
/**
|
|
85
|
+
* Override the run-meta fragment writer (deferred mode). Tests stub this
|
|
86
|
+
* to avoid real filesystem writes.
|
|
87
|
+
*/
|
|
88
|
+
writeRunMeta?: (cwd: string, totalShards: number | null) => void;
|
|
76
89
|
}
|
|
77
90
|
export declare class SelaReporter implements Reporter {
|
|
78
91
|
private readonly engine;
|
|
@@ -89,9 +102,13 @@ export declare class SelaReporter implements Reporter {
|
|
|
89
102
|
private readonly shouldInstallSignalHandlers;
|
|
90
103
|
private readonly runCentralizedGitFlowFn;
|
|
91
104
|
private readonly _readBypassedEventsFn;
|
|
105
|
+
private readonly reportModeFn;
|
|
106
|
+
private readonly writeRunMetaFn;
|
|
92
107
|
private shutdownHandler;
|
|
93
108
|
private shuttingDown;
|
|
94
109
|
private _isShardedRun;
|
|
110
|
+
/** Playwright `--shard=N/M` total, captured at onBegin (null when unsharded). */
|
|
111
|
+
private shardTotal;
|
|
95
112
|
/** Total tests in the suite, captured at onBegin for the end-of-run summary. */
|
|
96
113
|
private totalTests;
|
|
97
114
|
/**
|
|
@@ -110,6 +127,12 @@ export declare class SelaReporter implements Reporter {
|
|
|
110
127
|
*/
|
|
111
128
|
private readonly failures;
|
|
112
129
|
constructor(opts?: SelaReporterOpts);
|
|
130
|
+
/**
|
|
131
|
+
* Collapse the configured mode + runtime shard signal into what this run
|
|
132
|
+
* actually does (RFC §2.1). `auto` → deferred only for CI runs with a
|
|
133
|
+
* shard signal (`--shard=N/M`, `SELA_SHARD_ID`, or `SELA_PW_SHARDED`).
|
|
134
|
+
*/
|
|
135
|
+
private effectiveReportMode;
|
|
113
136
|
onBegin(_config?: FullConfig, suite?: Suite): void;
|
|
114
137
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
115
138
|
onEnd(_result?: FullResult): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaReporter.d.ts","sourceRoot":"","sources":["../../src/reporter/SelaReporter.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SelaReporter.d.ts","sourceRoot":"","sources":["../../src/reporter/SelaReporter.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACX,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAEL,iBAAiB,EAKjB,KAAK,aAAa,EACnB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,oCAAoC,CAAC;AAK5C,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,kCAAkC,CAAC;AAS1C,MAAM,WAAW,cAAc;IAC7B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uDAAuD;IACvD,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC;IACrC,kEAAkE;IAClE,MAAM,CAAC,E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