Files
gstack/lib/pregate/types.ts
T
Garry Tanandcapy-ai[bot] 8584d6ff49 v1.91.77.0 feat(ship): two-stage gstack-pregate, gstack-regen generated-file registry, intent-based issue links (multi-agent wave C-pregate) (#3121)
* v1.91.77.0 feat(ship): two-stage gstack-pregate, gstack-regen registry, intent-based issue links (multi-agent wave C-pregate)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(pregate): keep the bin-driving pregate tests off the Windows subset; pin files are free-only for eval selection

The three C-pregate tests that spawn bin/gstack-regen, bin/gstack-pregate,
bin/gstack-issue-links and bin/gstack-ship-receipt do so through
test/helpers/pregate-fixture.ts runBin, so the Windows curation's source
scan of the test file never saw a bin/ spawn and shipped them to
windows-latest, where CreateProcess cannot exec a shebang (14 failures in
windows-free-shard 2 and 5). Each is now a KNOWN_WINDOWS_INCOMPATIBLE entry
with the precise reason. .gstack/generated.json and .gstack/pregate.json
join FREE_ONLY_PR_FILES: no paid case reads gstack's own pin files (the
tools read origin/<base> of the repo they run in, and paid cases run in
fixture repos), so touching them no longer restores every gate case.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(harness-version): record the FREE_ONLY_PR_FILES pin-file entries as non-behavioral

scripts/test-pr-profile.ts is a pinned shared-harness file; the two
.gstack pin-file entries change selection only, never a case verdict.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-11 01:57:16 +00:00

83 lines
2.6 KiB
TypeScript

/**
* pregate/types — the shapes every pre-gate check shares (plan C8). One check
* per file under lib/pregate/checks/, registered in lib/pregate/index.ts.
*/
import type { PregateCheck } from '../headless-artifacts';
import type { Registry } from '../regen';
import type { PregateConfig } from './config';
import type { Lane } from './workflows';
export type CheckStatus = PregateCheck['status'];
export type Stage = 'preflight' | 'tests';
export interface TouchedFile {
path: string;
/** A = added, M = modified, D = deleted, R = renamed (from `renamedFrom`). */
status: 'A' | 'M' | 'D' | 'R';
renamedFrom?: string;
/** True when the change is only in the working tree (uncommitted or untracked). */
uncommitted: boolean;
}
export interface PregateContext {
repoRoot: string;
/** Base branch name without `origin/`. */
base: string;
baseRef: string;
baseSha: string;
/** merge-base of origin/<base> and HEAD: the diff anchor. */
mergeBase: string;
head: string;
/** Working-tree content fingerprint at the start of the run (bin/gstack-wtree). */
wtree: string;
touched: TouchedFile[];
config: PregateConfig;
configLabel: string;
registry: Registry;
registryLabel: string;
lanes: Lane[];
platform: NodeJS.Platform;
allowRepoCommands: boolean;
timeoutMs: number;
env: NodeJS.ProcessEnv;
/** `--explain`: checks append provenance lines here. */
explain: string[];
}
export interface RemoteObligation {
/** `<workflow file>/<job id>`. */
lane: string;
platform: string;
workflow: string;
job: string;
/** Test files this machine cannot run that the touched files select. */
tests: string[];
/** What clears it: a run URL or an evidence-bundle lane label, recorded by `gstack-pregate clear`. */
receipt: string | null;
cleared_by?: string;
}
export interface CheckResult extends PregateCheck {
stage: Stage;
/** The input identity the check ran against (tree, selection, registry source). */
inputs: Record<string, string>;
/** Exact command or edit an author runs; present on fail/warn/incomplete. */
fix?: string;
/** Result code the detail line ends with. */
code?: string;
/** Per-file or per-item lines for the table body. */
lines?: string[];
remote?: RemoteObligation[];
}
export interface CheckDef {
id: string;
stage: Stage;
tier: 1 | 2;
/** `secrets` and required lanes can never be downgraded to warn. */
downgradable: boolean;
/** True when the check executes commands the repo declares (pin files or its test runner). */
needsRepoCommands: boolean;
run(ctx: PregateContext): CheckResult;
}