Skip to content

v0.3.88 — No more silent Safe Mode waits; scenarios with optional steps

Choose a tag to compare

@FoxsterDev FoxsterDev released this 09 Nov 20:01
· 40 commits to main since this release

Why this matters

When a script change broke compilation and the editor was opened afterwards, ensure-ready waited out its whole timeout on Unity's "Enter Safe Mode?" dialog and then suggested polling again. In one session that took 900 s, while status_summary already knew the editor was stuck on the dialog. A recovery after a frozen heartbeat could also close a live editor without a save prompt.

Scenarios had their own false failures:

  • a best-effort "close the popup if it is there" click failed the whole run when there was nothing to close;
  • a click that opened a popup a few frames later read as "no effect";
  • a project_refresh right after a hook that changed scripting defines always timed out.

What changed

Editor startup and compile state

  • The startup wait stops on the dialog. ensure-ready recognises the "Enter Safe Mode?" dialog while it waits, using the same signs as status_summary: a live editor, compile errors written during the wait, no bridge, and an Editor.log that has been quiet for 20 s. It then ends as editor_startup_modal_blocked, with the compiler error line and a recovery command: quit, batch compile, reopen. A log that is still moving, or a bridge that attaches, keeps the wait going.
  • A closed editor is not opened on red code. The package now saves a snapshot of the compile inputs and the last compile result. With the editor closed, ensure-ready --open-editor and recover-editor-session compare the current files with that snapshot. If the code changed or the last compile failed, they run a batch compile first and refuse to open the editor when it is red (editor_open_refused_compile_red). A touched file whose content did not change opens without the probe. Pass --compile-preflight off to skip it.
  • status_summary no longer shows a false zero. Without a live bridge, it no longer shows compiler_error_count: 0 beside an Editor.log full of errors. It reports compile_state: unmeasured and lists the errors seen in the log as an observation, never as a compiler count.
  • The compile gate notices a fix in another file. It now sees fixes in any compile input, not only in the file named in the error.
  • A live editor is never closed by recovery without permission. recover-editor-session closes a live editor only with --force-terminate.
  • A dead editor's old state no longer reads as healthy.
  • unity_ensure_ready brings the same command to the MCP surface.

Scenarios

  • Optional steps. Scenario ui_click, ui_exists and ui_get_text take optional: true. Suppose an optional click is refused before delivery because the target is missing, hidden or covered, or a read step's complete search finds nothing. The step then becomes skipped_optional_absent and the run can still pass. Every other failure still fails.
  • Waiting for a delayed change. waitForTreeChangeMs on unity_ui_click and the scenario ui_click step keeps checking the UI on later editor frames, so a popup that appears a few frames after the click counts.
  • Refresh after a define-changing hook settles. The domain reload used to drop the refresh's request id, so the step waited for an id that no longer existed. It now settles once the editor is idle after the reload.
  • The decision verdict keeps the right failure label. It no longer relabels a failed run as playmode_throttled because an earlier Play Mode step was throttled.
  • The compact unity_scenario_run_and_wait result is smaller. It lists only failed and skipped-optional steps and counts the rest. A 20-step passing run dropped from about 13 KB to about 2 KB.

What this gives developers

  • A broken compile at editor startup surfaces in seconds with the error line and the next command, instead of a long silent wait.
  • Opening a closed project on code that does not compile is refused before Unity reaches the Safe Mode dialog.
  • Scenarios can dismiss popups "if present" without turning every run red, and asynchronous popups no longer need expectStateChange: false as a workaround.
  • Smaller scenario results on the default path.

Validation

  • Host Python suite: 1386 tests passed, 14 platform skips.
  • Package self-tests in clean generated projects, package from local source, macOS:
    • on Unity 2021.3.58f1, 2022.3.62f3, 6000.0.58f2, 6000.1.13f1, 6000.2.14f1, 6000.3.23f1, 6000.4.4f1, 6000.5.10f1 and 6000.6.0b3: EditMode core 229/229 and PlayMode core 6/6;
    • on 2021.3.58f1 also TextMeshPro 6/6, uGUI 69/69, and PlayMode uGUI with 22 passed and 6 skipped.
    • The first 2021.3.58f1 run failed one new uGUI test. That was a test-loop issue with Test Framework 1.1; the test was fixed and the rerun passed.
  • Safe Mode wait, live on Unity 6000.0.58f2 with a script that did not compile and the editor closed:
    • with --compile-preflight off, the wait ended as editor_startup_modal_blocked after 25 s (38 s on a larger project, where the previous version waited 900 s);
    • with the preflight on, the open was refused after 5 s and no editor started;
    • after the error was removed, the editor opened healthy.
  • Scenario refresh after a define-changing hook, live on Unity 6000.0.58f2 with the editor unfocused: before the fix, 4 of 4 runs timed out; after it, 3 of 3 settled in about 3.5 s.

Known limitations

  • Unity Package CI remains waived (no runner Unity license); the local licensed runs above are the package evidence.
  • Live Unity runs were on macOS only. Windows and Linux are covered by host tests and CI.
  • The closed-editor preflight needs the snapshot written by this package version. The first ensure-ready after upgrading a project opens without it.
  • An editor that was already stuck on a dialog before ensure-ready started is diagnosed by status_summary. In that case ensure-ready points there rather than raising editor_startup_modal_blocked itself.
  • A delivered optional click that fails expectStateChange still ends the run as inconclusive.
  • Optional steps and the click wait have not yet been run against a real project's scenarios.