mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-27 07:01:54 +02:00
* feat: bind shared-code review advice to source and branch * feat: add shared-code extraction audit and scoped review checks * test: recognize complete source reads and explicit coverage legends * chore: bump version and changelog (v1.88.0.0) Co-Authored-By: OpenAI Codex <noreply@openai.com> * test: capture native review questions and retain public evidence Capture the actual first public native question with strict ownership and display matching. Preserve terminal failures and raw evidence, and retain SDK completion checks. * test: recognize verified review evidence and complete fixtures Recognize complete source and diagram evidence, concrete design and developer-experience decisions, and the complete planted scenario contracts. Preserve negative controls and grading thresholds. * fix: preserve decision brief structure in native questions Keep the required pros-and-cons heading and final Net field in native question text. Regenerate host outputs and document the release and evaluation repairs. Co-Authored-By: OpenAI Codex <noreply@openai.com> * docs: update project documentation for v1.88.0.0 Co-Authored-By: OpenAI Codex <noreply@openai.com> * fix: correct eval retry accounting and ship workflow gates * fix: capture native eval evidence and stabilize CI fixtures * fix: keep shared-code eval skips read-only Choose explicit no-change answers instead of mixed fix/preservation options. Reuse the bounded revalidation prompt for path fixtures so required review metadata is available without repeated discovery. Preserve source checks, retry limits, and failed native terminal outcomes. Add captured-question and callback regressions, plus evaluation selection coverage for the affected fixtures. --------- Co-authored-by: OpenAI Codex <noreply@openai.com>
58 lines
2.5 KiB
TypeScript
58 lines
2.5 KiB
TypeScript
import * as fs from 'node:fs';
|
|
import * as path from 'node:path';
|
|
import { randomUUID } from 'node:crypto';
|
|
import { getProjectEvalDir } from './eval-store';
|
|
|
|
interface PlanCountSnapshot {
|
|
skillName: string;
|
|
observation: object;
|
|
raw: string;
|
|
visible: string;
|
|
viewport?: string;
|
|
cwd: string;
|
|
claudeConfigDir: string | null;
|
|
}
|
|
|
|
/** One owned directory per count attempt; periodic captures replace files atomically. */
|
|
export function createPlanCountSnapshotWriter(env: NodeJS.ProcessEnv = process.env):
|
|
(input: PlanCountSnapshot) => { artifactDir?: string; artifactError?: string } {
|
|
let artifactDir: string | undefined;
|
|
// An explicit output directory requests retention even outside CI's named
|
|
// runs. Keep its fallback stable across checkpoints and unique per writer.
|
|
const runId = env.EVALS_RUN_ID || (env.GSTACK_EVAL_DIR ? `local-${randomUUID()}` : undefined);
|
|
return (input) => {
|
|
if (!runId) return {};
|
|
try {
|
|
if (!artifactDir) {
|
|
const segment = (text: string) => text.replace(/[^a-zA-Z0-9_-]/g, '_').slice(0, 120) || 'run';
|
|
const root = path.resolve(env.GSTACK_EVAL_DIR || getProjectEvalDir(), 'pty-count', segment(runId));
|
|
fs.mkdirSync(root, { recursive: true, mode: 0o700 });
|
|
artifactDir = fs.mkdtempSync(path.join(root, `${segment(input.skillName)}-${Date.now()}-`));
|
|
}
|
|
const write = (name: string, content: string) => {
|
|
const target = path.join(artifactDir!, name);
|
|
fs.writeFileSync(`${target}.tmp`, content, { mode: 0o600 });
|
|
fs.renameSync(`${target}.tmp`, target);
|
|
};
|
|
write('terminal.raw.log', input.raw);
|
|
write('terminal.visible.log', input.visible);
|
|
if (input.viewport !== undefined) write('terminal.screen.log', input.viewport);
|
|
write('observation.json', JSON.stringify({
|
|
...input.observation, artifactDir,
|
|
capture: { skill: input.skillName, runId, cwd: input.cwd,
|
|
claudeConfigDir: input.claudeConfigDir, at: new Date().toISOString() },
|
|
}, null, 2) + '\n');
|
|
return { artifactDir };
|
|
} catch (error) {
|
|
// Preserve any partial evidence and the original test outcome; make the
|
|
// write failure visible instead of claiming diagnostics were retained.
|
|
return { artifactDir, artifactError: String(error) };
|
|
}
|
|
};
|
|
}
|
|
|
|
/** Keep a single snapshot outside the temporary fixture that setup later removes. */
|
|
export function persistPlanCountSnapshot(input: PlanCountSnapshot, env: NodeJS.ProcessEnv = process.env) {
|
|
return createPlanCountSnapshotWriter(env)(input);
|
|
}
|