Skip to content

Switch the agent side and the tests from SemanticNode to EngineNode, then remove SemanticNode (#2581) - #2668

Merged
kblok merged 6 commits into
mainfrom
fix/2581-engine-node-agent
Dec 2, 2026
Merged

kblok merged 6 commits into
mainfrom
fix/2581-engine-node-agent

Conversation

@kblok

@kblok kblok commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Closes #2581

What this does

Every engine and the agent side now share one node type, EngineNode (upstream's SemanticNode), and the port's own SemanticNode class is gone. IEngineSession.PerformAsync, LocatorAction.DragTo, Screen, LocatorEngine, Expect, TestLines, FailureEvidence, the feed and the replay host take and return EngineNode; the Web, Document, Mobile, WinApp and Desktop engines build EngineNode directly; the EngineHandleAdapter conversions (SemanticNode.Of, Pair, ToNode) are replaced by one Rekey. NodeStates stays, since ExecutorNode.States is public API.

Value: one node shape from engine to assertion, as in upstream, with no per-call conversion and no second set of fields to keep in step.

Behavior changes worth a look:

  • A state the platform does not report is now null, not false. Role queries and Screen read null as "absent".
  • Frame is gone; a query under a node stops at a nested document by comparing FramePath lengths (LocatorResolver.EntersFrame).
  • The web engine reports Empty on located nodes with an empty box, so IsNodeVisible reads it as upstream does.
  • A selected WinApp radio reports Checked on the contract.
  • Docs: reference/engine.mdx and writing-an-engine.mdx describe EngineNode; COMPATIBILITY.md updated.

Upstream parity

Verdict: faithful. Upstream's SemanticNode (engine/contract.ts) has the same fields (nullable states, placeholder as an attribute). No new symbols besides LocatorResolver.EntersFrame and EngineHandleAdapter.Rekey (.NET-only: they replace the removed conversions).

.NET-only names: EngineNode (upstream's SemanticNode) and EngineNodeStates (upstream's SemanticNode.states, which has no named type). Both exist since #2497 and the owner's split of #2495 into #2580 and #2581 names the target type EngineNode: the port's own SemanticNode class held the upstream name until this PR removed it. The collision is gone now, so whether to rename them to upstream's names is a public API decision: #2677. No upstream tests were added or changed; this is internal.

  • Node fields and nullable states as upstream
  • Perform/Locate take and return the contract node
  • API reference pages not regenerated (see below)

Upstream tests and local match

None added or changed by this work; existing ported tests were converted to build EngineNode (same names, steps and assertions). Where a test asserted Assert.False(node.States.X) on a plain boolean, it now reads the nullable state with Assert.NotEqual(true, node.States?.X) (about 21 assertions in 11 files, mostly Desktop, WinApp and Mobile tests); an absent state is null, as upstream's optional states are.

Not done

Claude session: https://claude.ai/code/session_01Ls2e1zcZ5sYGFDZN9CDAwy


Generated by Claude Code

…then remove SemanticNode (#2581)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls2e1zcZ5sYGFDZN9CDAwy
…o states

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls2e1zcZ5sYGFDZN9CDAwy
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Passed 1

Check name Status Explanation
Upstream Parity Passed Applicability: The PR body names an upstream file, engine/contract.ts, as the home of upstream's SemanticNode. The check therefore applies. I read upstream packages/core/src/engine/contract.ts f…
Full details: Upstream Parity

Explanation

Applicability: The PR body names an upstream file, engine/contract.ts, as the home of upstream's SemanticNode. The check therefore applies. I read upstream packages/core/src/engine/contract.ts from tester-army/e2e. Its SemanticNode has the fields the PR describes: optional states, empty, and nullable flags. I found no failing condition. Rule 1 (names and places): The new or changed names are EngineNode, EngineNodeStates, EngineHandleAdapter.Rekey, and LocatorResolver.EntersFrame. The PR body names each one as .NET-only and gives a reason. EngineNodeStates has no upstream name because upstream's states type is inline, which is a valid .NET reason. The reason for EngineNode is weaker. It rests on the removed port class that held the name, and the PR says that collision is gone. The exemption as written in the check is met, so this is not a failure. The owner tracks the rename in #2677. Reviewers may still want to challenge that reason. Rule 2 (tests): The PR commit fc5ee54 adds no test files. It converts existing ported tests to EngineNode. About 21 assertions change from Assert.False(node.States.X) to Assert.NotEqual(true, node.States?.X). Upstream tests use the same form, for example states?.hidden).not.toBe(true) and toBeUndefined() in packages/web/tests/integration/read-node-checked.test.ts. No upstream commit is named, so the "each upstream it the commit adds or changes" clause has no target. Rule 3 (unnamed behavior): The changes are representation changes. Null for an unreported state, the Frame replacement, and Empty on web nodes all match the upstream contract. The WinApp radio Checked rule keeps the old logic. Upstream has no WinApp engine, but that engine predates this PR. Rule 4 (docs and COMPATIBILITY): COMPATIBILITY.md ("Engine node names"), reference/engine.mdx, and writing-an-engine.mdx are updated. Upstream's docs/reference/engine.mdx uses SemanticNode, so the port's mirror is in the right place. Neither skills/e2e-dotnet nor upstream's skills mention the node type, so there is nothing to mirror there. Note: the generated API pages under docs-site/src/content/docs/api/E2E.Engine/ (for example SemanticNode.md) are stale. The PR body states that regeneration is pending (#2667). These pages are generated reference, not guides, so they are not a failure under this check. Limits: The local origin/main ref is older than the PR base. I therefore scoped the review to the PR-specific commits (fc5ee54, 6c86055, and related) and the current tree. I did not verify each ported it against upstream because no upstream commit is named.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

kblok commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

CI on 6bab8a8: every test project passes (E2E.Tests 5543, Mobile, Cli, Desktop, WinApp, NUnit and the rest). The one red job step is the Darien sample (DaritenTests.The_dashboard_links_to_the_transaction_register, a real-model test in E2E.Sample and E2E.XUnit.V3.Sample). It also fails on main at 1c29c25 and on a re-run here, so it is not from this change. CodeRabbit skipped this PR because it has more than 100 files.


Generated by Claude Code

kblok commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

Re-ran CI on main's 0585b16 (before the EngineNode work): the Dariten sample fails there too now, so the red check on this PR comes from the live site, not from this change. Details on #2670.


Generated by Claude Code

kblok commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

The PR body now names EngineNode and EngineNodeStates as .NET-only with the reason, and #2677 tracks renaming them to upstream's names.


Generated by Claude Code

kblok commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

Pushed 6c86055: the code comment, reference/engine.mdx and a new COMPATIBILITY.md section name EngineNode and EngineNodeStates as .NET-only with the reason; #2677 tracks the rename.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

Switch the agent side and the tests from SemanticNode to EngineNode, then remove SemanticNode (#2495 split, c)

2 participants