Repository navigation
chore: Add testpackage linter - #156
Conversation
Enforces a consistent test package layout. This makes it difficult to test internal functionality, which I believe promotes healthy decomposition, and minimal package exports.
Codecov Report
@@ Coverage Diff @@
## main #156 +/- ##
==========================================
+ Coverage 66.62% 66.99% +0.37%
==========================================
Files 103 103
Lines 5129 5129
Branches 68 68
==========================================
+ Hits 3417 3436 +19
+ Misses 1396 1380 -16
+ Partials 316 313 -3
Continue to review full report at Codecov.
|
bryphe-coder
left a comment
There was a problem hiding this comment.
This makes it difficult to test internal functionality, which I believe promotes healthy decomposition
Agree 100%! LGTM, thanks for bringing this in
| //go:build linux | ||
|
|
||
| package terraform | ||
| package terraform_test |
There was a problem hiding this comment.
I generally like this approach, since it means the tests are done against the externally-visible functions. Sometimes I personally have tests where I want to poke at the internals, and I'm never sure if I should be exporting those functions (e.g. a package that provides an exported func A, which invokes some small internal helpers B and C; I like to have tests for all of them, in which case I'd have both a _test and non-_test package)
I see that this tool skips packages named XXX_internal_test.go by convention, which makes things clearer even in the case where we want to look at the internals.
Nice change! 👍
There was a problem hiding this comment.
I love enforcing these conventions. Consistency is key!
Updates the Agent Relay docs for general availability and for agent-relay v0.17.0, and adds the version requirements table from RELAY-61. - **Beta to GA:** the sidebar state goes from `[premium, beta]` to `[premium]`, and every page drops its beta callout. The monitoring and SIEM notes now say metric names, log messages, and fields can change between releases, and tell readers to review alerts when they upgrade. Anthropic's own "public beta" line for self-hosted environments stays, because Anthropic's docs still say public beta. - **Version requirements:** `setup.md` gets one table of minimum versions for Coder, Agent Relay, the Terraform provider, both modules, and the Claude Code CLI. The "v0.16.0 or later" qualifiers across the pages are removed, because the table sets a single GA baseline. Module examples move to 1.0.1, the latest tag. Its only change from 1.0.0 is in the README. - **v0.17.0, Claude Code poll loop** ([agent-relay#189](coder/agent-relay#189)): after it handles a session, a pool claims the next one right away and waits 5 seconds only after an empty or failed poll. The "one session every 5 seconds" claim and the provisioner sizing formula that depended on it are replaced in `claude-code.md`. `siem.md` lists the renamed `backoff` log field, which replaces `interval`. - **v0.17.0, redelivery** ([agent-relay#165](coder/agent-relay#165)): if Anthropic redelivers a session while its previous workspace still has a start build or a delete in progress, Agent Relay fails the session instead of building again. This is covered in the build budget, setup failure, and reap delay text, plus a new troubleshooting entry. - **`install_cli`:** the docs no longer say `install_cli = true` removes the Claude Code CLI minimum. The modules skip the install when a CLI is already on `PATH` and never upgrade it. ## Open questions - **GA versions (Steven Masley, per RELAY-61):** the table uses the latest versions as of today: Coder 2.39, Agent Relay v0.17.0, Terraform provider v2.20.0, and modules 1.0.0. If GA ships with newer releases, the table, the early access upgrade steps, and the `claude-code.md`/`cursor.md` module notes need the new numbers. - **Stability at GA:** should the monitoring and SIEM pages promise anything about metric and log stability, or does "can change between releases" stay? - **Backport:** the v0.16.0 docs were backported to `release/2.39` (#32122). This PR probably needs the same once the GA versions are settled. Related: #32519 adds a section to `claude-code.md` in a different part of the page. It shouldn't conflict. <details> <summary>Verification notes and decision log</summary> Verified against agent-relay `v0.16.0...v0.17.0`: - `serviceclaudecoderunners/poller.go` `pollLoop`: `drain` polls again right after each handled hint (`maxHintsPerPoll = 1`). `pollIntervalDefault` (5s) is the startup delay and the backoff after `ErrEmptyPoll`, a retryable poll error, or a license lapse. The relay sets no limit on concurrent builds (README, Claude Code pools). - `workspacedispatcher/dispatcher.go` `reconcile`: with `TerminalOnUnfinishedBuild` (set to `redelivered(hint.Attempt)` in `serviceclaudecoderunners/dispatch.go`), `blocksRedelivery` (START or DELETE pending, starting, or canceling, or deleting) sends the non-retryable nack `agent-relay: the previous workspace was not ready for this session; send a new message to retry` and logs `redelivery found a predecessor build or delete in progress, failing current work order`. `retirePredecessorLocked` runs only for a START that isn't deleting. It cancels the build through `settleBuild`, then deletes the workspace. A running delete is left alone. - A new message is a first delivery, and `AwaitDeleting: true` makes it wait for the delete and then build fresh. - `poller.go`: the `poll loop started` record's field is now `backoff`. No other code emits `interval`. - No CLI flags, environment variables, Helm values, or metric names changed between v0.16.0 and v0.17.0. - Registry `agent-relay-{claude-code,cursor}` v1.0.1 `main.tf` `install_cli`: "A CLI already in the image is used as is and never upgraded." Decisions: - The table states one GA baseline instead of a matrix with one row per relay release. RELAY-61 narrowed the scope to "latest versions as of GA", and the relay doesn't check module pairing at runtime, so older rows couldn't be verified. - The Claude Code CLI minimum of 2.1.224 is kept. Neither the relay nor the module checks it, so it's left as stated policy. - Not documented: the example image bumps (#156, #181, #183), the mock-clock refactor (#166), and the test-only PRs, because users see no change. Checks: `make lint/emdash`, `make lint/docs-manifest`, `make lint/docs-html`, markdownlint, and Vale (no new alerts compared with `main`). A `doc-check` self-check found 3 blocking accuracy findings: the `install_cli` wording twice, and the redelivery cleanup wording. All 3 are fixed. </details> Refs DOCS-1797, RELAY-61 > Generated by Coder Agents on behalf of @nickvigilante.
Enforces a consistent test package layout.
This makes it difficult to test internal
functionality, which I believe promotes
healthy decomposition, and minimal package
exports.