Skip to content

[PM-37255] feat: Integrate fill-assist targeting rules into autofill parser#7066

Draft
aj-rosado wants to merge 2 commits into
PM-37255/fill-assist-integrationfrom
PM-37256/apply-fill-assist-rules
Draft

[PM-37255] feat: Integrate fill-assist targeting rules into autofill parser#7066
aj-rosado wants to merge 2 commits into
PM-37255/fill-assist-integrationfrom
PM-37256/apply-fill-assist-rules

Conversation

@aj-rosado

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-37255

📔 Objective

Wires the fill-assist targeting-rules pipeline end-to-end into the Android autofill framework.

When the FillAssistTargetingRules feature flag is enabled and rules are available for the current host, the autofill parser replaces heuristic field detection with site-specific CSS-selector-based matching. Unmatched nodes are excluded entirely — there is no heuristic fallback when rules are active.

What's included:

  • Network layerFillAssistApi, FillAssistService, FillAssistManifestJson, FillAssistFormsJson: fetches a versioned manifest and forms JSON from the fill-assist CDN endpoint.
  • Data layerFillAssistManagerImpl, FillAssistDiskSource: parses CSS selectors into FillAssistRules (tag, id, name, type, role constraints per field), caches rules on disk, syncs on server-config change with a 6-hour re-fetch throttle.
  • CSS selector parser — handles >>> Shadow DOM notation, space-separated CSS descendant selectors (split on whitespace outside […] attribute brackets to preserve attribute values that contain spaces), #id shorthand, and [attr='value'] / [attr="value"] attribute selectors.
  • IntegrationAutofillParserImpl looks up host rules for the focused view's URI and calls AssistStructure.buildFillAssistViews to replace the heuristic view list when rules match.
  • View-node matchingFillAssistViewNodeExtensions.traverseForFillAssist traverses the AssistStructure tree; HtmlInfoExtensions.matchesSelectorClause does the per-node attribute comparison (kept in HtmlInfoExtensions alongside hints() since HtmlInfo.attributes uses android.util.Pair and is untestable in unit tests).
  • TestsFillAssistManagerTest, FillAssistServiceTest, FillAssistViewNodeExtensionsTest (all previously commented-out tests now passing via mockkStatic(HtmlInfo::matchesSelectorClause)), and AutofillParserTests updated for the new constructor parameters.

@aj-rosado aj-rosado added the ai-review-vnext Request a Claude code review using the vNext workflow label Jun 16, 2026
@github-actions github-actions Bot added the app:password-manager Bitwarden Password Manager app context label Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the end-to-end integration of the fill-assist targeting-rules pipeline into the autofill parser: AutofillParserImpl.resolveEffectiveViews (feature-flag-gated host-rule lookup and partition coverage check), the new FillAssistViewNodeExtensions.buildFillAssistViews traversal, HtmlInfoExtensions.matchesSelectorClause attribute matching, ViewNodeExtensions.toAutofillViewData, the DESCENDANT_SEPARATOR_REGEX selector-parser change in FillAssistManagerImpl, and DI wiring. The change is fully gated behind the FillAssistTargetingRules flag, preserves heuristic behavior when the flag is off or rules do not cover the focused partition, and is backed by thorough unit tests.

Code Review Details

No blocking findings.

Notes from the trace (no action required):

  • The pre-block-list reordering of focusedView / uri computation preserves the original semantics, including the "first focused, else first fillable, else Unfillable" fallback.
  • DESCENDANT_SEPARATOR_REGEX (\s+(?![^\[]*])) correctly splits CSS descendant combinators while preserving whitespace inside [attr='...'] attribute values; verified against descendant, attribute-with-space, and mixed selectors.
  • When rules cover the focused partition but no node matches a selector, buildFillAssistViews returns empty and the request becomes Unfillable — this matches the documented "no heuristic fallback when rules are active" design.

@aj-rosado aj-rosado changed the title Add fill assist logic to Autofill [PM-37255] feat: Integrate fill-assist targeting rules into autofill parser Jun 17, 2026
@github-actions github-actions Bot added the t:feature Change Type - Feature Development label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant