mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-10 12:37:55 +01:00
test(evals): bind named company secret completion recipients
Port only the reviewed company selector and focused controls from the e757 candidate successor. Keep ordinary completion language and the existing saved-binding proof. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
e757e44737
commit
1d1589ce89
2 files changed
+10
-1
No files matched your search
@@ -29,9 +29,16 @@ it("actual company act admits its safe question before private human entry",asyn
|
||||
await expect(companySecretExternalCases[0]!.act!(ctx,{currentPersonId:"person"})).rejects.toThrow("NEXT_REAL_HUMAN_PHASE");expect(reached).toBe(true);
|
||||
});
|
||||
it("accepts Done and completed-setup Yes without repeating the already-bound consumer",()=>{
|
||||
for(const label of ["Done","Yes"]){const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=label;expect(companySecretQuestionHandoff(row,binding)).toMatchObject({optionId:"yes"});}
|
||||
for(const label of ["Done","Yes","Done, ready to continue","Done for deployment"]){const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=label;expect(companySecretQuestionHandoff(row,binding)).toMatchObject({optionId:"yes"});}
|
||||
});
|
||||
it("rejects prospective Yes and negative or other-owner completion choices",()=>{
|
||||
const prospective=question();prospective.payload.questionSet!.questions[0]!.prompt="Would you like me to configure this?";prospective.payload.questionSet!.questions[0]!.options![0]!.label="Yes";expect(companySecretQuestionHandoff(prospective,binding)).toBeUndefined();
|
||||
for(const label of ["Not done","I didn't save it","I haven't added it","Done for Riley"]){const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=label;expect(companySecretQuestionHandoff(row,binding)).toBeUndefined();}
|
||||
});
|
||||
|
||||
it("keeps an explicit Morgan acknowledgement and rejects other named completion recipients",()=>{
|
||||
for(const [recipient,accepted] of [["Morgan",true],["CEO",false],["Jordan",false]] as const){
|
||||
const row=question();row.payload.questionSet!.questions[0]!.options![0]!.label=`Done for ${recipient}`;
|
||||
expect(!!companySecretQuestionHandoff(row,binding)).toBe(accepted);
|
||||
}
|
||||
});
|
||||
@@ -49,7 +49,9 @@ export function companySecretQuestionHandoff(value:unknown,b:SecretQuestionBindi
|
||||
const completedPrompt=/\b(?:have you|did you)\b[^?]*\b(?:saved|added|entered|bound|configured|completed|finished)\b/i.test(q.prompt);
|
||||
const choices=q.options!.filter(o=>{
|
||||
const answer=`${o.label} ${o.description??""}`;
|
||||
const recipients=[...answer.matchAll(/\b(?:[Ff]or|[Tt]o)\s+(?:the\s+)?(?:[Aa]gent\s+([A-Za-z][A-Za-z0-9_-]*)|([A-Z][A-Za-z0-9_-]*)|([Cc][Ee][Oo]))\b/g)];
|
||||
return (/\b(?:saved|added|entered|done)\b/i.test(answer)||(completedPrompt&&/^yes[.!\s]*$/i.test(answer.trim())))
|
||||
&&recipients.every(match=>/^Morgan$/i.test(match[1]??match[2]??match[3]??""))
|
||||
&&!/\b(?:not|never|cannot|can't|didn.t|haven.t|hasn.t|yet|need|later|will|would|Riley|another|their)\b|someone else/i.test(answer);
|
||||
});
|
||||
if(choices.length!==1)return;const option=choices[0]!;
|
||||
|
||||
Reference in new issue
Block a user