mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
test(activity): retain equivalent actor-owned repair descriptions
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
8b8f676e83
commit
c41869f6df
2 files changed
+25
-1
No files matched your search
@@ -36,7 +36,14 @@ export function truthfulTimelineAccount(input: {
|
||||
return !prefix || ["The", "A", "An", "Then", input.personName].some(name => name?.toLowerCase() === prefix[1]!.toLowerCase());
|
||||
}).map(match => ({ at: at + match.index }));
|
||||
});
|
||||
const repairAction = new RegExp(`\\b${escape(repairWorker)}\\b(?:\\s+(?:then|later|now|personally|explicitly|actually|had|has|have|also|who)){0,3}\\s+\\b(?:repair(?:ed)?|fix(?:ed)?)\\b|\\b(?:was|got|had been|has been)\\s+(?:repaired|fixed)\\b[^.!?\\n]{0,40}\\bby\\s+${escape(repairWorker)}\\b`, "gi");
|
||||
const repairGap = "(?:\\s+|\\s*[,:—–-]\\s*)";
|
||||
const repairModifier = "(?:then|later|now|personally|explicitly|actually|had|has|have|also|who|successfully|finally|subsequently|after\\s+the\\s+handoff)";
|
||||
const repairVerb = [
|
||||
"repair(?:ed)?|fix(?:ed)?",
|
||||
"(?:completed|finished|performed|applied|implemented)\\s+(?:(?:a|the|needed|required|label|accessibility)\\s+){0,4}(?:repairs?|fix(?:es)?)",
|
||||
"(?:added|inserted|supplied|provided|restored)\\s+(?:(?:a|the|missing|real|email|input|proper|accessible)\\s+){0,5}label",
|
||||
].join("|");
|
||||
const repairAction = new RegExp(`\\b${escape(repairWorker)}\\b(?:${repairGap}${repairModifier}){0,3}${repairGap}(?:${repairVerb})\\b|\\b(?:was|got|had been|has been)\\s+(?:repaired|fixed|completed|added|inserted|supplied|provided|restored)\\b[^.!?\\n]{0,40}\\bby\\s+${escape(repairWorker)}\\b`, "gi");
|
||||
const repairSuccess = /\b(?:pass(?:ed)?|succeed(?:ed)?|exit(?:ed)?(?:\s+with)?(?:\s+(?:code|status))?\s*[:=]?\s*0)\b/i;
|
||||
const repairs = clauses.flatMap(({ text, at }) => [...text.matchAll(repairAction)]
|
||||
.filter(match => repairSuccess.test(text.slice(match.index + match[0].length)))
|
||||
|
||||
@@ -131,6 +131,23 @@ it.each([
|
||||
const o = fixture(); o.reply = reply; expect(gradeWorkTimeline(o).passed).toBe(false);
|
||||
});
|
||||
|
||||
it.each([
|
||||
"Today UTC: Morgan's verification failed and work paused. You reassigned the task to Riley. Riley completed the repair and the check passed.",
|
||||
"Today UTC: Morgan's verification failed and work paused. You reassigned the task to Riley. Riley added the missing label and the verification passed.",
|
||||
"Today UTC: Morgan's verification failed and work paused, you reassigned the task to Riley, and Riley, successfully, added the missing email label and the check passed.",
|
||||
"Today UTC: Morgan's verification failed and work paused; you reassigned the task to Riley; Riley: completed the label repair and the check passed.",
|
||||
"Today UTC: Morgan's verification failed and work paused, you reassigned the task to Riley, and Riley, after the handoff, supplied the real label and the check passed.",
|
||||
])("keeps equivalent actor-owned repair descriptions valid: %s", reply => {
|
||||
const o = fixture(); o.reply = reply; expect(gradeWorkTimeline(o).passed).toBe(true);
|
||||
});
|
||||
it.each([
|
||||
"Today UTC: Morgan's verification failed and work paused, you reassigned the task to Riley, and Morgan completed the repair and the check passed.",
|
||||
"Today UTC: Morgan's verification failed and work paused, you reassigned the task to Riley, and Riley watched while Morgan added the missing label and the check passed.",
|
||||
"Today UTC: Morgan's verification failed and work paused, Riley added the missing label and the check passed, then you reassigned the task to Riley.",
|
||||
])("does not turn equivalent repair wording into wrong-actor or reversed-order credit: %s", reply => {
|
||||
const o = fixture(); o.reply = reply; expect(gradeWorkTimeline(o).passed).toBe(false);
|
||||
});
|
||||
|
||||
it("admits the selected live timeline metadata without invoking fixture callbacks", async () => {
|
||||
const descriptor = findChatCatalogCase("activity.work-timeline")!;
|
||||
const implementation = workTimelineCases[0]!;
|
||||
|
||||
Reference in new issue
Block a user