Skip to content

Convert wifiConfigstore2 to LAVA @artifact_processor (fix UnboundLocalError crash)#831

Merged
abrignoni merged 3 commits into
mainfrom
lava-batch-79
Jun 21, 2026
Merged

Convert wifiConfigstore2 to LAVA @artifact_processor (fix UnboundLocalError crash)#831
abrignoni merged 3 commits into
mainfrom
lava-batch-79

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Bug (reported in testing): get_wifiConfigstore crashed with UnboundLocalError: cannot access local variable 'configcombined'.

Cause: the per-field defaults (configcombined = '', …) were set inside the inner for b in a loop (per WifiConfiguration), but data_list.append(...) ran one level out, in the for a in elem loop. A parent element with no WifiConfiguration child never ran the inner body, so the *combined variables were never assigned → UnboundLocalError. (An earlier fix added defaults but in the wrong scope.)

Fix / conversion: rewritten to the decorated @artifact_processor pattern with robust parsing:

  • Iterate root.iter('WifiConfiguration') with a per-network field dict (every column always defaulted), so a missing/empty config can't raise or leak the previous row's values.
  • Use network.iter() so nested IpAssignment/ProxySettings (under IpConfiguration) are captured.
  • Consolidates the old per-file, dynamically-named (- {count}) reports into one table.
  • Adds ABX + invalid-token XML hardening; ConnectChoiceTimeStamp → aware UTC datetime.

Verified with a fixture containing a populated network and an empty <WifiConfiguration/> — the empty one is skipped, no crash, and IpAssignment/ConnectChoiceTimeStamp parse correctly.

Note: this parses the same WifiConfigStore.xml as wifiProfiles but with a complementary AOSP field set (BSSID, RandomizedMacAddress, ConnectChoice, HasEverConnected…); both are kept. Original dates (2023-05-11) preserved.

…tion)

Converts the Gboard keyboard cache parser to the decorated pattern. The
original emitted dynamically-named keystroke reports per cache file across
two schema variants (trainingcache2/3 and trainingcachev2); these are
consolidated into one 'Gboard - Keystroke Cache' table with a 'Source'
column. Now three artifacts: Clipboard, Keystroke Cache, and Sessions.
The intricate blackboxprotobuf decoding is preserved verbatim (wrapped to
return event lists); timestamps are converted to aware UTC by parsing the
SQLite datetime strings (no SQL changes, lowest risk). The clipboard image
migrates from media_to_html to an ('Image','media') column via
check_in_media. Renames id param to avoid shadowing the builtin.
Revert the last_update_date bump and the added author attribution to stay
faithful to the original header per the preserve-dates rule; git history
records the real conversion date.
…lError)

Fixes the reported 'cannot access local variable configcombined' crash:
the per-field defaults were set inside the inner per-WifiConfiguration
loop, but the data_list.append ran one level out (per parent element), so
a parent with no WifiConfiguration child left the *combined variables
unbound. Rewrites the parser to iterate root.iter('WifiConfiguration')
with a per-network field dict (defaults always present), and uses
network.iter() so nested IpAssignment/ProxySettings under IpConfiguration
are captured. Consolidates the previous per-file dynamically-named reports
into one table, adds ABX + invalid-token XML hardening, and converts
ConnectChoiceTimeStamp to an aware UTC datetime. Verified the empty-config
crash scenario is skipped cleanly.
@abrignoni abrignoni merged commit aab5e20 into main Jun 21, 2026
1 check passed
@abrignoni abrignoni deleted the lava-batch-79 branch June 21, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant