Skip to content

Commit 7e0fc36

Browse files
refactor: rename Stage5Module → ProcessedModule throughout
Remove legacy "Stage 5" terminology from all code identifiers. The pipeline has 4 orchestrator stages; the internal sub-phases inside parallel-processing are not independently numbered stages.
1 parent 9a4bcd0 commit 7e0fc36

14 files changed

Lines changed: 76 additions & 76 deletions

docs/pipeline/check-modules-rule-registry.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"title": "Check Modules Rule Registry",
44
"type": "object",
5-
"description": "Schema describing the rule registry consumed by the Stage 5 check-modules implementation.",
5+
"description": "Schema describing the rule registry consumed by the check-modules implementation.",
66
"additionalProperties": false,
77
"properties": {
88
"schemaVersion": {

scripts/aggregate-catalogue.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import process from "node:process";
66
import { resolve } from "node:path";
77
import { writePublishedCatalogueOutputs } from "./shared/module-catalogue-output.ts";
88

9-
interface Stage5Module {
9+
interface ProcessedModule {
1010
id: string;
1111
[key: string]: unknown;
1212
}
@@ -48,19 +48,19 @@ interface AggregateLogger {
4848
warn: (message: string, data?: unknown) => void;
4949
}
5050

51-
type OutputWriter = (stage5Modules: Stage5Module[], projectRoot: string) => Promise<OutputResult | OutputPaths> | OutputResult | OutputPaths;
51+
type OutputWriter = (processedModules: ProcessedModule[], projectRoot: string) => Promise<OutputResult | OutputPaths> | OutputResult | OutputPaths;
5252

5353
interface RunAggregateCatalogueOptions {
5454
outputWriter?: OutputWriter | null;
5555
projectRoot?: string;
5656
runLogger?: AggregateLogger;
57-
stage5Modules: Stage5Module[];
57+
processedModules: ProcessedModule[];
5858
}
5959

6060
export interface AggregateCatalogueResult {
6161
changeSummary: ChangeSummary | null;
6262
outputPaths: OutputPaths | null;
63-
stage5ModulesCount: number;
63+
processedModulesCount: number;
6464
stats?: unknown;
6565
wroteOutputs: boolean;
6666
}
@@ -100,17 +100,17 @@ function normalizeOutputDetails(outputResult: OutputResult | OutputPaths | null)
100100
}
101101

102102
export async function runAggregateCatalogue({
103-
stage5Modules,
103+
processedModules,
104104
projectRoot = PROJECT_ROOT,
105105
outputWriter = writePublishedCatalogueOutputs,
106106
runLogger = logger
107107
}: RunAggregateCatalogueOptions): Promise<AggregateCatalogueResult> {
108-
if (!Array.isArray(stage5Modules)) {
109-
throw new TypeError("runAggregateCatalogue requires stage5Modules from the in-memory pipeline handoff");
108+
if (!Array.isArray(processedModules)) {
109+
throw new TypeError("runAggregateCatalogue requires processedModules from the in-memory pipeline handoff");
110110
}
111111

112112
const outputResult = outputWriter
113-
? await outputWriter(stage5Modules, projectRoot)
113+
? await outputWriter(processedModules, projectRoot)
114114
: null;
115115

116116
const outputDetails = normalizeOutputDetails(outputResult);
@@ -133,19 +133,19 @@ export async function runAggregateCatalogue({
133133
}
134134
}
135135

136-
runLogger.info(`Aggregated ${stage5Modules.length} module(s) into published catalogue outputs`);
136+
runLogger.info(`Aggregated ${processedModules.length} module(s) into published catalogue outputs`);
137137
return {
138138
changeSummary: outputDetails.changeSummary,
139139
outputPaths: outputDetails.outputPaths,
140-
stage5ModulesCount: stage5Modules.length,
140+
processedModulesCount: processedModules.length,
141141
stats: outputDetails.stats,
142142
wroteOutputs: outputDetails.wroteOutputs
143143
};
144144
}
145145

146146
async function main(): Promise<void> {
147147
try {
148-
throw new Error("aggregate-catalogue must be executed via the orchestrator; direct stage-5 file input is no longer supported");
148+
throw new Error("aggregate-catalogue must be executed via the orchestrator; direct per-module file input is no longer supported");
149149
}
150150
catch (error) {
151151
logger.error("Fatal error:", getErrorMessage(error));

scripts/check-modules/__tests__/result-markdown.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, it } from "node:test";
33
import { strict as assert } from "node:assert";
44

55
describe("result-markdown", () => {
6-
it("collects issue summaries from stage-5 modules", () => {
6+
it("collects issue summaries from processed modules", () => {
77
const summaries = collectIssueSummaries([
88
{
99
name: "MMM-Example",

scripts/check-modules/module-analyzer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function searchRegexInFile(content: string, pattern: RegExp): boolean {
359359

360360
/**
361361
* Analyze a module for issues and recommendations.
362-
* This is the core analysis function for Stage 5 of the pipeline.
362+
* This is the core analysis function for the parallel-processing stage.
363363
*/
364364
export async function analyzeModule(
365365
modulePath: string,

scripts/check-modules/result-markdown.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface IssueSummary {
1414
url?: string;
1515
}
1616

17-
interface Stage5ModuleLike {
17+
interface ProcessedModuleLike {
1818
issues?: boolean | string[] | string | null;
1919
maintainer?: string;
2020
name?: string;
@@ -39,7 +39,7 @@ export function collectIssueSummaries(modules: unknown[]): IssueSummary[] {
3939
return [];
4040
}
4141

42-
const stageModule = module as Stage5ModuleLike;
42+
const stageModule = module as ProcessedModuleLike;
4343
const issues = normalizeIssuesInput(stageModule.issues);
4444

4545
if (issues.length === 0 || typeof stageModule.name !== "string" || typeof stageModule.maintainer !== "string") {

scripts/fixtures/updateBaselineShas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function updateFixtureFile({ slug, repo, lastCommit }: BaselineFixture, sha: str
6262
}
6363
const raw = fs.readFileSync(fixturePath, "utf8");
6464

65-
const snapshotLine = `- Snapshot reference: Stage 5 dataset as of 2025-09-28 (\`lastCommit\`: ${lastCommit})`;
65+
const snapshotLine = `- Snapshot reference: processed module dataset as of 2025-09-28 (\`lastCommit\`: ${lastCommit})`;
6666
const updated = raw
6767
.replace(/- Snapshot reference:.*\n/u, `${snapshotLine}\n`)
6868
.replace(/- Upstream commit SHA:.*\n/u, `- Upstream commit SHA: \`${sha}\` (HEAD at update time for ${repo})\n`);

scripts/generate-result-markdown.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface GenerateResultMarkdownOptions {
2525
projectRoot?: string;
2626
resultPath?: string;
2727
runLogger?: ResultMarkdownLogger;
28-
stage5Modules?: unknown[];
28+
processedModules?: unknown[];
2929
stats?: ResultMarkdownStats;
3030
}
3131

@@ -36,17 +36,17 @@ export async function runGenerateResultMarkdown({
3636
projectRoot = PROJECT_ROOT,
3737
resultPath,
3838
runLogger = logger,
39-
stage5Modules,
39+
processedModules,
4040
stats
4141
}: GenerateResultMarkdownOptions = {}): Promise<{ issueCount: number; outputPath: string }> {
42-
if (!Array.isArray(stage5Modules)) {
43-
throw new TypeError("runGenerateResultMarkdown requires stage5Modules from the in-memory pipeline handoff");
42+
if (!Array.isArray(processedModules)) {
43+
throw new TypeError("runGenerateResultMarkdown requires processedModules from the in-memory pipeline handoff");
4444
}
4545

4646
const outputPath = resultPath ?? resolve(projectRoot, "website", "result.md");
4747
const resolvedStats = stats
4848
?? await readJson<ResultMarkdownStats>(resolve(projectRoot, "website", "data", "stats.json"));
49-
const summaries = collectIssueSummaries(stage5Modules);
49+
const summaries = collectIssueSummaries(processedModules);
5050
const markdown = buildResultMarkdown(resolvedStats, summaries);
5151

5252
await ensureDirectory(dirname(outputPath));
@@ -60,7 +60,7 @@ export async function runGenerateResultMarkdown({
6060
}
6161

6262
async function main(): Promise<void> {
63-
throw new Error("generate-result-markdown must be executed via the orchestrator; direct stage-5 file input is no longer supported");
63+
throw new Error("generate-result-markdown must be executed via the orchestrator; direct per-module file input is no longer supported");
6464
}
6565

6666
const currentFile = fileURLToPath(import.meta.url);

scripts/orchestrator/__tests__/in-process-stage-runner.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ test("runStagesSequentially passes modules in memory across collect, parallel, a
2727
];
2828
let capturedModules = null;
2929
let capturedParallelOutputWriter = "unset";
30-
let capturedStage5Modules = null;
30+
let capturedProcessedModules = null;
3131

3232
const stageRunner = createInProcessStageRunner({
3333
projectRoot: "/virtual/project",
3434
stageRuntimes: {
3535
aggregateCatalogue: (options) => {
36-
capturedStage5Modules = options.stage5Modules;
36+
capturedProcessedModules = options.processedModules;
3737
return Promise.resolve({
3838
outputPaths: {
3939
modulesJsonPath: "/virtual/project/website/data/modules.json",
4040
modulesMinPath: "/virtual/project/website/data/modules.min.json",
4141
statsPath: "/virtual/project/website/data/stats.json"
4242
},
43-
stage5ModulesCount: options.stage5Modules.length
43+
processedModulesCount: options.processedModules.length
4444
});
4545
},
4646
collectMetadata: () => Promise.resolve({ modules }),
@@ -49,7 +49,7 @@ test("runStagesSequentially passes modules in memory across collect, parallel, a
4949
capturedParallelOutputWriter = options.outputWriter;
5050
return Promise.resolve({
5151
results: options.modules.map(module => ({ ...module, fromCache: false, status: "success" })),
52-
stage5Modules: options.modules
52+
processedModules: options.modules
5353
});
5454
},
5555
writeSkippedModules: () => Promise.resolve()
@@ -84,7 +84,7 @@ test("runStagesSequentially passes modules in memory across collect, parallel, a
8484

8585
assert.deepStrictEqual(capturedModules, modules);
8686
assert.strictEqual(capturedParallelOutputWriter, null);
87-
assert.deepStrictEqual(capturedStage5Modules, modules);
87+
assert.deepStrictEqual(capturedProcessedModules, modules);
8888
assert.strictEqual(completedStages.length, 3);
8989
assert.strictEqual(completedStages[0].stage.id, "collect-metadata");
9090
assert.strictEqual(completedStages[1].stage.id, "parallel-processing");
@@ -114,7 +114,7 @@ test("runStagesSequentially clears buffered artifacts after filtered collect+par
114114
capturedParallelOutputWriter = options.outputWriter;
115115
return Promise.resolve({
116116
results: options.modules.map(module => ({ ...module, fromCache: false, status: "success" })),
117-
stage5Modules: options.modules
117+
processedModules: options.modules
118118
});
119119
},
120120
writeSkippedModules: () => Promise.resolve()
@@ -179,7 +179,7 @@ test("runStagesSequentially passes aggregate stats in memory to result markdown
179179
modulesMinPath: "/virtual/project/website/data/modules.min.json",
180180
statsPath: "/virtual/project/website/data/stats.json"
181181
},
182-
stage5ModulesCount: 1,
182+
processedModulesCount: 1,
183183
stats,
184184
wroteOutputs: true
185185
}),
@@ -193,7 +193,7 @@ test("runStagesSequentially passes aggregate stats in memory to result markdown
193193
},
194194
parallelProcessing: () => Promise.resolve({
195195
results: modules.map(module => ({ ...module, fromCache: false, status: "success" })),
196-
stage5Modules: modules
196+
processedModules: modules
197197
}),
198198
writeSkippedModules: () => Promise.resolve()
199199
}
@@ -233,7 +233,7 @@ test("runStagesSequentially passes aggregate stats in memory to result markdown
233233
assert.strictEqual(completedStages.length, 4);
234234
assert.deepStrictEqual(capturedMarkdownOptions, {
235235
projectRoot: "/virtual/project",
236-
stage5Modules: modules,
236+
processedModules: modules,
237237
stats
238238
});
239239
assert.deepStrictEqual(stageRunner.getBufferedArtifactIds(), []);

scripts/orchestrator/in-process-stage-runner.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface StageRuntimeOverrides {
1313
aggregateCatalogue?: (options: Record<string, unknown>) => Promise<unknown>;
1414
collectMetadata?: (options: Record<string, unknown>) => Promise<{ modules: unknown[] }>;
1515
generateResultMarkdown?: (options: Record<string, unknown>) => Promise<unknown>;
16-
parallelProcessing?: (options: Record<string, unknown>) => Promise<{ results?: unknown[]; stage5Modules: unknown[] }>;
16+
parallelProcessing?: (options: Record<string, unknown>) => Promise<{ results?: unknown[]; processedModules: unknown[] }>;
1717
writeSkippedModules?: (results: unknown[], projectRoot: string) => Promise<void>;
1818
}
1919

@@ -68,16 +68,16 @@ export function createInProcessStageRunner({
6868
artifactStore.delete("modules-stage-2");
6969
}
7070

71-
artifactStore.set("modules-stage-5", result.stage5Modules);
71+
artifactStore.set("modules-processed", result.processedModules);
7272
await writeSkippedModules(result.results ?? [], runRoot);
7373
return true;
7474
}
7575

76-
if (stage.id === "aggregate-catalogue" && artifactStore.has("modules-stage-5")) {
77-
const stage5Modules = artifactStore.get("modules-stage-5") as unknown[];
76+
if (stage.id === "aggregate-catalogue" && artifactStore.has("modules-processed")) {
77+
const processedModules = artifactStore.get("modules-processed") as unknown[];
7878
const aggregateOptions = {
7979
projectRoot: runRoot,
80-
stage5Modules: stage5Modules as never
80+
processedModules: processedModules as never
8181
};
8282

8383
const aggregateResult = await aggregateCatalogue(aggregateOptions);
@@ -93,20 +93,20 @@ export function createInProcessStageRunner({
9393
return true;
9494
}
9595

96-
if (stage.id === "generate-result-markdown" && artifactStore.has("modules-stage-5") && artifactStore.has("stats-json")) {
97-
const stage5Modules = artifactStore.get("modules-stage-5");
96+
if (stage.id === "generate-result-markdown" && artifactStore.has("modules-processed") && artifactStore.has("stats-json")) {
97+
const processedModules = artifactStore.get("modules-processed");
9898
const stats = artifactStore.get("stats-json");
9999
const markdownOptions: Record<string, unknown> = {
100100
projectRoot: runRoot,
101-
stage5Modules,
101+
processedModules,
102102
stats
103103
};
104104

105105
try {
106106
await generateResultMarkdown(markdownOptions);
107107
}
108108
finally {
109-
artifactStore.delete("modules-stage-5");
109+
artifactStore.delete("modules-processed");
110110
artifactStore.delete("stats-json");
111111
}
112112

scripts/parallel-processing.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import { MODULE_ANALYSIS_CACHE_SCHEMA_VERSION, buildModuleAnalysisCacheKey, createModuleAnalysisCache, getProjectRevision, normalizeModuleAnalysisCheckGroups, resolveModuleAnalysisCachePath } from "../scripts/shared/module-analysis-cache.ts";
11-
import { toStage5Module } from "../scripts/shared/module-catalogue-output.ts";
11+
import { toProcessedModule } from "../scripts/shared/module-catalogue-output.ts";
1212
import { WorkerPool } from "../pipeline/workers/worker-pool.ts";
1313
import { cpus } from "node:os";
1414
import { createLogger } from "../scripts/shared/logger.ts";
@@ -99,7 +99,7 @@ export interface ParallelProcessingResult {
9999
failedCount: number;
100100
results: ModuleResult[];
101101
skippedCount: number;
102-
stage5Modules: unknown[];
102+
processedModules: unknown[];
103103
successCount: number;
104104
}
105105

@@ -314,7 +314,7 @@ function buildMergedModules(modules: Stage2Module[], results: ModuleResult[]): M
314314
});
315315
}
316316

317-
function summarizeResults(results: ModuleResult[], durationMs: number): Omit<ParallelProcessingResult, "durationMs" | "results" | "stage5Modules"> {
317+
function summarizeResults(results: ModuleResult[], durationMs: number): Omit<ParallelProcessingResult, "durationMs" | "results" | "processedModules"> {
318318
const successCount = results.filter(result => result.status === "success").length;
319319
const failedCount = results.filter(result => result.status === "failed").length;
320320
const skippedCount = results.filter(result => result.status === "skipped").length;
@@ -330,7 +330,7 @@ function summarizeResults(results: ModuleResult[], durationMs: number): Omit<Par
330330
};
331331
}
332332

333-
function logProcessingSummary(results: ModuleResult[], durationMs: number, runLogger: ParallelLogger): Omit<ParallelProcessingResult, "durationMs" | "results" | "stage5Modules"> {
333+
function logProcessingSummary(results: ModuleResult[], durationMs: number, runLogger: ParallelLogger): Omit<ParallelProcessingResult, "durationMs" | "results" | "processedModules"> {
334334
const summary = summarizeResults(results, durationMs);
335335

336336
runLogger.info("\n========== Processing Complete ==========");
@@ -360,7 +360,7 @@ function logProcessingSummary(results: ModuleResult[], durationMs: number, runLo
360360
* @param {string|null} [options.catalogueRevision] Catalogue revision override
361361
* @param {object|null} [options.workerPool] Injected worker pool for tests/future orchestrator wiring
362362
* @param {object} [options.runLogger] Logger implementation
363-
* @returns {Promise<object>} Summary, results, and generated stage5 modules
363+
* @returns {Promise<object>} Summary, results, and generated processed modules
364364
*/
365365
export async function runParallelProcessing({
366366
modules,
@@ -469,15 +469,15 @@ export async function runParallelProcessing({
469469
}
470470

471471
const mergedModules = buildMergedModules(modules, results);
472-
const stage5Modules = mergedModules.map(module => toStage5Module(module));
472+
const processedModules = mergedModules.map(module => toProcessedModule(module));
473473
const durationMs = Date.now() - startTime;
474474
const summary = logProcessingSummary(results, durationMs, runLogger);
475475

476476
return {
477477
...summary,
478478
durationMs,
479479
results,
480-
stage5Modules
480+
processedModules
481481
};
482482
}
483483

0 commit comments

Comments
 (0)