fix: normalize StandardEvalResult to legacy format before local save

P1 from Codex review: gstack eval push copied standard-format JSON
verbatim to ~/.gstack-dev/evals/, but eval:summary and eval:trend
expect legacy fields (branch, total_tests, tests). Now uses
normalizeToLegacy() before writing locally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-19 01:28:19 -07:00
parent 7808ee380b
commit 468c5eb55f
+5 -4
View File
@@ -310,7 +310,7 @@ async function cmdPush(args: string[]): Promise<void> {
process.exit(1);
}
const { validateEvalResult } = await import('./eval-format');
const { validateEvalResult, normalizeToLegacy } = await import('./eval-format');
const validation = validateEvalResult(data);
if (!validation.valid) {
console.error('Validation errors:');
@@ -318,12 +318,13 @@ async function cmdPush(args: string[]): Promise<void> {
process.exit(1);
}
// Copy to local eval dir
// Normalize to legacy format for local tooling (eval:summary, eval:trend, eval:compare)
const legacyData = normalizeToLegacy(data as any);
const basename = path.basename(resolved);
const localPath = path.join(EVAL_DIR, basename);
fs.mkdirSync(EVAL_DIR, { recursive: true });
fs.copyFileSync(resolved, localPath);
console.log(`Saved to ${localPath}`);
fs.writeFileSync(localPath, JSON.stringify(legacyData, null, 2) + '\n');
console.log(`Saved to ${localPath} (normalized to legacy format)`);
// Push to team store (non-fatal)
try {