Repository navigation
fix(flow): let the strict UIA census pass a password field it cannot match - #2767
Conversation
…match Since #2291 the strict census stopped at any control whose IsPassword was True, wherever it sat on the desktop. The read endpoint then reported the cut-short census as match=ambiguous, reason=not_unique with whatever it had found so far. In the hosted Patient Notes test the window holds one patientHeader and a planted password box, so every structural read refused as "ambiguous, candidate_count=1, not_unique". An affirmatively protected control (IsPassword True, or a native password edit) is now ruled out from AutomationId and control type alone when the locator's id or role cannot match it and it has no subtree. Its Name and value are never read. A locator that could still name it, an unreadable selector, any unknown sensitivity status, or a second real match still refuses as before. A census cut short now reports reason=census_incomplete instead of not_unique, so a single candidate no longer reads as a duplicate.
Independent adversarial review: APPROVEFrom: Grok The change is narrow. A node is skipped only when two conditions both hold. First, the helper gives an affirmative password verdict: Adversarial probes (temporary local pytest file, synthetic controls, exact head): 22 passedIn every case below, the census still stops with
Tests and checks (Linux, py3.12, exact head)
Generality gate: The repository has no section named "Generality gate", so I applied the flow CONTRIBUTING rule "App knowledge lives in data" and whole-class testing. Point 1 passes: there are no app names, the rule is keyed on UIA sensitivity evidence and locator fields, and CI at this head (15:10 UTC): 26 passed, 22 skipped, 1 failed. In Limits, and what I could not run on Windows: I have no Windows host. I did not run the e2e Windows tests locally, real UI Automation providers, real |
Problem
windows replay (Patient Notes, WindowsBackend)failstest_native_editable_values_and_runtime_type_retrywith(for example run 46214956282, attempt 2, which failed after 8 s on the first
structural read,
_wait_label("patientHeader")).Root cause
Two things combine:
_find_candidatescallsrequire_non_sensitive_structureon every node ofthe desktop. A control with
IsPassword=Trueraises (PROVIDER_REFUSAL),so the whole census returns
truncated=True, whatever the locator is. Thetest's
OBSERVATION_HOOKadds aUseSystemPasswordChartext box(
leasePassword) to the same window, so every read stopped there, even aread of the unrelated
patientHeaderlabel. The same would happen on anylogin form or other screen that has a password field.
/uia/readsetmatch = "ambiguous" if found or truncatedand always usedreason = "not_unique". One candidate found before the stop therefore cameback as
ambiguous / 1 / not_unique, which is the contradictory message.#2291's own Windows job never reached this test (the lease test timed out
first), so this got through.
Fix
IsPasswordis True, or thenative edit has a password style,
EditEvidence.PROTECTED), the census readsonly its
AutomationIdand control type. Neither is field content. Thecontrol is skipped only when the locator's automation id or role provably
cannot match it and it has no subtree. Its Name and value are never read.
role+name only)
native-edit outcomes)
reason="census_incomplete".matchstays"ambiguous", so the wire vocabulary and the client's refusal are unchanged.The e2e helper now shows that reason.
Tests (
tests/test_structural_value_completeness.py)The bug condition: one target next to a password field (both
IsPassword=Trueand the native-protected path) returnsunique / 1with acomplete value, and the password control's Name and value are never read. A
password field of a different role is also skipped.
Still refuses:
Each returns
ambiguous / 1 / census_incompletewith the originalsensitivity trace stage, and never reads Name or value.
Real ambiguity: two matching controls next to a password field still
return
ambiguous / 2 / not_unique, with no point, preview or value.Against the unfixed server, the new bug-condition tests fail.
Checks run
pytestover every non-e2e flow test that touches the Windows agent,backend or native value code: 1637 passed, 11 skipped. Two modules failed to
import because optional deps are missing locally (
benchmark.choice_widgets,openenv.core), unrelated to this change.ruff checkandruff format --checkon the modified files: clean.mypy --follow-imports=silentonserver.py: clean.check_engine_generality.pyOK,check_verdict_folds.pyOK.Not fixed here
In the most recent runs on #2758, #2759 and #2761, the job fails earlier:
test_native_keyboard_lease_actual_delivery_and_refusalhangs on an agent HTTPread until pytest's 600 s timeout (at a different line each run: 519, 530,
543, 572, 598). That is a separate problem, so the editable test never ran in
those runs. The Windows job may stay red on that timeout until it is fixed
separately.