diff --git a/tests/runner-e2e/chat-catalog-domains/external-team-conditional.test.ts b/tests/runner-e2e/chat-catalog-domains/external-team-conditional.test.ts index 5b3366bde09..dac5669763e 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-team-conditional.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-team-conditional.test.ts @@ -452,3 +452,21 @@ it.each(["recovered", "missing"] as const)("does not let later collision history expect(gradeTeamConditions(o, phase === 0 ? "initial" : "complete").passed).toBe(false); } }); + + +it.each(["recovered", "missing"] as const)("checks a coordinated current assertion after history when state is %s", state => { + for (const phase of [0, 1]) { + const o = state === "recovered" ? recovered().o : valid(); + const body = state === "recovered" + ? "Launch Checklist was not installed earlier, and it is still missing now." + : "Launch Checklist was unavailable earlier, and it is installed now."; + o.phaseReplies[phase]!.body = "The existing CTO was preserved and the imported role is CTO 2. " + + (state === "missing" ? "Launch Checklist's slug is occupied. " : "") + body; + expect(gradeTeamConditions(o, phase === 0 ? "initial" : "complete").passed).toBe(false); + } +}); +it("preserves a fronted historical adverb on the named skill assertion", () => { + const { o } = recovered(); + o.phaseReplies[0]!.body = "The existing CTO was preserved and the imported role is CTO 2. Earlier, Launch Checklist was not installed."; + expect(gradeTeamConditions(o, "initial").passed).toBe(true); +}); diff --git a/tests/runner-e2e/chat-catalog-domains/external-team-conditional.ts b/tests/runner-e2e/chat-catalog-domains/external-team-conditional.ts index e3cd1460424..cb29b0f1fe0 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-team-conditional.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-team-conditional.ts @@ -181,13 +181,13 @@ function namedTeamSkillClauses(reply: string, skill: Pick text.trim()).filter(Boolean)) { + for (const rawClause of paragraph.split(/[.!?;\n]+|(?=\bbut\b)|(?=\band\s+(?:(?:it|(?:this|that) skill)\s+)?(?:is|are|was|were|remains?|has|have|could|can)\b)/i).map(text => text.trim()).filter(Boolean)) { const coordinated = /^(?:but|and)\b/i.test(rawClause); const clause = rawClause.replace(/^(?:but|and)\s+/i, ""); const named = names.some(name => clause.toLowerCase().includes(name)); const reference = /^(?:it|(?:this|that) skill|(?:the )?(?:collision|conflict|caveat))\b/i; const pronoun: boolean = previousNamesTarget && reference.test(clause); - const elidedSubject: boolean = coordinated && previousNamesTarget && /^(?:is|are|remains?|has been)\b/i.test(clause); + const elidedSubject: boolean = coordinated && previousNamesTarget && /^(?:is|are|was|were|remains?|has|have|could|can)\b/i.test(clause); if (named || pronoun || elidedSubject) bound.push(pronoun ? clause.replace(reference, skill.name) : elidedSubject ? skill.name + " " + clause : clause); previousNamesTarget = named || continuePronouns && (pronoun || elidedSubject); }