Skip to content

Commit e95af36

Browse files
committed
Fix non-empty criterion check to use artifact.body instead of text
The non-empty check in scoreArtifactQuality was using text (which includes appended context) instead of artifact.body. This meant an artifact with an empty body would pass the non-empty check whenever context was supplied, defeating the purpose of the validity check. Restored the check to use artifact.body.length so context informs quality scoring but cannot substitute for actual artifact content.
1 parent e6e9e6c commit e95af36

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

workers/src/orchestrate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ function scoreArtifactQuality(
425425
for (const c of criteria) {
426426
const ck = c.check.toLowerCase();
427427
let passed = false;
428-
if (ck.includes("non-empty")) passed = artifact.fields.length > 3 || text.length > 0;
428+
if (ck.includes("non-empty")) passed = artifact.fields.length > 3 || artifact.body.length > 0;
429429
else if (ck.includes("10")) passed = text.split(/\s+/).length >= 10;
430430
else if (ck.includes("number") || ck.includes("concrete")) passed = /\d/.test(text);
431431
else if (ck.includes("interpretation") || ck.includes("does not contain")) passed = !/should|better|worse|means|implies/i.test(artifact.body);

0 commit comments

Comments
 (0)