Skip to content

chore: remove most export_test.go shims - #32162

Merged
ethanndickson merged 4 commits into
ethan/prune-cron-chatwebhook-testsfrom
ethan/remove-export-test-shims
Nov 18, 2026
Merged

ethanndickson merged 4 commits into
ethan/prune-cron-chatwebhook-testsfrom
ethan/remove-export-test-shims

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #25601, where I missed the other way agents avoid *_internal_test.go: an export_test.go file that re-exports unexported symbols, just so a package foo_test test can reach them. There were 13 of these on main, most recently from #32063.

This PR removes 8 of them. Tests of package internals are now *_internal_test.go files, with no changes beyond the package name and the symbols they call. messagepartbuffer and agentcontext only needed one small accessor each, so Buffer.EpisodeCount and Manager.Started are just exported for real, and their tests stay where they were.

To stop new ones appearing, the testpackage linter no longer skips export_test.go (the 5 that are left are excluded by path), and AGENTS.md and .claude/docs/TESTING.md now state the rule.

export_test.go is an agent idiom, and imo we should try and get rid of it. So, once this PR is approved, we'll fix up all the remaining ones in a follow-up PR, somehow, and undo the lint exclusion when we do.

@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 05:12 — with GitHub Actions Inactive
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 05:12 — with GitHub Actions Inactive
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 05:29 — with GitHub Actions Inactive
@ethanndickson ethanndickson changed the title chore: replace export_test.go shims with internal tests chore: remove unnecessary export_test.go shims Nov 13, 2026
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 05:29 — with GitHub Actions Inactive
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T02:48:54.784064Z 3f31905 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. Already looking forward to the next diff.

Reviewed commit: eb5c919f41

ℹ️ 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".

@ethanndickson
ethanndickson marked this pull request as ready for review November 13, 2026 05:37
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 05:37 — with GitHub Actions Inactive
@ethanndickson ethanndickson changed the title chore: remove unnecessary export_test.go shims chore: remove most export_test.go shims Nov 13, 2026
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 05:39 — with GitHub Actions Inactive

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb5c919f41

ℹ️ 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".

ThomasK33
ThomasK33 previously approved these changes Nov 13, 2026
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 07:38 — with GitHub Actions Inactive
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 642e7ae4a9

ℹ️ 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".

Comment thread .claude/docs/TESTING.md Resolved
@ethanndickson
ethanndickson force-pushed the ethan/remove-export-test-shims branch from 642e7ae to 00e43c8 Compare November 13, 2026 09:18
@ethanndickson
ethanndickson temporarily deployed to main November 13, 2026 09:18 — with GitHub Actions Inactive
@ethanndickson
ethanndickson changed the base branch from main to ethan/prune-cron-chatwebhook-tests November 13, 2026 09:18
mafredri
mafredri previously approved these changes Nov 13, 2026

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of this! But I think there are still some iffy changes in this PR, like the one I commented on here. Would be good to go over with a comb.

But otherwise supporting the direction, good initiative! 👍🏻

Remove 8 of the 13 export_test.go files and move the tests that needed
unexported symbols into *_internal_test.go files. Stop the testpackage
linter from skipping export_test.go, and state the rule in AGENTS.md
and .claude/docs/TESTING.md.
Export Buffer.EpisodeCount and Manager.Started so their tests stay in place, and keep the engineSnapLen and standardWithLocation helpers verbatim.
Test through the exported API where a small change allows it, which
removes the engineSnapLen helper that copied engine internals. Keep in
*_internal_test.go only the tests that call unexported functions.
@ethanndickson
ethanndickson force-pushed the ethan/remove-export-test-shims branch from 3f5a654 to 3f31905 Compare November 18, 2026 02:40
@ethanndickson

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 3f31905982

ℹ️ 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".

@ethanndickson
ethanndickson merged commit da0bd07 into main Nov 18, 2026
35 of 54 checks passed
@ethanndickson
ethanndickson deleted the ethan/remove-export-test-shims branch November 18, 2026 03:14
ethanndickson added a commit that referenced this pull request Nov 18, 2026
The tests from #32063 and #32062 are two to three times the size of the
code they cover, and a lot of them can't fail for a reason we'd care
about. This PR removes those, with no production changes.

In `coderd/schedule/cron`, two tests rebuilt the schedule rule a second
time to compare against, which was also the only use of
`export_test.go`, so that goes too. Most of the rest, in both packages,
are table rows that take the same branch as a row that stays. I also
dropped a copy of the webhook scheme list and a repeated-request test
that belongs at the route.

What's left is a row per reject branch, the RFC cases, the regression
test for the `Next` hang and the constant-time scan. I replayed each fix
commit from the two PRs against the smaller suite, and the pre-fix code
still fails a test for every one, other than a fix to the wording of a
zone error.

One row that stays is changed: the bearer wrong-scheme case used
`Basic`, which was only rejected because of where its space lands, so
nothing covered the scheme word. It's now `Digest`.

#32162 overlaps with this in `cron`. With the shim's users gone it no
longer needs to touch that package, so it's now stacked on top of this
PR.
@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

CODAGT-1607

This branch had an error being deployed

1 failed and 1 inactive (outdated) deployments
docs-preview — 3f319059 Deployed Nov 18, 2026 by ethanndickson via cleanup #197
main — 00e43c8d Deployed Nov 13, 2026 by ethanndickson via cla #256063
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.

4 participants