Michael Suchacz e973f00480 test(coderd/x/chatd/chatprompt): drop tests of the legacy content codec (#30997)
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.
2026-10-30 00:19:19 +00:00
…
…
…
…

Coder Logo Light Coder Logo Dark

Self-Hosted Cloud Development Environments and AI Agents

Coder Banner Light Coder Banner Dark

Quickstart | Docs | Why Coder | Premium

discord release godoc OpenSSF Best Practices OpenSSF Scorecard license Ask DeepWiki

Coder is a self-hosted platform for cloud development environments and AI coding agents. Workspaces are defined with Terraform, connected through a secure Wireguard® tunnel, and automatically shut down when not used. Coder Agents runs a native AI coding agent whose loop executes in the control plane on your infrastructure, with no API keys in workspaces.

  • Define cloud development environments in Terraform
    • EC2 VMs, Kubernetes Pods, Docker Containers, etc.
  • Automatically shutdown idle resources to save on costs
  • Onboard developers in seconds instead of days
  • Delegate coding work to AI agents on your infrastructure
    • Bring any model (Anthropic, OpenAI, Google, Bedrock, self-hosted)
    • No LLM credentials in workspaces, user identity on every action
    • Centralized model governance, cost tracking, and audit logging

Coder platform showing templates and a running workspace

Quickstart

Check out our install guides for other methods and a complete tutorial.

Try Coder with the install script on Linux and macOS, or grab the latest binary or installer from GitHub Releases on Windows:

curl -fsSL https://coder.com/install.sh | sh

Start the server and open http://localhost:3000 to create your initial user, create a Docker template, and provision your first workspace:

coder server

For a production deployment, add a PostgreSQL database (version 13 or later) and an external access URL, and see our validated architectures for sizing and infrastructure guidance:

coder server --postgres-url <url> --access-url <url>

Without these flags, Coder uses a built-in database and sets up a *.try.coder.app access URL for evaluation. Use coder --help for the full list of flags and environment variables.

Documentation

Browse the documentation or visit a specific section below:

  • Workspaces: Workspaces contain the IDEs, dependencies, and configuration information needed for software development
  • Templates: Templates are written in Terraform and describe the infrastructure for workspaces
  • Coder Agents: Delegate coding work to AI agents running on your self-hosted infrastructure
  • AI Gateway: Centralize authentication, auditing, and cost controls for AI tooling
  • Administration: Learn how to operate Coder
  • Premium: Learn about paid features built for large teams
  • IDEs: Connect your existing editor to a workspace

Support

Open an issue for bugs and feature requests.

For community support, showcasing what you built, and feedback on in-progress features, join our Discord or GitHub Discussions.

Dedicated support is included in Coder Premium. For more information, visit coder.com/pricing.

Integrations

New integrations are always in progress. Open an issue to request one. Contributions are welcome in any official or community repository.

Official

Community

Contributing

New contributors are always welcome. If you are new to the Coder codebase, see the contribution guide to get started.

Hiring

Apply on the careers page if you are interested in joining the team.

S
Description
No description provided
Readme AGPL-3.0
1.5 GiB
0 Stars 1 Watchers 0 Forks
Languages
Go 73.5%
TypeScript 24.3%
Shell 0.8%
PLpgSQL 0.4%
Go Template 0.2%
Other 0.5%