mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
fix(evals): limit review restrictions to noncurrent artifacts
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
cf0eb599ae
commit
22cb59c1c3
2 files changed
+11
-4
No files matched your search
@@ -84,7 +84,7 @@ it("rejects negated use of the required viewport instead of treating nonoverflow
|
||||
expect(preservesWebsiteChecklist(markdown)).toBe(false);
|
||||
});
|
||||
|
||||
it.each(["Never test", "Avoid testing", "Don't bother testing"])("rejects unconditional mobile-check omission: %s", instruction => {
|
||||
it.each(["Never test", "Avoid testing", "Don't bother testing", "No need to test"])("rejects unconditional mobile-check omission: %s", instruction => {
|
||||
const markdown = websiteChecklist.join("\n").replace(websiteChecklist[3]!, `${instruction} a viewport 375px wide; there must be no horizontal overflow.`);
|
||||
expect(preservesWebsiteChecklist(markdown)).toBe(false);
|
||||
});
|
||||
@@ -92,3 +92,7 @@ it("keeps the required viewport review when a separate restriction forbids testi
|
||||
const markdown = `${websiteChecklist.join("\n")}; do not perform the check on a cached build.`;
|
||||
expect(preservesWebsiteChecklist(markdown)).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects a universal execution restriction despite a separately stated viewport check", () => {
|
||||
expect(preservesWebsiteChecklist(`${websiteChecklist.join("\n")}; do not perform the check using any browser.`)).toBe(false);
|
||||
});
|
||||
@@ -21,14 +21,17 @@ function websiteChecklistChecks(markdown: string): boolean[] {
|
||||
const mobileWaiver = (text: string) => {
|
||||
const clauses = text.split(/[.!?;\n]+/);
|
||||
const affirmative = clauses.some(clause => mobileRequirements.every(pattern => pattern.test(clause))
|
||||
&& !/\b(?:don't|do not|never|avoid|need not|skip|omit|ignore|optional|not required)\b/i.test(clause));
|
||||
&& !/\b(?:don't|do not|never|avoid|no need to|need not|skip|omit|ignore|optional|not required)\b/i.test(clause));
|
||||
return /\b(?:skip|omit|ignore|need not|not required|optional)\b/i.test(text)
|
||||
|| clauses.some(clause => [...clause.matchAll(/\b(?:don't|do not|never|avoid)\s+/gi)].some(negation => {
|
||||
|| clauses.some(clause => [...clause.matchAll(/\b(?:don't|do not|never|avoid|no need to)\s+/gi)].some(negation => {
|
||||
const action = clause.slice(negation.index + negation[0].length).trimStart();
|
||||
const target = /\b(?:375\s*(?:px|pixels?)?|viewport|check|test|review)\b/i.exec(action);
|
||||
const overflow = /\boverflow(?:ing)?\b/i.exec(action);
|
||||
const restriction = /\b(?:on|with|using|against)\s+(.+)$/i.exec(action)?.[1];
|
||||
const qualified = !!restriction && !/\b(?:375\s*(?:px|pixels?)?|viewport|mobile|width)\b/i.test(restriction);
|
||||
const qualified = !!restriction
|
||||
&& /\b(?:cached|stale|outdated|previous|old|archived)\b/i.test(restriction)
|
||||
&& /\b(?:build|version|snapshot|artifact|bundle)\b/i.test(restriction)
|
||||
&& !/\b(?:any|all|every|current|live|selected|375\s*(?:px|pixels?)?|viewport|mobile|width)\b/i.test(restriction);
|
||||
return !!target && (!overflow || target.index < overflow.index) && !(affirmative && qualified);
|
||||
}));
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user