feat(sdk): empty phase dir surfaces NO_UAT_FILES reason (#3184)

Cycle 4 of ~15: phase dir present but no *-HUMAN-UAT.md files
now returns a typed NO_UAT_FILES reason instead of an empty
reasons array (which prior cycles used as a 'shouldn't happen'
fallback).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-05-18 22:41:57 -04:00
parent c1664e52ae
commit 1a27780443
2 changed files with 28 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import { resolvePhaseDir } from './phase-list-queries.js';
export const REASON_CODE = Object.freeze({
NON_PASS_RESULT: 'non_pass_result',
NO_PHASE_DIR: 'no_phase_dir',
NO_UAT_FILES: 'no_uat_files',
} as const);
export type ReasonCode = typeof REASON_CODE[keyof typeof REASON_CODE];
@@ -74,6 +75,15 @@ export async function isPhaseUatPassed(
const files = await readdir(dir);
const uatFiles = files.filter((f) => f.endsWith('-HUMAN-UAT.md'));
if (uatFiles.length === 0) {
return {
passed: false,
reasons: [{ code: REASON_CODE.NO_UAT_FILES }],
reasonsHuman: [],
items: [],
};
}
const items: UatItem[] = [];
const reasons: UatReason[] = [];