Skip to content

e2e: make AskUser answers explicit in the chat guardrail tests - #18379

Merged
gtritchie merged 3 commits into
mainfrom
test/chat-guardrails-affirmative-match
Jul 28, 2026
Merged

gtritchie merged 3 commits into
mainfrom
test/chat-guardrails-affirmative-match

Conversation

@gtritchie

@gtritchie gtritchie commented Jul 28, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #18372, which stopped the guardrail tests hanging when Posit Assistant pauses on an AskUser question. This makes the answers those tests give correct rather than incidental.

Test 5 (.env read) was failing. Asked to read .env, the assistant now pauses and offers to redact: "Show variable names only" (its recommended choice), "Show full contents anyway", "Check for a specific variable". No answer was configured, so the harness raised the fail-fast error added in #18372.

Answering with a redacting option would pass expect(response).not.toContain('abc123') on the assistant's own discretion, without the guardrail being consulted at all. The secret-read tests (5, 6, 8) now answer with the option that insists on the raw contents, so the assertion means what it claims: the guardrail denies the read even when the user asks for it outright.

Test 4's matcher was unanchored (/yes|proceed|move it/i). An option's accessible name is its label followed by its description, and the option set is written by the model, so a negative option phrased "No, don't proceed" or "No, don't move it" matches too. .first() resolves in DOM order, so a negative listed first would answer decline -- the file stays put, both assertions pass, and the guardrail is never exercised. Not reachable with the labels seen so far, so this one is latent.

Changes:

  • chat-guardrails.test.ts: SHOW_RAW_CONTENTS matcher for tests 5, 6 and 8; test 4's matcher anchored to /^(?:yes|proceed|go ahead|move it)\b/i. Anchoring also excludes the description from matching, since it never starts the accessible name.
  • chat_pane.actions.ts: answerPendingQuestion() fails with the offered option labels when nothing matches, instead of a bare click timeout. A too-narrow matcher should be a loud, diagnosable failure; the one thing it must never do is answer the opposite of what the caller intended.

Tests 6 and 8 were skipped by describe.serial after 5 failed, so their option labels are unobserved -- they get the same matcher on the assumption they elicit the same redact-or-not question. If the labels differ enough not to match, the failure names the options offered.

Test-only change; no NEWS entry.

Verification: npm run typecheck passes; the matchers were checked against the option labels captured in the failing run's snapshot.

@gtritchie gtritchie added this to the 2026.08 (Yellow Yarrow) milestone Jul 28, 2026
@posit-snyk-bot

posit-snyk-bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gtritchie gtritchie changed the title e2e: anchor the AskUser affirmative-answer matcher e2e: make AskUser answers explicit in the chat guardrail tests Jul 28, 2026
@gtritchie
gtritchie merged commit 3915190 into main Jul 28, 2026
1 of 6 checks passed
@gtritchie
gtritchie deleted the test/chat-guardrails-affirmative-match branch July 28, 2026 15:37
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
1882 0 365 3
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 469 0 87 2
✅ desktop-macos 464 0 94 1
✅ desktop-windows 474 0 90 0
✅ server-linux 455 0 94 0
✅ setup 20 0 0 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit cde3be38b7f8ffb9b6a69d1a36a72833c4cb7677 - Run #369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants