Skip to content

Conversation

@rafaeljonathannh
Copy link

@rafaeljonathannh rafaeljonathannh commented Dec 9, 2025

Summary

This PR hardens multiple parsers against schema variations, missing tables, malformed files, and uninitialized variables. The goal: remove all crash paths caused by unexpected DB structures or corrupt input.


Changes

notificationHistory.py

  • Short-circuit XML parsing before ParseFromString to avoid attempting to parse raw XML.
  • Added guard for parse failures; corrupted XML files are now skipped instead of crashing.
  • Fixes "Unexpected end-group tag" error.

gmailEmails.py

  • Initialize messagehtml for every row prior to use.
  • Eliminates UnboundLocalError when email rows lack HTML parts.

googleMapsGmm.py

  • Verify sync_item table exists before running queries.
  • Log and skip gracefully when absent.

googleDuo.py

  • Queries made schema-aware: do not rely on missing columns (self_id, call_state, outgoing, content_size_bytes, saved_status).
  • Add fallbacks to empty values when columns are absent.
  • Wrap all queries with existence guards to avoid OperationalErrors.

googleMessages.py

  • Schema-aware attachment handling:

    • Use file_size_bytes / local_cache_path when present.
    • Fall back to storage_uri / uri, or empty when all missing.
  • Guard all attachment queries from missing-column crashes.

wireMessenger.py

  • Robust join between assets and messages:

    • Detect presence of Assets2, Assets, asset_id, _id dynamically.
    • Fall back to available identifiers instead of crashing.
  • Fixed indentation issues and prevented missing-column exceptions.

wellbeing.py

  • Check presence of component_events table before querying.
  • Log and skip instead of raising "no such table" errors.

Outcome

  • All previously reproducible crashes/OperationalErrors caused by DB schema variation have been eliminated.
  • Parsers now fail gracefully: skip malformed or incompatible data instead of aborting the entire run.
  • Fixed one case of uninitialized variable (messagehtml).
  • Overall robustness and portability across different Android app versions significantly improved.

Testing

  • Verified all modified modules run on:

    • Full datasets with complete schemas.
    • Minimal datasets missing various tables/columns.
    • Corrupted / partial XML or DB files.
  • Confirmed zero crashes across tests; all failures logged and skipped as intended.


Checklist

  • No more OperationalErrors
  • Handles missing tables/columns cleanly
  • Logs failures instead of raising
  • Backwards-compatible
  • Ready for merge

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