Skip to content

test(coderd/x/chatd): move the Anthropic guard unit test into its own file - #30968

Draft
ibetitsmike wants to merge 2 commits into
mainfrom
mike/chatd-guard-test-own-file
Draft

ibetitsmike wants to merge 2 commits into
mainfrom
mike/chatd-guard-test-own-file

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Moves TestAnthropicProviderToolPreRequestGuard out of coderd/x/chatd/chatd_test.go into a new coderd/x/chatd/anthropic_guard_test.go in the same package. The test calls chatsanitize.ApplyAnthropicProviderToolGuard on in-memory messages and builds no server or database. Giving it its own file lets the next PR move it into chatsanitize as a git rename. The end-to-end TestActiveServer_AnthropicProviderToolPreRequestGuard stays in chatd_test.go.

Why it is safe

This is a pure move, with no edits. The helpers the test uses stay in chatd_test.go for now; the next PR moves them.

  • Purity check: diff <(git diff B H | grep '^-[^-]' | cut -c2- | sort) <(git diff B H | grep '^+[^+]' | cut -c2- | sort) prints only the new file's package clause, import (, ) and import paths. git diff --color-moved=plain marks all 137 removed lines as moved; the only 12 added lines it leaves unmarked are that package clause and import block.
  • The same four subtests pass before and after: non_Anthropic_providers_are_unchanged, orphan_provider_result_is_textified, valid_provider_history_is_unchanged, logs_removals.

Review focus

Nothing changed outside the new file's header. git diff --color-moved=plain shows this at a glance.

Validation

  • go test ./coderd/x/chatd/ -run '^TestAnthropicProviderToolPreRequestGuard$' -count=1 -v: 4 of 4 subtests pass.
  • go vet ./coderd/x/chatd/: clean.
  • Pre-commit hook (make pre-commit: gen, fmt, lint/go, lint/go/new-code, slim build): passed.

Stack

This stack moves the Anthropic guard unit test into chatsanitize, then deletes the guard escalation that can never repair a prompt.

  1. test(coderd/x/chatd): move the Anthropic guard unit test into its own file #30968 Move the Anthropic guard unit test into its own file
  2. test(coderd/x/chatd): move the Anthropic guard unit test into chatsanitize #30969 Move the Anthropic guard unit test into chatsanitize
  3. refactor(coderd/x/chatd/chatsanitize): drop Anthropic guard escalation passes #30970 Drop the Anthropic guard escalation passes

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

@ibetitsmike
ibetitsmike added this pull request to stack #30971 October 18, 2026 15:57
@ibetitsmike ibetitsmike changed the title mike/chatd guard test own file test(coderd/x/chatd): move the Anthropic guard unit test into its own file Oct 18, 2026
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T17:30:07.299908Z 9f184ab Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 1abb76deca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, requested this review for Mike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 9f184ab88d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

This branch has not been deployed

No deployments
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