Skip to content

chore(recorder): mint page aliases in the language generators#41728

Open
dgozman wants to merge 3 commits into
microsoft:mainfrom
dgozman:chore-recorder-page-alias
Open

chore(recorder): mint page aliases in the language generators#41728
dgozman wants to merge 3 commits into
microsoft:mainfrom
dgozman:chore-recorder-page-alias

Conversation

@dgozman

@dgozman dgozman commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #41727 (which is stacked on #41725) — the first two commits belong to those PRs and will disappear from this diff once they merge.

Summary

  • The recorder no longer names the pages of the generated source code. Actions and signals carry only pageGuid; each language generator lazily mints page, page1, … into its own pageGuid -> alias map, cleared by a new LanguageGenerator.reset() that generateCode() calls.
  • PopupSignal.popupAlias was literally the popup page's own pageAlias, so it becomes popupPageGuid and resolves through the same map.
  • FrameDescription held nothing but pageGuid once the alias was gone, so it is inlined into ActionInContext/SignalInContext.
  • Drops Recorder._pageAliases, _lastPopupOrdinal, _describeMainFrame, mainFrameForAction(), C#'s _formatPageAlias(), and the pageAlias parameter of RecorderSignalProcessor.signal().

Generated output is unchanged. JSONL records now carry pageGuid only.

ProgrammaticRecorderApp generates one action at a time against a long-lived generator, so it calls generateAction() directly rather than generateCode(), which would reset the alias map on every action.

dgozman added 3 commits July 10, 2026 11:10
Remove `FrameDescription.framePath` and instead prepend the chained frame
selectors, separated by `internal:control=enter-frame` tokens, straight
into `action.selector`. `asLocator()` already renders that token as
`contentFrame()`, so the four language generators no longer need to build
the frame chain by hand.

Also fixes `JsonlLocatorFactory.chainLocators()` clobbering an existing
`next` chain, which dropped the `frame` step from JSONL output.
Remove `ActionBase.preconditionSelector`. The injected recorder now passes
the precondition selector to the server as a separate binding argument, and
the server turns it into an `ExpectSignal` routed through the signal
processor, so it attaches to the preceding action like any other signal.

Each language generator renders the signal itself, appending an
`assertVisible` after the action it is attached to. `generateAction()` now
receives `LanguageGeneratorOptions` so generators can honour
`generateExpectSignal`, renamed from `generateAutoExpect`.
The recorder was naming the pages of the generated source code (page,
page1, ...) and stamping the name onto every action. Drop it: actions and
signals now carry only `pageGuid`, and each language generator lazily mints
its own aliases into a pageGuid -> alias map, cleared by a new `reset()`
that `generateCode()` calls.

`PopupSignal.popupAlias` was the popup page's own alias, so it becomes
`popupPageGuid` and resolves through the same map. `FrameDescription` held
nothing else, so `pageGuid` moves onto `ActionInContext`/`SignalInContext`
directly, and `mainFrameForAction()` goes away — the caller already has the
frame the action came from.
@dgozman dgozman requested a review from Skn0tt July 10, 2026 12:48
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chromium] › mcp/annotate.spec.ts:447 › should switch screencast to -s session on show --annotate @mcp-macos-latest-chromium
❌ [firefox] › mcp/annotate.spec.ts:110 › should abort annotation when last screenshot is removed @mcp-macos-latest-firefox
❌ [msedge] › mcp/annotate.spec.ts:292 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest-msedge

7757 passed, 1249 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 flaky ⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`

49531 passed, 1161 skipped


Merge workflow run.

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