mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
* refactor(ci): plan change scopes through an injectable Git owner ciChangeScope.test.ts spent about five processes per case (copy the seed repository, git add, commit and rev-parse, then node plan.mjs with its own merge-base and diff) to ask which lanes a path selects. Move the planner into change-plan.mjs as planChanges(request, repository), keep plan.mjs as the workflow entrypoint over gitRepository(), and answer the path and package-script tables from an in-memory commit. History, renames, deletions, push baselines, malformed metadata and GITHUB_OUTPUT keep the Git fixture or the spawned entrypoint. 378 tests: 30.6 s elapsed and 32.6 s CPU before, 4.0 s and 4.0 s after. * test(ci): cover workflow environment wiring through the plan entrypoint
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import type { TestSelectionPlan } from "./test-selection.d.mts";
|
|
|
|
export interface ChangePlanRequest {
|
|
readonly event: string | undefined;
|
|
readonly full: boolean;
|
|
readonly skipFull: boolean;
|
|
readonly base: string | undefined;
|
|
readonly head: string | undefined;
|
|
readonly baselineReason?: string | undefined;
|
|
}
|
|
|
|
/** The Git questions a plan asks; a failure propagates as a planning failure. */
|
|
export interface ChangePlanRepository {
|
|
readonly mergeBase: (base: string, head: string) => string;
|
|
readonly isAncestor: (ancestor: string, head: string) => boolean;
|
|
readonly changedFiles: (base: string, head: string) => readonly string[];
|
|
readonly readFile: (revision: string, path: string) => string;
|
|
}
|
|
|
|
export type ChangePlan = Readonly<Record<string, unknown>> & {
|
|
readonly tier: "full" | "fast" | "reused";
|
|
readonly matrix: {
|
|
readonly include: readonly {
|
|
readonly os: string;
|
|
readonly platform: string;
|
|
readonly architecture: string;
|
|
}[];
|
|
};
|
|
readonly files: readonly string[];
|
|
readonly reasons: readonly string[];
|
|
readonly testSelection: TestSelectionPlan;
|
|
};
|
|
|
|
export function planChanges(
|
|
request: ChangePlanRequest,
|
|
repository: ChangePlanRepository,
|
|
): ChangePlan;
|
|
|
|
export function gitRepository(cwd?: string): ChangePlanRepository;
|