Files view: the full DF chain in the file path (v2.7.6)

- the tracker kept only the immediate parent DF, so a phonebook file read as
  "DF_PHONEBOOK/4FA1" — the trace's own selection path (00a4080406
  7F105F3A4FA1) spells out the whole chain; the channel state now carries it
  (selected_df_state() returns (df, path), e.g. ('5f3a', ['7f10', '5f3a'])),
  the tracker stores it per file and _file_path() renders it:
  "DF_TELECOM/DF_PHONEBOOK/4FA1"
- chain rules: a child DF selected by FID appends to the current chain, MF and
  the ADF restart it, an AID is its own root, a path selection uses the DFs
  in the path (an explicit '7fff' collapsing to the ADF), and an EF selects
  keeps it.  A leading MF is implicit in a longer path; MF-only files keep
  "MF/…", ADF files "ADF/…" (the previous labels unchanged)
- the chain is learned from the FCP sighting too and extends a shorter path
  recorded earlier, so entries created from a GET RESPONSE still get the full
  path
- verified on the live traces (sessions 47/193): 5f3a/4fa1 ->
  DF_TELECOM/DF_PHONEBOOK/4FA1, 5f3a/4f30 -> DF_TELECOM/DF_PHONEBOOK/EF_PBR
  (4F30), while 3f00/2fe2 -> MF/EF_ICCID (2FE2) and 7fff/6f07 ->
  ADF/EF_IMSI (6F07) stay as before
- tests: selected_df_state (path/FID/MF/ADF/AID/EF cases) and a tracker flow
  with a path selection asserting the full path; 529 Python + 76 Node tests
- README/README_RUS show the chain; PWA_VERSION/pyproject/version.py 2.7.6,
  SW cache simtrace-analyser-v86
This commit is contained in:
catarrh committed 2026-10-18 01:05:55 +03:00
1 parent 1df52a34e5
commit 5dea6bceb8
12 files changed
+184 -52

No files matched your search

+38
View File
@@ -298,6 +298,44 @@ def selected_df_fid(d, current_df=None):
return None
def selected_df_state(d, current_df=None, current_path=None):
"""(current DF, DF path) after a SELECT, or ``(None, None)``.
The path is the chain of DFs from the root (MF) or from the running
application's ADF to the current DF: selecting ``7F10/5F3A/4FA1`` leaves
``('5f3a', ['7f10', '5f3a'])``. It lets the Files view show a file's full
path (``DF_TELECOM/DF_PHONEBOOK/4FA1``) instead of its parent alone.
"""
df = selected_df_fid(d, current_df)
if df is None:
return None, None
p1 = (d.get('p1') or {}).get('raw')
h = (d.get('body') or {}).get('hex') or ''
base = list(current_path or ([current_df] if current_df else []))
if p1 in ('00', '01'):
# A child DF of the current one; MF and an ADF start a fresh path.
if df == '3f00' or df == '7fff' or df.startswith('aid:'):
return df, [df]
return df, base + [df] if base else ['3f00', df]
if p1 in ('08', '09'):
comps = [h[i:i + 4] for i in range(0, len(h) - 3, 4)]
chain = [] if p1 == '08' else list(base)
for comp in comps:
if comp == '7fff':
# The ADF: the path restarts there (an AID identity stays).
chain = [df] if df.startswith('aid:') else ['7fff']
elif _is_df_fid(comp):
chain.append(comp)
if not chain:
chain = ['3f00'] if p1 == '08' else (list(base) or ['3f00'])
if chain[-1] != df:
chain.append(df)
return df, chain
if p1 == '04': # by AID: the ADF is the path root
return df, [df]
return df, (base or [df])
def sfi_table(df):
"""Return the SFI→FID table for a DF FID, or an empty dict."""
return _SFI_BY_DF.get(df or '', {})