session: stop truncating hashes in REPL/render output

Four sites in the session paths were truncating session_root and
cache_key to 12-16 hex chars + "…". These are cryptographic content
addresses — the WHOLE hash IS the identifier; truncation makes them
unusable for copy-paste and forensic reference.

Affected:
- session.py render_tree() header
- cli.py session --list output
- cli.py session REPL banner
- cli.py session REPL per-turn footer

Other hash truncations elsewhere in cli.py (search/inspect/burn paths)
are left alone — those are scan-and-skim views where ellipsis is the
intended affordance. Touch them only when they bite.
This commit is contained in:
russell@unturf.com 2026-06-01 17:19:33 -04:00
parent 2c629d5a11
commit 5f07d9ece2
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View file

@ -7559,7 +7559,7 @@ def _cmd_session(args: argparse.Namespace) -> int:
for s in listing:
print(
f" {s['sid']:32s} nodes={s['n_nodes']:3d} "
f"root={s['session_root'][:12]} "
f"root={s['session_root']} "
f"updated={s['updated_at']}"
)
return 0
@ -7647,7 +7647,7 @@ def _cmd_session(args: argparse.Namespace) -> int:
sess = Session.open(p, sid=sid)
print(f"# session {sess.sid}", file=sys.stderr)
print(
f"# db {p} · root {sess.session_root[:12]}",
f"# db {p} · root {sess.session_root}",
file=sys.stderr,
)
print(
@ -7853,8 +7853,8 @@ def _session_repl(args: argparse.Namespace, sess) -> int:
print(f"\n[{n.bates}] {audit_mode}")
print(ans)
print(
f"\n# root {sess.session_root[:16]}"
f"cache_key={ckey[:12]}"
f"\n# root {sess.session_root}"
f"\n# cache_key {ckey}"
)
finally:
try:

View file

@ -577,7 +577,7 @@ def render_tree(sess: Session) -> str:
bps = sess.branches()
lines: list[str] = [
f"session {sid} ({n_nodes} nodes · {len(bps)} branch points · "
f"root={sess.session_root[:12]} · current → {cur})",
f"root={sess.session_root} · current → {cur})",
]
root = sess.root_bates