Skip to content

fix: normalize empty session name to null in min ls --json - #1154

Merged
norrietaylor merged 2 commits into
mainfrom
inbox-patch/normalize-empty-session-name-json-35b9e69d098a1628
Aug 1, 2026
Merged

fix: normalize empty session name to null in min ls --json#1154
norrietaylor merged 2 commits into
mainfrom
inbox-patch/normalize-empty-session-name-json-35b9e69d098a1628

Conversation

@gominimal-aw-bot

@gominimal-aw-bot gominimal-aw-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABKmg0-g

min ls --json could report the name field three ways — null, an empty string, and a non-empty string — because a session name persisted as "" (reachable via an older rename path that no longer accepts empty names) serialized verbatim instead of as null, forcing a JSON consumer to treat both null and "" as "no name". The fix collapses an empty-string name to None when a session Record is deserialized, so every read surface (the min ls table, --json, and record lookups) carries one canonical representation: null for "no name", a non-empty string otherwise. Normalizing at the deserialization boundary also cleans up any such value already on disk the next time it is read. No load-bearing Distillery precedent found.

Verification

cargo fmt --all --check --manifest-path target/Cargo.toml — clean, no drift
cargo clippy --workspace --locked -- -D warnings — exit 0, 0 warnings
cargo build --workspace --locked — exit 0, Finished dev profile
cargo test --workspace --locked — exit 0, all pass; sessions lib 354 passed incl. record_with_empty_name_deserializes_as_none

Note

Normalize empty session name to null in min ls --json output

Adds a custom serde deserializer in lib.rs that maps empty string values to None when deserializing Record.name. This unifies the two on-disk representations of a missing session name (null and "") to None at load time.

Macroscope summarized 0beaed0.

Summary by CodeRabbit

  • Bug Fixes
    • Records with empty names are now correctly treated as unnamed when loaded.
    • Non-empty record names continue to be preserved.

An empty-string name could reach storage via the rename path before
that boundary was tightened to reject empty and whitespace-only names.
Such legacy records left `null` and `""` as two on-disk spellings of
"no name", so `min ls --json` exposed three representations of the
`name` field (null, an empty string, and a non-empty string) and a
JSON consumer had to handle both empty forms.

Collapse the empty string to `None` when deserializing a Record, so the
`name` field carries one canonical representation wherever it is read:
null for "no name", a non-empty string otherwise.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Session record deserialization now converts persisted empty names to None. Non-empty names remain unchanged. A regression test verifies the empty-name behavior.

Changes

Session name normalization

Layer / File(s) Summary
Record name deserialization and regression test
crates/sessions/src/lib.rs
Adds an empty-string-normalizing deserializer for Record.name and verifies that persisted empty names deserialize to None.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: evanspearman

Poem

A rabbit found a name blank in the store,
And turned it to None, as before.
Full names stayed bright,
The test checked it right,
Then the rabbit went hopping once more.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the primary change and follows the repository's Conventional Commit format.
Description check ✅ Passed The description explains the change and includes detailed verification results, with only the checklist section omitted.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch inbox-patch/normalize-empty-session-name-json-35b9e69d098a1628

Comment @coderabbitai help to get the list of available commands.

@norrietaylor
norrietaylor marked this pull request as ready for review July 31, 2026 22:40
@norrietaylor
norrietaylor requested a review from a team as a code owner July 31, 2026 22:40
@norrietaylor
norrietaylor merged commit a900c9e into main Aug 1, 2026
30 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/normalize-empty-session-name-json-35b9e69d098a1628 branch August 1, 2026 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant