zed/crates/assistant_slash_command
lex00 0db0cc65d6
Handle removed IconName variants in text thread deserialization (#47624)
Fixes #41776

## Problem

Old AI Text Thread sessions fail to open from History because the
deserializer fails on unknown icon variants. When icons are removed or
renamed in refactors, old saved threads become unloadable with errors
like:

```
unknown variant `AtSign`, expected one of `Ai`, `AiAnthropic`...
```

## Solution

Added a lenient deserializer for the `icon` field in
`SlashCommandOutputSection` that falls back to `IconName::Code` for
unknown variants.

This ensures old saved threads remain loadable even as icons are
added/removed from the codebase.

## Test Plan

- Added unit test for valid icon deserialization
- Added unit test for unknown icon fallback to `Code`
- Added unit test for various unknown icon variants
- Added unit test confirming serialization unchanged
- All tests pass: `cargo test -p assistant_slash_command`

Release Notes:

- Fixed old AI text thread sessions failing to open from History when
they contain icons that were removed in previous updates.

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: MrSubidubi <finn@zed.dev>
2026-01-26 23:56:55 +00:00
..
src Handle removed IconName variants in text thread deserialization (#47624) 2026-01-26 23:56:55 +00:00
Cargo.toml Remove workspace-hack (#40216) 2025-10-17 18:58:14 +00:00
LICENSE-GPL Extract SlashCommand trait from assistant (#12252) 2024-05-24 13:03:41 -04:00