Skip to content

chore: Add testpackage linter - #156

Merged
kylecarbs merged 4 commits into
mainfrom
testpackage
Feb 4, 2022
Merged

kylecarbs merged 4 commits into
mainfrom
testpackage

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

Enforces a consistent test package layout.
This makes it difficult to test internal
functionality, which I believe promotes
healthy decomposition, and minimal package
exports.

Enforces a consistent test package layout.
This makes it difficult to test internal
functionality, which I believe promotes
healthy decomposition, and minimal package
exports.
@kylecarbs kylecarbs self-assigned this Feb 3, 2022
@codecov

codecov Bot commented Feb 3, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #156 (4afc5a3) into main (b6d27ad) will increase coverage by 0.37%.
The diff coverage is n/a.

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittest-go-macos-latest 63.96% <ø> (+0.07%) ⬆️
unittest-go-ubuntu-latest 65.71% <ø> (-0.16%) ⬇️
unittest-go-windows-latest 63.71% <ø> (+0.04%) ⬆️
unittest-js 64.21% <ø> (ø)
Impacted Files Coverage Δ
provisionerd/provisionerd.go 68.94% <0.00%> (-0.74%) ⬇️
peerbroker/listen.go 84.80% <0.00%> (+2.39%) ⬆️
peer/channel.go 87.19% <0.00%> (+2.43%) ⬆️
peer/conn.go 79.48% <0.00%> (+2.82%) ⬆️
peerbroker/dial.go 80.95% <0.00%> (+4.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6d27ad...4afc5a3. Read the comment docs.

@bryphe-coder bryphe-coder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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! 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I love enforcing these conventions. Consistency is key!

@kylecarbs
kylecarbs merged commit 75468fa into main Feb 4, 2022
@kylecarbs
kylecarbs deleted the testpackage branch February 4, 2022 18:06
nickvigilante added a commit that referenced this pull request Nov 24, 2026
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.
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.

3 participants