Skip to content

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

Draft
aj-rosado wants to merge 1 commit 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 1 commit 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 wiring of the fill-assist targeting-rules pipeline into the Android autofill framework (AutofillParserImpl, FillAssistViewNodeExtensions, HtmlInfoExtensions, ViewNodeExtensions, DI, and the selector-parser tweak in FillAssistManagerImpl). The integration is fully gated behind the FillAssistTargetingRules feature flag, so existing heuristic autofill is unaffected when the flag is off. Verified the new constructor parameters are propagated to all call sites, URI host extraction is safe (website always carries a scheme and androidapp:// is excluded), the descendant-separator regex correctly preserves whitespace inside attribute brackets, and the "no heuristic fallback when rules match" behavior is implemented consistently with the documented intent. Test coverage for the new traversal and matching logic is thorough.

Code Review Details

No blocking findings. Traced the main risk paths and confirmed expected behavior:

  • Empty match while rules are active correctly yields Unfillable (intended — no heuristic fallback).
  • effectiveFocusedView recomputation handles the case where the originally focused node matches no rule.
  • Multi-key / multi-rule matches resolve deterministically by insertion order via firstNotNullOfOrNull.
  • getFillAssistRules() is synchronous, so there is no coroutine concern inside the synchronous parse.

@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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant