Files view: change details with before/after images (v2.4.0)
- the timeline's Δ glyph became a **Details** button, and it now appears on Update rows too (not just card-side changes); EN "Changed (card)" -> "Changed on card", RU "Изменено (картой)" -> "Изменено картой" - the details modal shows the affected unit — the whole file, or the single record that changed — **before and after** the change as hex views (16 bytes per row, ASCII column, never-observed bytes as `--`), with the bytes that changed and the bytes the operation *first observed* highlighted in two different colours, plus the changed/new byte counts and the APDU reference; the old before/after byte table is gone - `GET /api/sessions/<id>/files/image?key=…&change=…` returns those two views (segments with offsets) plus the change's metadata; the images are reconstructed from the current image by undoing the later changes (`FileTracker.change_images`), so nothing is duplicated per event — every value change is an event, hence the values are exact (a byte only first observed later can appear as known in both views) - tracker: change events carry `observed_ranges` (bytes that were unknown before the operation) next to `ranges`; an update that only observes new bytes now records an event (so it can be inspected); record-file ranges are in-record byte offsets (the record number stays in its own field), which the previous "record number as position" could not express for a hex highlight - tests: change-images reconstruction (before/after per event, later changes undone, records isolated, observation-only events, unknown gaps), the image endpoint (200/404/400), and Node tests for the hex-image helper (highlight classes, unknown gaps, ASCII, row limit) and the modal rendering - v2.4.0; SW cache simtrace-analyser-v65
This commit is contained in:
1 parent
87b6811adf
commit
cad3999307
12 files changed
+617
-120
No files matched your search
@@ -198,13 +198,22 @@ class Database:
|
||||
Returns the tracker's result dict: the operation timeline, per-file
|
||||
counters/images/changes, the SFI relations and the AID labels.
|
||||
"""
|
||||
tracker = self._file_tracker(session_id)
|
||||
return tracker.result()
|
||||
|
||||
def change_images(self, session_id, key, idx):
|
||||
"""Before/after images of the unit affected by change *idx* of *key*
|
||||
(the Files view's Details modal), or None for an unknown file/index."""
|
||||
return self._file_tracker(session_id).change_images(key, idx)
|
||||
|
||||
def _file_tracker(self, session_id):
|
||||
from .filetrack import FileTracker
|
||||
rows = self._conn.execute(
|
||||
'SELECT id, session_id, elapsed, type, data, flags FROM messages '
|
||||
'WHERE session_id=? ORDER BY elapsed, id', (session_id,)).fetchall()
|
||||
tracker = FileTracker()
|
||||
self._decode_rows(rows, on_message=tracker.observe)
|
||||
return tracker.result()
|
||||
return tracker
|
||||
|
||||
def get_messages_raw(self, session_id):
|
||||
rows = self._conn.execute(
|
||||
|
||||
Reference in new issue
Block a user