fix: muse read-snapshot silently dropped the directories field (musehub#93)
read_snapshot() already returns a full SnapshotRecord including .directories, but the CLI command's output construction never surfaced it -- _SnapshotOutput's TypedDict didn't declare the field and run() never read record.directories. Since directories are part of the snapshot's own identity (hash_snapshot(manifest, directories) computes snapshot_id), this made read-snapshot's claimed "full snapshot metadata" output silently incomplete -- you could not verify a snapshot's own directories field without reading the raw object file directly, exactly the workaround used to diagnose musehub#93 in the first place.
Added directories (list[str]) and dir_count (int) to the JSON output, both filtered consistently with the existing manifest/file_count when --path-prefix is given. Text-mode output now also shows the dir count alongside the file count.
This was explicitly one of #93's checklist items ("(muse, separate) muse read-snapshot drops the directories field"). Picking up #93/#60 properly now -- this is the first, self-contained piece.
6 new tests: directories present, empty-list (not absent) when none, directories still surfaced with --no-manifest (they're identity, not bulk data), --path-prefix filters directories too, text format shows dir count, and an explicit write→read round-trip with 31 directories (matching #93's own reported symptom shape) as a regression guard.
Tests: 31/31 in test_cmd_read_snapshot.py.
Semantic Changes
10 symbols
Files Changed
~2
1196 in snapshot
0 comments
muse hub commit comment sha256:ec9e0eaa77bbe47e7bfee744380e01c917423f027fbe6c9eeb8b8f440330dc8f --body "your comment"
No comments yet. Be the first to start the discussion.