UI TestEngine: pressButton/writeValue return status string (empty=OK)#5976
Merged
Conversation
Refactor `Control::pressButton` / `writeValue<T>` from `Expected<void>` to `Expected<std::string>` — empty on success, non-empty `"disabled[: <reason>]"` on silent no-op. Hard errors (path/type/range) still go through `unexpected`. Python binding logs the status and does not throw (restores pre-#5961 silent contract that `test_all_scens` relies on); MCP handler translates non-empty status into a thrown `runtime_error` so its error wire-format stays identical. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fedr
approved these changes
Apr 24, 2026
oitel
approved these changes
Apr 24, 2026
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
PR #5961 conflated "widget is disabled" with "caller error" by turning the disabled case into an
Expectedfailure. That broke the internaltest_all_scensscenario runner — the Python binding'sexpectedValueOrThrowraised inside the GUI-thread callback and the process landed onstd::terminate(exit 6). #5968 narrowed theblockedheuristic but left the silent-to-error semantic intact.This PR cleanly separates the two axes:
Control::pressButton/Control::writeValue<T>now returnExpected<std::string>. Empty string on success (click / write simulated). Non-empty string ("disabled[: <reason>]", same vocabulary ascomposeStatus) when the widget was drawn disabled — in that case the simulation is a silent no-op.unexpected(...)is reserved for hard errors only: path not found, wrong entry kind, value out of range / not inallowedValues.mrviewerpy.uiPressButton/uiWriteValue) logs non-empty status viaspdlog::warnand does not throw on disabled — pre-UI TestEngine: expose disabled/blocked state on entries #5961 silent contract restored.std::runtime_errorwith the same"pressButton <path>: disabled: <reason>"wire-format as before, so LLM-facing behavior is unchanged.readValue,listEntries,listAllEntries, and theTypedEntry::statusfield are untouched.Test plan
ui.pressButtonon a disabled entry (QuickAccess/Undo) → thrown error"pressButton QuickAccess/Undo: disabled: Nothing to undo."(wire format byte-identical to pre-fix).ui.pressButtonon an enabled entry → empty-JSON success.ui.writeValueRealon an enabled float field → empty-JSON success.ui.pressButtonon a non-existent path → hard-error propagates throughunexpected(...)as before.test_all_scensscenario — left for CI.🤖 Generated with Claude Code