Repository navigation
port edit-suggestions BRAT tests to Playwright (4 of 5) - #17705
Merged
Merged
Conversation
Adds tests/panes/editor/edit_suggestions.test.ts. Drives the IDE's deterministic .rs.api.showEditSuggestion injection via typeInConsole and asserts on AceEditor.getTokens/getLine. Four of the five BRAT tests pass: - ghost text suggestions can be prefix-matched - ghost text moves on document edit - ghost text is cleared from old row when newline inserted above - edit suggestions render inline when appropriate "ghost text suggestions survive document mutations" is test.fixme: after typing the first char into an editor with an active ghost-text suggestion, subsequent chars route to the console (typeSlowly and per-char focus re-claim don't help). editor.insert() bypasses focus but leaves the NES anchor stuck at the original document position. The BRAT counterpart for that one case is retained until the focus bug is unblocked. Adds AceEditor.getLine and an optional synthetic field on AceToken so the synthetic-token check can be expressed directly.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
3 of 5 tasks
kevinushey
added a commit
that referenced
this pull request
May 21, 2026
* port path-based guardrails BRAT tests to Playwright
Adds chat-guardrails-paths.test.ts covering 27 tests from
test-automation-guardrails.R: read denials (~/.aws/credentials, ssh,
.env/.Renviron/.Rprofile variants, etc.), read allows (SSH pubkey,
normal files), write denials (outside project, ~/.ssh, file.create /
file.remove / unlink / file.copy / file.rename), write allows (tempdir),
connection denials (file() to sensitive paths, deferred-open variant),
error-message structure (Action/Path/Reason fields), system-file
denials (/etc/passwd, /etc/shadow), and path traversal.
Drives the guardrails directly via .rs.chat.injectBindings() /
.rs.chat.restoreBindings() through a one-shot .rs.test.guardrails(quote(...))
helper installed in beforeAll. Each test runs `pre; helper(...); post` as
one console submission, batching plant/guard/cleanup, and polls for an
R-runtime-generated marker (won't match the input echo) instead of
sleeping. Run time is ~1.3 min for the 27 tests vs ~3.2 min with the
naive blind-sleep design.
Trimmed test-automation-guardrails.R to the 4 binding-lifecycle tests
that stay in BRAT: .rs.chat.safeEval returns errors as conditions rather
than printing them to the console, so the "blocked in console" pattern
the Playwright tests rely on doesn't apply to safeEval/double-inject
coverage. Tracking note added inline.
Side fix: rstudio.fixture.ts:beforeEach was calling
`page.locator(DONT_SAVE_BTN).click({ timeout: 2000 })`, which polls for
the full 2s in the (overwhelmingly common) no-dialog case, adding ~2s
of dead wait to every test. Replaced with `isVisible()` + `waitFor({
state: 'hidden' })` -- no implicit wait when nothing is there, positive
signal when there is.
Migration doc updates: corrects the console.R and data-viewer.R rows
that earlier PRs reverted back to "Partial" via bad merge conflict
resolution; refreshes the summary stats and the "remaining waves"
section to reflect the current state (24 Complete / 4 Partial / 3
Dropped / 1 Fixme).
* port portable rmarkdown and quarto BRAT tests to Playwright
rmarkdown_chunks.test.ts: 7 tests (1 test.skip) covering the
non-skip_on_ci subset of test-automation-rmarkdown.R -- warn-option
round-trip, chunk-widget visibility, error-halt, command-history-after-
error (#16006), patchwork S3-method dump (#13470), paged-table auto vs
explicit (#16483). nb.html-on-save is `test.skip`'d -- `saveSourceDoc`
via the `executeCommand` bridge doesn't trigger nb.html generation;
needs follow-up to understand whether the console path is doing
something the bridge isn't.
quarto_chunks.test.ts: 4 tests covering the non-skip_on_ci subset of
test-automation-quarto.R -- warn-option round-trip on .qmd, chunk-
widget visibility (#11745), variable-width nested-chunk folding
(#15191) via the existing AceEditor wrapper, empty-quarto-block
highlight regression (#16463).
Both new files use the `executeCommand` rstudioCallbacks bridge for
chunk runs instead of `typeInConsole(".rs.api.executeCommand(...)")`
-- the latter pollutes console history, which breaks the
history-after-error test (Up-arrow walks back through the typed
command strings instead of the chunk code).
The 10 skip_on_ci rmarkdown tests (visual-mode round-trips, chunk-
options popup UI) and 7 skip_on_ci quarto tests (visual-mode +
chunk-options popup + doc outline) are dropped along with their BRAT
files. Porting them would need a chunk-options modal helper and a
visual-mode round-trip helper.
Migration doc updated: rmarkdown and quarto now Complete; summary
stats refreshed; remaining-work section rewritten.
* drop orphaned BRAT helper-pane-layout.R
The helper was sourced by test-automation-tabs.R and
test-automation-chat-satellite.R, both of which were deleted in earlier
migration PRs. No remaining BRAT file references it, so the helper is
unused -- removing.
* doc: reflect helper-pane-layout.R removal
* delete remaining BRAT files; add test.fixme stubs for the 6 unported cases
The last three BRAT files (debugger, edit-suggestions, guardrails) had
2-4 tests each retained because they didn't fit the existing Playwright
porting patterns. Rather than keep BRAT alive for those, drop the files
and convert each retained case into a test.fixme placeholder in the
Playwright file that would naturally host it:
- chat-guardrails-paths.test.ts: 4 fixmes for the binding-lifecycle
tests (.rs.chat.safeEval auto-restore, double-inject reentrancy
guard, safeEval blocks writes outside project, safeEval restores on
user error). These ARE portable -- the natural form checks
file.exists() or a follow-up write succeeding rather than the
"blocked in console" pattern -- but they were left as TODOs so the
next person can verify them end-to-end before un-fixme-ing.
- debugger_extras.test.ts: 2 fixmes for the package-build cycle
tests (#15201 and the #9450 package-rebuild half). Each needs a
full `devtools::build()` invocation, which takes ~minutes and
doesn't fit the current fixture model. The BRAT comments are
preserved so the next port has a starting point.
- edit_suggestions.test.ts: already had its test.fixme since #17705
(`ghost text suggestions survive document mutations`); the BRAT
counterpart is now removed.
Migration doc updated: BRAT files remaining = 0; the per-file table
flips debugger / edit-suggestions / guardrails to Complete (with the
fixme counts called out explicitly); the "Remaining" section is now
an inventory of the Playwright TODOs rather than BRAT TODOs.
The Wave 6 decommissioning checklist items (CLI flags, R helpers,
`.claude/CLAUDE.md` BRAT references, the `reference_brat_automation.md`
user memory) are not in this commit -- those land in a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds `tests/panes/editor/edit_suggestions.test.ts` covering the IDE's deterministic edit-suggestion injection path (`.rs.api.showEditSuggestion`). Four of the five BRAT tests in `test-automation-edit-suggestions.R` ported and green:
The fifth test ("survive document mutations") is `test.fixme`. After typing the first char into an editor with an active ghost-text suggestion, subsequent chars route to the console:
Worth filing as a real focus bug -- a fast-typing user during a suggestion would hit the same thing. BRAT counterpart for that one test is retained until it's unblocked.
Also exposes `AceEditor.getLine(row)` and an optional `synthetic` field on `AceToken`, so the synthetic-token check ("old row no longer has a synthetic token") can be asserted directly.
Test plan