Reviewer cross-check of 2ce59eb on real dumps found a Samsung sample where
the true bottom bar is a label-less 31px FrameLayout whose only text node
is zero-size ([0,0][0,0]). A whole-panel leaf scan fell through to the
next lowest labelled leaf, which lives in the PAYMENT-METHOD row directly
above the bottom bar ("使用#微信支付,更换先用后付可0元下单"), and the
climb-to-clickable-ancestor landed the click on "change payment method"
instead of the order button. That must never happen.
finalSubmitTargets is now a strict two-step "row, then leaf" pick instead
of a single whole-panel leaf scan:
1. Row: among visible/enabled/non-zero-size CLICKABLE nodes inside the
recognized panel's container with height <= 30% of screen height (the
guard from 2bc624f), pick the one with the lowest bottom edge; ties go
to the rightmost. This row, and only this row, may hold the order
button. If its own subtree matches a payment-method alias
(textAliases.specPanel.paymentAreaAliases: 微信支付/先用后付/支付方式) or
SUBMIT_TARGET_BLOCKED_MARKERS, fail explicitly (outcome=row_blocked) -
never fall back to a higher row.
2. Leaf: within that row's own subtree (or the row itself), among
visible/non-zero-size nodes with a non-blank own label whose nearest
clickable ancestor is EXACTLY that row, pick the bottom-right-most one
(unchanged rationale from 2ce59eb: PurchaseUiDriver.clickFresh re-finds
by preferredOrDescendantLabel()+className+center±32 before climbing to
the nearest clickable ancestor, so the target must carry a real label).
If the row has no such leaf, fail explicitly (outcome=bottom_row_unlabelled)
- never fall back to a higher row either.
hasFinalSavedAddressEvidence, finalConfirmation and submitOrderOnce still
all consume this one finalSubmitTargets.
Tests: SpecPanelFixtures.sheet(Sheet(submit = "hidden")) already models the
Samsung shape (31px hidden bottom bar above a real payment-method row) -
added a test asserting it now fails explicitly with no click, verifying
the payment row is never touched. Added a second test where the payment
row is itself the bottom-most clickable row (no submit region at all) and
must be rejected by its own alias match. Fixed readySheet() (used by the
address-save-wait test) to stop compounding liveShapedSheet()'s own hidden
31px placeholder with a separate real submit button - the two used to tie
and could flip which one the rightmost tie-break picked; it now builds the
same shape directly with submit="none" so "r/final" is the sole,
unambiguous bottom row. Updated one diagnostic key assertion (tie= ->
rowTie=) for the row-level tie-break. Every other #335 test (legacy
提交订单, 570 structure + ReFindingDriver re-find/climb, payment-word
blocked, outside-panel-container, no-determinable-container) passed
unmodified.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
Real-device result on build 0.9.62 (commit 34d09cd, task 594): the bottom
container was selected correctly but the click never happened.
GoAutoAccessibilityService.clickFreshDetailed re-finds its target live by
(preferredOrDescendantLabel() == target.label, className, center ±32) and
only THEN climbs to the nearest clickable ancestor and clicks it. The
previous finalSubmitTargets returned the clickable FrameLayout container
itself, whose SnapshotNode.label is "" (its text lives only in children),
while the live preferredOrDescendantLabel() digs into a child and returns
real text ("大促价,") - so the re-find always missed -> TARGET_NOT_FOUND ->
PURCHASE_ORDER_RESULT_UNKNOWN right after the irreversible boundary. No
order was created (user confirmed).
Per the user's restated strategy, finalSubmitTargets now aims at the
bottom-right-most VISIBLE, non-zero-size node that has a NON-BLANK OWN
LABEL within the recognized panel container, requiring it to have a
clickable ancestor (or be clickable itself) of non-zero size; ties go to
the rightmost. This is the same "aim at the labelled descendant, let
clickFresh climb to the clickable ancestor" convention already used by
ImageSearchCandidatePolicy.clickTargetInside for PDD image-search result
cards. The nearest clickable ancestor's subtree (not just the chosen
leaf's own subtree) must not contain SUBMIT_TARGET_BLOCKED_MARKERS, since
a payment word can live in a sibling leaf under the same clickable row.
hasFinalSavedAddressEvidence, finalConfirmation and submitOrderOnce still
all consume this one finalSubmitTargets, so the address-save evidence
check and the final click stay consistent.
Tests: added ReFindingDriver, a fake driver that emulates
clickFreshDetailed's real re-find + climb-to-clickable-ancestor semantics
against a fixed live node list, with a dedicated test on the task 570/594
structure that asserts the click actually lands on the clickable
FrameLayout container, not the labelled leaf finalSubmitTargets aimed at -
this is the class of test that would have caught the task 594 regression;
prior StaticDriver-only tests could not, since StaticDriver's clickFresh
just records target.label directly. Updated the existing 570 test and the
zero-size test to assert on the now-correct leaf-label target. Verified
every other #335 safety test (legacy 提交订单, tie/rightmost, payment-word
blocked, outside-panel-container, no-determinable-container) still passes
unmodified.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
Review follow-up on 2bc624f:
1. finalSubmitTargets' payment-word block only covered PAYMENT_MARKERS
(立即支付/确认支付/输入支付密码). The ticket also requires blocking 去支付
and 付款. These cannot join the shared PAYMENT_MARKERS list: it also
gates the global pageProblem() payment guard, and UNPAID_MARKERS' "待付款"
contains "付款", so adding it there would misclassify every ordinary
unpaid-order page as a forbidden payment page. Added a separate
SUBMIT_TARGET_BLOCKED_MARKERS list (立即支付/确认支付/去支付/付款/输入支付密码)
used only by finalSubmitTargets' bottom-node subtree check.
2. Candidates were previously scanned across the whole snapshot, so an
unrelated clickable node outside the recognized panel (e.g. an
underlying goods-detail-page bottom bar still in the accessibility tree
behind the sheet) could out-rank the real button by sitting lower on
screen. Added panelContainerBounds(): climbs from the panel's unique
quantity input to the largest ancestor that still does not cover the
whole screen (the same "does not cover the whole screen" bounded notion
#331 already uses for sharesBoundedPanelContainer/boundedScrollables),
giving the whole bottom-sheet container. ParsedPddScreen.specPanelContainer
(PddScreenParser's `panelScrollable`) was considered but is the wrong
notion here: it is only the inner *scrollable dimension list* used for
heading/option parsing, and in a real PDD sheet the address/payment/
submit rows sit outside it as structural siblings, not descendants -
using it would incorrectly exclude the real submit row in most panels.
A candidate belongs to the panel when its center point falls inside the
container's bounds (geometric containment, matching the existing
`inside()` convention in this file, not path prefix, since PDD's own
tree can place the submit bar as a structural sibling that is still
visually part of the sheet). When the quantity input is missing or not
unique, the container cannot be determined and finalSubmitTargets fails
explicitly (no target) instead of guessing.
Tests added to SpecPanelRecognitionTest: bottom node labeled "去支付" and
"付款" are blocked (distinct from the existing PAYMENT_MARKERS-triggered
PURCHASE_PAYMENT_FORBIDDEN cases, since neither word reaches the global
guard); a clickable node outside the recognized panel container is never
chosen even though it is bottom-most on screen; a recognized panel with no
determinable quantity input/container fails explicitly. All existing
readOrderResult tests (which legitimately show "待付款"/"去支付" on the
order-result page, unrelated to finalSubmitTargets) stay green unchanged,
confirming SUBMIT_TARGET_BLOCKED_MARKERS did not leak into that path.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
Task 570 (goods 8580) timed out because the order button's text kept
changing (促销价文案 instead of "提交订单"), so FINAL_SUBMIT_MARKERS never
matched and hasFinalSavedAddressEvidence stayed false forever. Per the
user's confirmed strategy, finalSubmitTargets now ignores button text and
instead picks the bottom-most clickable/enabled/non-zero-size node of an
already-recognized spec panel (reusing #331's PddScreenParser recognition,
including the REQUIRED_EVIDENCE fallback). Ties on the bottom edge pick the
rightmost node and are flagged in diagnostics. A node whose own label or
subtree contains a payment word (PAYMENT_MARKERS) is never a click target.
A candidate taller than 30% of screen height is excluded so a full-sheet/
full-body wrapper container can never win the tie against the real bottom
bar. The old FINAL_SUBMIT_MARKERS text match is kept only as non-required
diagnostic evidence. hasFinalSavedAddressEvidence, finalConfirmation and
submitOrderOnce all consume the same finalSubmitTargets, so the address-save
evidence check and the final click use one consistent rule.
Tests: PurchaseLiveAutomationTest's LiveDriver confirmation-page fixture now
carries a full #331 REQUIRED_EVIDENCE structure (address/payment rows nested
under the shared panel container) since finalSubmitTargets depends on panel
recognition; one assertion that encoded the old bare-tap address activation
is updated to reflect the now-wrapped clickable row. SpecPanelRecognitionTest
replaces the old text-matching submit-target test with cases for the 570
promo-price bottom row, legacy "提交订单" panels, side-by-side tie/rightmost,
payment-word blocking (visible and invisible-subtree), zero-size exclusion,
and unrecognized pages.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
Review follow-up on 56f24e1:
1. moveSpecPanelToTop's collapse detection was too sensitive: a normal
scroll-to-top on a multi-dimension panel can legitimately drop the
heading count (a lower heading scrolls out of view) without losing
any spec values. SPEC_PANEL_TOP_COLLAPSED is now only raised when
every collected spec dimension value vanishes (count goes from >0
to 0) or the spec panel is no longer recognized as open
(!specPanelOpen or specPanelType == UNKNOWN). Heading count alone
no longer triggers it.
2. A collector failure during the purchase spec probe (e.g.
SPEC_PANEL_TOP_COLLAPSED) previously vanished into
collectPurchaseProbe returning null, so probeOutcome() reported
the generic PURCHASE_SPEC_NOT_MATCHED "商品规格探测失败" — the same
as an ordinary spec mismatch. collectPurchaseProbe now encodes a
failed collect() result (code + message) into the opaque probe
JSON via PurchaseSpecProbePolicy.encodeCollectorFailure, and
PurchaseSpecProbePolicy.demote (replacing demoteIfEmpty, kept as a
deprecated alias) surfaces it as an explicit
PURCHASE_SPEC_PROBE_FAILED failure with a purchaser-readable
message ("规格探测时规格面板被拖动,规格标题消失" for
SPEC_PANEL_TOP_COLLAPSED, a generic message naming the code
otherwise). This keeps PurchaseRehearsalExecutor's probeSpecs
callback contract opaque, so its existing unit tests are untouched.
Tests: PddProductDetailCollectorTest (heading count dropping while
dimensions remain present must not fail collection, still collects
colors/sizes), PurchaseSpecProbePolicyTest (encode/extract collector
failure, demote surfaces SPEC_PANEL_TOP_COLLAPSED and unrecognized
codes explicitly).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
PddProductDetailCollector.moveSpecPanelToTop always swiped DOWN at
least once even when the panel already showed its topmost color
heading, and required two identical viewport signatures to stop. On
a real device that extra swipe could drag the bottom sheet and make
the color/size headings disappear, after which the purchase spec
probe silently reported spec_probe_completed with zero dimensions
and the server reported the generic PURCHASE_SPEC_NOT_MATCHED,
hiding the real cause (goods 8580, tasks 551/552).
- moveSpecPanelToTop now skips the restore swipe when the panel is
already at top (the first parsed dimension is "color" with visible
values), and stops and fails explicitly (SPEC_PANEL_TOP_COLLAPSED)
if a restore swipe makes headings/dimensions vanish, instead of
swiping further or returning an empty success.
- New AgentDiagnosticReason.SPEC_PANEL_TOP_ALREADY /
SPEC_PANEL_TOP_COLLAPSED record swipe count and heading/dimension
counts before/after (booleans/counts only, no page text).
- New PurchaseSpecProbePolicy demotes an Agent spec_probe_completed
outcome with zero collected dimensions into an explicit
PURCHASE_SPEC_PROBE_EMPTY failure ("规格探测未读取到任何颜色或尺码")
before it is persisted/reported, instead of reaching the server as
a normal empty probe.
- Server resolveProbedSpecs uses the same explicit
PURCHASE_SPEC_PROBE_EMPTY code/message when a probe result has zero
colors and zero sizes, as defense in depth for older Agent builds.
Tests: PddProductDetailCollectorTest (already-at-top skips the
restore swipe; not-at-top restores and still collects; vanishing
headings stop swiping and fail), PurchaseSpecProbePolicyTest, and
service_test.go TestLiveProbeWithNoDimensionsFailsWithExplicitEmptyProbeCode.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
- PddScreenParser: add REQUIRED_EVIDENCE fallback type after all existing
branches; requires address entry (masked phone in a nearby clickable row),
payment entry (specPanel.paymentAreaAliases in a nearby clickable row) and
one enabled quantity EditText, plus at least one auxiliary signal
(options, summary, close, +/- or submit action). +/- no longer required
on this path; existing branches unchanged.
- The three required items must share one panel container: their lowest
common ancestor must not be a window root and must not cover the whole
screen. Items from an address dialog, a payment dialog and an unrelated
input box are not recognized.
- Purchaser hints on SPEC_PANEL_EVIDENCE_NOT_MATCHED, the spec-panel wait
diagnostic and the address-save timeout when a required item is missing
(default WeChat Pay / default address / quantity input). No Alipay alias.
- Purchase spec-entry wait and post address-save wait: bounded 5000 ms,
fallback panels need two identical structure samples, no Back while
waiting, explicit failure on timeout; boolean/count diagnostics only.
- Final submit target additionally rejects zero-size labels/containers.
- Diagnostics: evidence flags (incl. same-container) in panel evidence and
spec-panel entry event.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
- PddScreenParser: nested clickable nodes of one labelled option block
(outer block, image, inner text with a badge such as "零差评") are
collapsed into one spec value named by the outer block (task 535). The
click node is still chosen by safeOptionRank; selected/checked flags are
merged from the block members; no badge-text stripping.
- PurchaseRehearsalExecutor: on SPEC_SELECTION_UNCONFIRMED emit a
specSelectionUnconfirmed diagnostic with the dimension, the target value
and the parsed option texts (each truncated to 40 chars) with selected
flags. Spec values are product attributes only.
- Tests: SpecOptionDedupTest with a sanitized task 535 fixture.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F