Skip to content

Chore: Add Autofill logging for debug purposes - #7450

Merged
david-livefront merged 1 commit into
mainfrom
autofill-debug-logging
Oct 7, 2026
Merged

david-livefront merged 1 commit into
mainfrom
autofill-debug-logging

Conversation

@david-livefront

Copy link
Copy Markdown
Collaborator

🎟️ Tracking

N/A

πŸ“” Objective

This PR adds Autofill logs that are extremely helpful when debugging. These logs are off by default and should never be enabled in production, or even for regular debug builds but when debugging Autofill specifically, they are extremely useful.

@david-livefront
david-livefront requested a review from a team as a code owner October 6, 2026 21:04
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context t:tech-debt Change Type - Tech debt labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

πŸ€– Bitwarden Claude Code Review

Overall Assessment: APPROVE

Reviewed the addition of opt-in verbose Autofill and Accessibility-Autofill logging across two new LogUtil.kt helpers plus the call sites in AutofillParserImpl and AccessibilityParserImpl. Both log paths are gated behind const val flags that default to false, and each has a unit test asserting the flag stays disabled, which prevents view-node text from reaching logcat or the flight recorder in shipped builds. The parsing behavior is unchanged: logWindowNodeEnd() is attached via a non-safe .also so it fires even when rootViewNode is null, and the new depth parameter is purely cosmetic. Narrowing both parser implementations to internal is safe β€” the only references are the Hilt modules and unit tests inside :app.

Code Review Details
  • ⚠️ : getChild(i) is not null-checked and the recursion is unbounded, so enabling the accessibility logs can crash the service being debugged
    • app/src/main/kotlin/com/x8bit/bitwarden/data/autofill/accessibility/parser/util/LogUtil.kt:25

* `false` unless you are actively debugging.
*/
@VisibleForTesting
internal const val ENABLE_ACCESSIBILITY_LOGS: Boolean = false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Developers only need to enable this to get additional logs for Accessibility Autofill that can prove extremely useful for debugging.

* you are actively debugging.
*/
@VisibleForTesting
internal const val ENABLE_ASSIST_STRUCTURE_LOGS: Boolean = false

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here for the regular Autofill logs

class LogUtilsTest {
@Test
fun `accessibility autofill logs must be disabled`() {
assertFalse(ENABLE_ACCESSIBILITY_LOGS)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are here to ensure that no one ever merges code that enables these logs by accident

@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 85.95%. Comparing base (1f03415) to head (f44839a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7450      +/-   ##
==========================================
+ Coverage   85.91%   85.95%   +0.04%     
==========================================
  Files         911      954      +43     
  Lines       66236    67787    +1551     
  Branches     9365     9401      +36     
==========================================
+ Hits        56905    58267    +1362     
- Misses       5860     6035     +175     
- Partials     3471     3485      +14     
Flag Coverage Ξ”
app-data 18.32% <100.00%> (-0.33%) ⬇️
app-ui-auth-tools 18.71% <0.00%> (+0.09%) ⬆️
app-ui-platform 16.77% <0.00%> (+0.29%) ⬆️
app-ui-vault 27.52% <0.00%> (+0.64%) ⬆️
authenticator 5.99% <0.00%> (+0.03%) ⬆️
lib-core-network-bridge 4.08% <0.00%> (-0.02%) ⬇️
lib-data-ui 1.22% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@david-livefront
david-livefront force-pushed the autofill-debug-logging branch 2 times, most recently from 166e459 to a119f6b Compare October 6, 2026 21:34

@aj-rosado aj-rosado left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very helpful πŸ‘

@david-livefront

Copy link
Copy Markdown
Collaborator Author

Thanks @aj-rosado

@david-livefront
david-livefront added this pull request to the merge queue Oct 7, 2026
Merged via the queue into main with commit dc8d32f Oct 7, 2026
27 checks passed
@david-livefront
david-livefront deleted the autofill-debug-logging branch October 7, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:password-manager Bitwarden Password Manager app context t:tech-debt Change Type - Tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants