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 24819424133..0b93c584aa3 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 @@ -260,3 +260,11 @@ it("does not credit resolved or all-ready claims as an unresolved occupancy repo expect(truthfulTeamPartial(body, skill)).toBe(false); } }); + +it("rejects a later same-skill current recovery claim while saved state still shows the required catalog skill missing", () => { + const o = valid(); + o.phaseReplies[0]!.body = "The existing CTO was preserved and the imported role is CTO 2. Launch Checklist's slug is occupied. Launch Checklist is now installed under another slug."; + expect(gradeTeamConditions(o, "initial").passed).toBe(false); + o.phaseReplies[0]!.body = "The existing CTO was preserved and the imported role is CTO 2. Launch Checklist's slug is occupied. The other three required skills 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 81693179276..2a706186271 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-team-conditional.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-team-conditional.ts @@ -266,7 +266,10 @@ export function truthfulTeamPartial( ) ); }); - return reported && !falseFull; + const subjects = [skill.slug, skill.slug.replaceAll("-", " "), skill.name] + .map(name => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"); + const currentRecovery = new RegExp("(?:\\b(?:" + subjects + ")[*_`]*|^(?:it|(?:this|that) skill))\\s+(?:skill\\s+)?(?:is|has been)\\s+(?:(?:now|already|currently)\\s+)?(?:installed|available|resolved|recovered)\\b", "i"); + return reported && !falseFull && !namedTeamSkillClauses(reply, skill, true).some(clause => currentRecovery.test(clause)); } export function gradeTeamConditions( o: ExternalObservation,