fix: avoid false positives in progress-evidence gate

This commit is contained in:
Eve
2026-04-23 18:13:13 +08:00
parent 83077adcda
commit 242f7ce463
3 changed files with 149 additions and 24 deletions

View File

@@ -190,13 +190,16 @@ function hasProgressEvidence(input) {
});
}
function claimsProgressionWithoutEvidence(input) {
function claimsProgression(input) {
const progressionClaim = EVIDENCE_FIELDS.progressionClaim
.map((fieldPath) => getPathValue(input, fieldPath))
.find((value) => hasNonEmptyString(value));
if (!hasNonEmptyString(progressionClaim)) return false;
return hasNonEmptyString(progressionClaim);
}
function claimsProgressionWithoutEvidence(input) {
if (!claimsProgression(input)) return false;
return !hasProgressEvidence(input);
}
@@ -269,8 +272,14 @@ function main() {
process.stdout.write(JSON.stringify(output, null, args.pretty ? 2 : 0) + '\n');
}
try {
main();
} catch (error) {
fail('CLI_ERROR', error && error.message ? error.message : 'unexpected error');
export { evaluateGate };
const isDirectRun = process.argv[1] && fs.realpathSync(process.argv[1]) === fs.realpathSync(new URL(import.meta.url));
if (isDirectRun) {
try {
main();
} catch (error) {
fail('CLI_ERROR', error && error.message ? error.message : 'unexpected error');
}
}