Stop the SQLite timeline table dropping rows with nothing said - #349
Open
dchaudhari7177 wants to merge 1 commit into
Open
Stop the SQLite timeline table dropping rows with nothing said#349dchaudhari7177 wants to merge 1 commit into
dchaudhari7177 wants to merge 1 commit into
Conversation
The storage loop in generate_sqlite grew a final else that counts what it cannot
place and logs one line per row_type. The timeline loop never got one, so an
artifact whose row_type no branch matched was discarded in silence -- the same
defect, in the dispatcher that was not fixed.
It is not hypothetical. get_extension_settings appends `extension (installed)`
and `extension (updated)` items to parsed_artifacts, and the XLSX writer has a
branch for them, but the SQLite timeline dispatch has none. Every extension
install and update event was therefore absent from the SQLite output, with no
indication the artifact existed:
parsed_artifacts: extension (installed), extension (updated)
SELECT type FROM timeline -> []
Both now land, and any future unhandled row_type is reported the way the storage
loop reports its own, counted per row_type rather than once per row.
The else matters more than the branch. The branch fixes the one artifact that is
missing today; the else is what makes the next one a reported number rather than
a silent absence.
Four tests, three failing on main.
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.
Towards #343.
Scope — most of that issue is already fixed
Reading the code against the issue, three of its four parts have landed since it was written:
mainHindsightEncoder.default()dispatches onChrome.X, so Firefox siblings fall throughWebBrowser.XServiceWorker*Itembranches existwarn_unhandled()reports class and deriveddata_typegenerate_sqlite()storage loop has no elseunhandled_storagecounter, and aservice workerINSERT branchWhat is left is the one the issue names but that did not get the fix: "both dispatchers need a final else that logs". The storage loop got its else. The timeline loop did not.
The live drop it is hiding
This is not only a defensive change.
get_extension_settingsappendsextension (installed)andextension (updated)items toparsed_artifacts(chrome.py:2414), and the XLSX writer has a branch for them (analysis.py:1952). The SQLite timeline dispatch has neither a branch nor an else, so those events are dropped.Measured on
main, feeding two such items throughgenerate_sqlite:Same shape as the Service Worker case the issue measured: parsed correctly, counted correctly, reported by the run, and then never written — so anyone working from SQLite has no indication the artifact exists.
The change
extensionjoins thepreference/site setting/notification/ … branch, whose column set it already fits (PreferenceItem, and the XLSX branch writes exactly these fields).elsecounting intounhandled_timeline, reported one line per row_type with a count, mirroringunhandled_storageexactly.The
elseis the more important half. The branch fixes the one artifact missing today; theelseis what makes the next one a reported number rather than a silent absence.Verification
Four tests driving
generate_sqliteagainst a real on-disk SQLite file and reading the rows back. Three fail onmain:The fourth pins that a handled row_type is not reported as missing, so the else cannot start crying wolf.
Full suite on this branch: 243 passed, 2 skipped, 80 subtests passed. Python 3.12.4.
Not done here
I have deliberately left #343 open rather than closing it, because two of its questions are yours to settle and are not answered by this:
storagetoday);chrome:local_storage:entry-styledata_typenames — they currently usechrome:service_worker:*, which reads correct to me, but you flagged the collection they live in rather than the names.Happy to take either on separately.