One way to do each of the things the driver was doing several ways - #100
Merged
Conversation
Cleanup only; behaviour is unchanged everywhere except one message that is now built later than it was. Reading rendered text was written out three times - for the review, the whole window, and the status bar - identical but for the root element. One VisibleText holds it, and the three callers keep the doc comments that say why each wants a different root. The select-all wait built its failure message eagerly, so two full walks of a thousand result rows ran on every passing call, and an automation call sat unguarded inside a message. WaitUntil gained an overload taking the message as a function, evaluated only on failure and routed through Safely. That is the same hazard the suite documents for its own Check. "Has the run ended" had two spellings, one named and one inlined in the cancel probe; FinalConversionStatus now answers it once and ConversionHasFinished is the null test over it. ResultCount hand-rolled what ResultItems already does, including an is-var pattern that always matched. The safe status read was inlined at three failure sites and now has the name its sibling DescribeWindowsSafely already had. SetToggle's confirmation refetched the toggle pattern each poll instead of reading the one it holds. Two comments described code that is no longer there: the idle-wait remark still warned about the defect the parameter below it fixed, and an inline comment restated the remark six lines above it. Not done, and why: caching the status bar or results list element would remove a whole-window walk from every 50 ms poll, but a stale held element is exactly the hypothesis EC-28 is open on, so adding more of them now would be reckless. Provider-side ControlType filtering and a narrower scope for the review lookup would both be cheaper, but they change UIA query semantics on the timing- sensitive path whose margin is a tracked number. EC is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Cleanup pass over
EcGuiDriver.cs, which has been edited across six commits inthree pull requests, so duplication that spans those edits was invisible to any
single diff. Behaviour is unchanged everywhere except one message that is now
built later than it was. No production code changes.
Fixed
Rendered text was read three ways.
ReviewText,StatusTextand the body ofStatusLinewere the same LINQ chain, identical but for the root element. OneVisibleTextholds it; the three callers keep the doc comments explaining whyeach wants a different root.
The select-all wait built its failure message eagerly. An automation call sat
unguarded inside a message - the one thing
Safelyexists to prevent, and thesame hazard
SmokeSuitedocuments for its ownCheck.WaitUntilgained anoverload taking the message as a function, evaluated only on failure and routed
through
Safely.It also did two full walks of a thousand result rows on every passing call, but
that is a correctness-of-diagnostics fix rather than a performance one: timing
--phase Ion both builds gives 7-8s against 8s, so the saving is about a second,and only in the one phase that has a thousand rows. Not a speedup worth citing.
"Has the run ended" had two spellings, one named and one inlined in the cancel
probe.
FinalConversionStatus()answers it once;ConversionHasFinished()is thenull test over it, and the stranded summary moved onto the member it describes.
Smaller:
ResultCounthand-rolled whatResultItemsalready does (includingan
is varpattern that always matches); the safe status read was inlined atthree failure sites beside a sibling wrapper that already had the name;
SetToggle's confirmation refetched the toggle pattern each poll instead ofreading the one it holds; two comments described code that is no longer there.
Deliberately not done
Caching the status bar and results-list elements would remove a whole-window walk
from every 50 ms poll - the single largest win available here. A stale held
AutomationElementis exactly the hypothesis EC-28 isopen on, so adding more of them while that is unexplained would be reckless.
Provider-side
ControlTypefiltering, a narrower scope for the review-windowlookup, and a handle-valued
PropertyConditionforFindWindoware all cheaper,but each changes UI Automation query semantics on the timing-sensitive path whose
cancellation margin is a tracked number.
Also skipped: collapsing the four process-scoped finders, where the
Children/Descendantsdifferences are load-bearing; extracting thereview-close prologue; and two larger structural changes - a first-class one-shot
attempt in the wait mechanism, and unifying
Safely/Ask/DescribeWindowsSafely.Evidence
EC-28 remains open; nothing here explains it.
🤖 Generated with Claude Code