Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,14 @@ Not ported:

- The project's own tools (`defineTool`, `toModelOutput`), custom engines, mobile tools, and per-session telemetry.
- Redaction of what user code prints: a config is JSON, so no user code runs in the server.
- Opening a session without a config (tester-army/e2e#1665, `3c9de80`, issue #1509), not ported. Upstream's `open_session {engine, app}` lets a directory with no config file name an engine package (`@e2e-dev/web`) or a factory call (`{package, export, options}`), loads it from the project, beside e2e, or from `~/.e2e/engines`, and answers `ENGINE_NOT_INSTALLED` with an install command. The port's engines are built in code from a target's platform (`TargetEngines.Create`: `web`, `ios`, `android`, `windows`), and it has no engine packages to load. Loading a .NET assembly by name would run code the agent names with the server's full authority, which the port declines. So `open_session` still needs a config, and `CONFIG_NOT_FOUND` keeps the port's wording, with no `engine` hint. What is skipped, by upstream file:
- `packages/e2e/src/mcp/default-engine.ts` (the lookup, the factory calls among options, the `__proto__` key check, the import-only entries) and its unit test `mcp-default-engine.test.ts`.
- `packages/e2e/src/mcp/config.ts` `loadEngineConfig` and the `engine` hint of `locateProjectConfig`; `src/config/load.ts` `missingConfigError`'s `alternative` argument.
- `packages/e2e/src/mcp/session.ts` (`engine`, `app`, `configSource`, the engine session's origin line) and `sessions.ts` (the `ENGINE_DEFAULTS` config claim), and the server's `loadEngineConfig` wiring and instructions in `server.ts`.
- The upstream test cases: the engine case of `mcp-server.test.ts`, the engine cases of `mcp-session-host.test.ts` (`opens sessions on a named engine...`, `refuses ... before anything loads`), and the stub of `mcp-test-run.test.ts`.
- Error codes this skips: `ENGINE_NOT_INSTALLED` (never raised), `INVALID_ARGUMENT` for `engine` with `target`, `config`, or `test`, for `app` without `engine`, and for a config beside `engine`, and `INVALID_CONFIG` for a factory that is not a function or refuses its options. `CONFIG_IN_USE` keeps the port's wording, which upstream changed only for engine sessions; a session on the port's config never meets an engine session.
- `packages/mobile` `mobile()`'s platform check and `default` exports of `@e2e-dev/web` and `@e2e-dev/mobile` (and their two unit tests), since there is no package to default-export from.
- Docs and non-code upstream changed: `.changeset/mcp-engine-session.md`, `AGENTS.md`, `docs/mcp-server.mdx`, `docs/reference/mcp.mdx` (the "Without a config" section), `docs/reference/errors.mdx`, `docs/reference/security.mdx`, `docs/writing-an-engine.mdx` ("Open it by name"), and `skills/e2e` and `plugins/e2e` (SKILL.md and the mcp and debugging references). The port's docs describe no engine session, so none of them change.
- `e2e init` registers the server (see [Coding agents](#coding-agents)); by hand, use `claude mcp add e2e -- e2e mcp` or a `.mcp.json` entry.

## Agents
Expand Down
16 changes: 14 additions & 2 deletions tests/E2E.NUnit.Tests/McpTestRun/OpenSessionTestOverE2eMcpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public async Task Partial_Fails_a_test_on_a_promise_it_left_rejected_and_keeps_s
var left = await runner.RunAsync(assembly, typeof(SloppySessionFixture).FullName + "." + nameof(SloppySessionFixture.Leaves_a_promise_behind), CancellationToken.None);
Assert.That(left, Is.Not.Null);
Assert.That(left!.Failure, Is.Null);
SloppySessionFixture.LeftRelease.SetResult();
await Task.Delay(300);
await using (left.Session)
{
Expand All @@ -168,6 +169,8 @@ public async Task Partial_Fails_a_test_on_a_promise_it_left_rejected_and_keeps_s
Assert.That(early.Run!.End(), Is.Empty);
}

SloppySessionFixture.EarlyRelease.SetResult();

// .NET reports the faulted task when it is collected: look until it lands, as the host does for a few seconds after a close.
for (var look = 0; look < 40 && warnings.IsEmpty; look++)
{
Expand Down Expand Up @@ -386,13 +389,22 @@ public async Task Forgets_an_await()
await Expect.That(Screen.GetByLabel("Loads")).ToBeVisibleAsync();
}

/// <summary>
/// Released by the test once the run of "leaves a promise behind" has returned, so its rejection lands after the turn and not during it:
/// a timer of a fixed length races the run's own work on a slow runner.
/// </summary>
public static readonly TaskCompletionSource LeftRelease = new(TaskCreationOptions.RunContinuationsAsynchronously);

/// <summary>Released by the test once the session of "leaves a promise for after the close" has closed.</summary>
public static readonly TaskCompletionSource EarlyRelease = new(TaskCreationOptions.RunContinuationsAsynchronously);

[Test]
public async Task Leaves_a_promise_behind()
{
await App.OpenAsync("/browser");
_ = Task.Run(async () =>
{
await Task.Delay(50);
await LeftRelease.Task;
throw new InvalidOperationException("late failure");
});
}
Expand All @@ -403,7 +415,7 @@ public async Task Leaves_a_promise_for_after_the_close()
await App.OpenAsync("/browser");
_ = Task.Run(async () =>
{
await Task.Delay(1_000);
await EarlyRelease.Task;
throw new InvalidOperationException("later failure");
});
}
Expand Down
Loading