Skip to content

test(minimald): drive an opted-out request through the channel, and verify runs it - #3286

Merged
bryan-minimal merged 2 commits into
mainfrom
test/tel045-opt-out-channel-line
Nov 13, 2026
Merged

bryan-minimal merged 2 commits into
mainfrom
test/tel045-opt-out-channel-line

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #3165, which merged with two of Norrie's review points open.

The in-box path had no test at the record. The guard that keeps an opted-out request's command line out of the daemon's session channel handling trace record was covered only through channel_request_span, called directly, so a later change to the guard or to the record could bring the argv back without a failure. The new unit test drives BoxChannel::run through the request sender with a plain public-exposure request and an otel%off% one, under a thread-local TRACE subscriber, and asserts three things: the plain request's record carries its line, the opted-out request's line is in no record, and every record under the opted-out request carries the telemetry="opt-out" mark the export layer honours.

TEL-045's verify line did not run the in-box test. Its nextest filter was the name of one test; it now filters on the stem all three unit tests share, and the test: list names the new one.

Test only, no behaviour change. The full CI mirror on Linux (workspace nextest, the native daemon e2e, clippy, doctests) passes, and the lab's opt-out scenario and baseline hold on Ubuntu 24.04 and Fedora against this tree.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded coverage for public-exposure requests, confirming they receive a refusal response and that telemetry-opted-out request details are excluded from logs.
  • Documentation
    • Updated telemetry verification guidance to include checking that opted-out request traces are not logged.

…erify runs it

Two review points on #3165 that merged open. The in-box path had no test
that drives `BoxChannel::run` with an `otel%off%` line and checks the
channel's own trace record, so a change to the guard at the record could
bring the command line back without a failure. The new test sends a plain
public-exposure request and an opted-out one through the request sender
under a thread-local TRACE subscriber: the plain request's
`session channel handling` record carries its line, the opted-out
request's line is in no record, and every record under it carries the
opt-out mark the export layer honours.

TEL-045's verify line now filters on the stem all three unit tests share,
so running it checks the in-box path too, and its test list names the new
one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The test channel setup now retains and returns a request sender. An actor-loop test checks refusal responses and verifies that an opted-out request is omitted from the channel trace log. The TEL-045 specification includes this verification.

Changes: Channel actor telemetry test

Layer / File(s) Summary
Exercise telemetry opt-out through the channel
crates/minimald/src/env.rs, docs/specs/25-spec-telemetry/25-spec-telemetry.md
Channel setup returns a request sender for tests. The actor-loop test checks refusal responses for ordinary and opted-out requests, verifies that the opted-out request is excluded from the log, and checks the opt-out marker on its records. TEL-045 now lists this verification.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related issues

  • gominimal/minimal issue 1992 — The change tests one part of the issue’s telemetry consent controls: opted-out request logging.

Possibly related PRs

  • gominimal/minimal#3165 — This PR tests the opted-out request logging behavior introduced by PR #3165. Both changes update TEL-045.

Suggested reviewers: agent-137

Merge Risk: Minimal · up to a6226

This change adds a test and updates the telemetry spec, with no production behavior change. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title uses Conventional Commit form (test(minimald): ...) and names the main change: a test that drives an opted-out request through the channel and verifies it runs. It is accurate to the changes…
Description check Passed The description follows the template's Summary, Testing, and Checklist sections in substance. The Summary explains the why: the in-box path had no test at the record, and TEL-045's verify line did not…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title uses Conventional Commit form (test(minimald): ...) and names the main change: a test that drives an opted-out request through the channel and verifies it runs. It is accurate to the changeset, which adds an in-box unit test for BoxChannel::run. It is slightly long at 82 characters, and the wording 'and verify runs it' is a little vague about what is verified, but it is related to the main change.

Full details: Description check

Explanation

The description follows the template's Summary, Testing, and Checklist sections in substance. The Summary explains the why: the in-box path had no test at the record, and TEL-045's verify line did not run the in-box test. It links the prior work (#3165) but uses no Refs or Closes keyword. The Testing section lists the CI mirror and the lab scenarios as passing, but it does not paste the command output the template asks for. The Checklist is not ticked, and the description does not state whether docs were updated, although the spec file change suggests they were. The description is mostly complete, so this passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Vale (3.24.0)

{
"Line": 13,
"Path": ".vale.ini",
"Text": "Style 'ste' isn't on the StylesPath (/styles). If it's a package, run vale sync.",
"Code": "E201",
"Span": 23
}

A rabbit sends a request through the channel,
One opts out; its trace stays away.
Both receive the refusal reply,
The plain request leaves a logged line.
The test checks each mark in turn,
TEL-045 records what it found.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 365678e3-bfe2-43ee-b844-4e16c79e2b9d
Commits

Reviewing files that changed from the base of the PR and between de6a590 and a622690.

Files selected for processing: 2

  • crates/minimald/src/env.rs
  • docs/specs/25-spec-telemetry/25-spec-telemetry.md

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Spec lint

No findings across 1 spec(s).

Advisory, and never a merge gate. Linter: gominimal/foundry@5ffd41cf, spec format: How Minimal Writes Specs.

@bryan-minimal
bryan-minimal marked this pull request as ready for review November 11, 2026 20:16
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 11, 2026 20:16
@minimal-foundry

minimal-foundry Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Reviewed: no findings; approval withheld, 1 thread unresolved at a62269007e54.

APPROVE withheld: 1 unresolved thread — norrietaylor docs/specs/25-spec-telemetry/25-spec-telemetry.md. Resolving the last thread releases the approval on this head.

Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot 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.

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 11, 2026

@norrietaylor norrietaylor 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.

Scope matches the title. The diff adds one test, threads the request sender out of the channel test helpers, and widens one verify line in the telemetry spec. Clobber none. git log on both files shows the last change before this one is the fix this PR follows up (#3165). Nothing from that fix is reverted. Correctness The new test drives BoxChannel::run through the sender. It fails if the trace != TaskTrace::OptedOut guard at env.rs:1684 goes away, because the guarded trace! logs the whole line, otel%off% prefix included. The port=3232 lines come from the info! in refuse_public_expose, and that event runs inside the request span. The fmt layer shows the span's recorded telemetry field on that event. The helper refactor keeps every existing call site working, and the channel capacity of 4 holds both sends before run drains them. One finding: the widened verify filter now matches five minimald tests and no longer fails when a named test goes missing. Not checked that the test passes. That needs a build. The test also depends on a thread-local TRACE subscriber seeing a callsite that other tests can register first. test_harness::SpanLog documents this risk under libtest. Under nextest each test is its own process, so the risk does not apply there.

that request: a non-recording span and no command line.
tier: T0
verify: cargo nextest run -p minimald an_opted_out_request_leaves_no_daemon_span
verify: cargo nextest run -p minimald an_opted_out

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.

low · The an_opted_out filter matches five minimald tests, not the three that the PR body names. It also runs connection.rs::an_opted_out_forward_or_attach_is_marked_and_unsampled and exec.rs::an_opted_out_git_span_is_marked_opt_out, which test other paths. The old full-name filter made nextest exit non-zero when it matched no test. With the stem, a rename or removal of a TEL-045 test still leaves the verify line green, because the other matches keep it passing. Every other verify line in this spec names one full test. Name the two minimald tests explicitly. nextest takes several filter arguments.

Suggested change
verify: cargo nextest run -p minimald an_opted_out
verify: cargo nextest run -p minimald an_opted_out_request_leaves_no_daemon_span an_opted_out_helper_request_

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.

Taken in a622690: the verify line names the three minimald tests the test: lines list (an_opted_out_request_leaves_no_daemon_span, the two env.rs helper tests), so a rename or removal of any of them fails the line; the client-side do_not_track_sends_the_opt_out_and_no_traceparent stays on the test: line, since the verify line is one crate. spec-lint is clean at this head.

The stem `an_opted_out` matched five minimald tests, two of them for
other requirements, so a rename or removal of a TEL-045 test left the
line green. The line names the three tests, as the other lines do.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@minimal-foundry minimal-foundry Bot 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.

minimal-review — approval withheld

Verdict COMMENT — APPROVE withheld: 1 unresolved thread — norrietaylor docs/specs/25-spec-telemetry/25-spec-telemetry.md. No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot removed the review:approved minimal-review approved the current head label Nov 13, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 27fc907 Nov 13, 2026
40 checks passed
@bryan-minimal
bryan-minimal deleted the test/tel045-opt-out-channel-line branch November 13, 2026 05:18
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.

2 participants