Skip to content

Commit 3b98c12

Browse files
committed
test(ios): pin the completion rule's residual provenance on both sides (#2634 review)
Adds the reviewer-requested classifier-table pair: baseline "12" refuses "12 567 8" for request "5678", while an absorbed residual (baseline "12", observed "(555) 123-4567") completes because every extra is punctuation the baseline cannot explain. The evidence level gains the same positive, so the rule is pinned as keyed on extra provenance, not baseline emptiness. Tightens the completion predicate's doc to match.
1 parent 9ef444a commit 3b98c12

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+TextEntryConfirmation.swift‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ extension RunnerTests {
6565
}
6666

6767
/// Whether the request plus inserted formatting explains the WHOLE of `observed`: every request
68-
/// character in order, every remaining character outside it explainable only as an insertion —
69-
/// not a character of the request (an ambiguous embedding may be a dropped-and-shifted copy)
70-
/// and not a character of the post-clear `baseline` either, since a partial clear's residual
71-
/// text may sit anywhere a mask relocates it — and at least one insertion strictly BETWEEN the
72-
/// request's first and last characters, because entry cannot insert between two characters the
73-
/// same burst typed while a failed clear's residual may only be appended or prepended
74-
/// (`"old123456"` stays an echo). The embedding is the leftmost one, so a doubled entry (`"66"`
75-
/// for `"6"`) leaves its surplus at the ends; a mask inserting a request character (`.` for a
76-
/// decimal value) falls back to the echo reading; a one-character request has no between.
68+
/// character in order under the leftmost embedding, every unconsumed character explainable as
69+
/// neither a character of the request (an ambiguous embedding may be a dropped-and-shifted
70+
/// copy) nor of the post-clear `baseline` (any baseline character in the value is failed-clear
71+
/// residual, wherever a mask relocated it), and at least one insertion strictly BETWEEN the
72+
/// request's first and last characters — entry cannot insert between two characters the same
73+
/// burst typed, so end-only insertions (`"old123456"` for `"123456"`) stay echoes. A doubled
74+
/// entry (`"66"` for `"6"`) leaves its surplus at the ends; a mask inserting a request
75+
/// character (`.` for a decimal value) falls back to the echo reading; a one-character request
76+
/// has no between.
7777
static func textValueCompletesRequest(observed: String, request: String, baseline: String) -> Bool {
7878
guard !request.isEmpty, request != observed, request.count > 1 else {
7979
return false

‎apple/runner/AgentDeviceRunner/AgentDeviceRunnerUITests/UnitTests/RunnerTests+TextEntryConfirmationTests.swift‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ extension RunnerTests {
5151
XCTAssertFalse(Self.textValueCompletesRequest(observed: "$0.05", request: "5", baseline: ""))
5252
XCTAssertFalse(Self.textValueCompletesRequest(observed: "1.234.5", request: "12.5", baseline: ""))
5353
XCTAssertFalse(Self.textValueCompletesRequest(observed: "anything", request: "", baseline: ""))
54+
// A partial clear's residual is never an insertion: baseline "12" explains the leading
55+
// "12", so the spaces cannot make "12 567 8" (holding 125678) a completion of "5678".
56+
XCTAssertFalse(Self.textValueCompletesRequest(observed: "12 567 8", request: "5678", baseline: "12"))
57+
// Its closest positive: residual fully absorbed by the embedding, where every extra is
58+
// punctuation the baseline cannot explain — the value is request + formatting after all.
59+
XCTAssertTrue(Self.textValueCompletesRequest(observed: "(555) 123-4567", request: "5551234567", baseline: "12"))
5460
}
5561

5662
func testDigitCountSummaryThatMovedOffItsBaselineIsUnconfirmed() {
@@ -172,6 +178,17 @@ extension RunnerTests {
172178
)
173179
)
174180

181+
// The rule keys on whether the baseline explains an extra, not on baseline emptiness: here
182+
// the residual "12" is absorbed into the request's own digits and every extra is
183+
// punctuation, so the value is fully explained by request + formatting and discloses.
184+
XCTAssertNotNil(
185+
Self.unconfirmedTextEntryEvidence(
186+
requested: "5551234567",
187+
baseline: Self.otpObservation("12"),
188+
observed: Self.otpObservation("(555) 123-4567")
189+
)
190+
)
191+
175192
// The refusals, each the completion positives' closest negative. Note the shape they share:
176193
// every one of them is still an echo — a value that could be a degraded copy — which is the
177194
// only refusal this path now makes. Values that match no echo clause at all (a digit lost

0 commit comments

Comments
 (0)