Convert wifiConfigstore2 to LAVA @artifact_processor (fix UnboundLocalError crash)#831
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug (reported in testing):
get_wifiConfigstorecrashed withUnboundLocalError: cannot access local variable 'configcombined'.Cause: the per-field defaults (
configcombined = '', …) were set inside the innerfor b in aloop (perWifiConfiguration), butdata_list.append(...)ran one level out, in thefor a in elemloop. A parent element with noWifiConfigurationchild never ran the inner body, so the*combinedvariables were never assigned →UnboundLocalError. (An earlier fix added defaults but in the wrong scope.)Fix / conversion: rewritten to the decorated
@artifact_processorpattern with robust parsing: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.network.iter()so nestedIpAssignment/ProxySettings(underIpConfiguration) are captured.- {count}) reports into one table.ConnectChoiceTimeStamp→ aware UTCdatetime.Verified with a fixture containing a populated network and an empty
<WifiConfiguration/>— the empty one is skipped, no crash, andIpAssignment/ConnectChoiceTimeStampparse correctly.Note: this parses the same
WifiConfigStore.xmlaswifiProfilesbut with a complementary AOSP field set (BSSID, RandomizedMacAddress, ConnectChoice, HasEverConnected…); both are kept. Original dates (2023-05-11) preserved.