This PR deletes the tests of the legacy chat message encodings (plain
strings, fantasy envelopes and legacy tool rows, all stored with
`content_version` 0), and the test-only writers that built those rows
(`MarshalContent` and `MarshalToolResult` in `export_test.go`). It
changes tests only. The next layer removes the legacy decoder that these
tests cover.
**Why it is safe**
Deleted tests that covered only the legacy format:
- The legacy cases of `TestParseContent_BackwardCompat`: legacy system
strings, fantasy envelopes and legacy tool rows. Its six cases of
current-format parts in version 0 rows stay, because they need no legacy
writer. The next layer moves them to version 1 rows.
- `TestInjectFileID_StripsInlineData`: the test-only `MarshalContent`
writer.
- `TestSDKPartsNeverProduceFantasyEnvelopeShape`: the invariant behind
`isFantasyEnvelopeFormat`, the legacy format detector.
- `TestParseContent_ErrorPaths/unknown_role`: the role switch in the
legacy decoder. The V1 decoder has no role switch. The version 0
malformed-input cases of this test stay, because they need no legacy
writer. The next layer deletes them with the decoder.
Deleted tests that also covered current behavior, checked with mutants
of `chatprompt.go`:
- `TestConvertMessagesWithFiles_BackwardCompat` (file ID resolution):
dropping resolved file data, or not collecting user file IDs, still
fails more than 10 remaining tests, including
`TestConvertMessagesWithFiles_ResolvesFileData`.
- `TestProviderMetadataRoundTrip` (provider metadata becomes provider
options): dropping the conversion still fails
`TestConvertMessagesWithFiles_Conversation` and
`TestAssistantWriteRoundTrip`.
- `TestProviderExecutedResult_LegacyToolRow` (provider-executed results
in legacy tool rows are dropped before replay): keeping
provider-executed results in `injectMissingToolUses` still fails
`TestInjectMissingToolUses_DropsProviderExecutedOrphans` and
`TestInjectMissingToolUses_DropsOnlyProviderExecutedMessage`.
The 17 mutants from the layer below give the same result here as on that
layer.
**Review focus**
The `export_test.go` deletion. `MarshalToolResult` uses `toolResultRaw`,
which the next layer deletes, so the writer goes first.
**Validation**
- `go test ./coderd/x/chatd/chatprompt/ -count=1`: ok
- `golangci-lint run --fix=false ./coderd/x/chatd/chatprompt/...`: 0
issues
- pre-commit hook: passed
**Stack**
This stack retires chatd compatibility paths for chat data that older
Coder versions stored.
1. #30996 stamp chat message fixtures with the current content version
2. #30997 drop tests of the legacy content codec (this PR)
3. #30998 retire the V0 chat message content decoder
4. #31000 inline the model config provider identity
5. #31005 retire the `close_agent` tool alias
> Xum, an AI agent, opened this PR for @ibetitsmike and wrote this
description.