Skip to content

tidy-confops: one transaction for the per-field server setters - #244

Merged
dinstein merged 1 commit into
mainfrom
tidy-confops
Aug 7, 2026
Merged

tidy-confops: one transaction for the per-field server setters#244
dinstein merged 1 commit into
mainfrom
tidy-confops

Conversation

@dinstein

@dinstein dinstein commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Nightly tidy over internal/confops + internal/registry.

  • 1. confops: mutateServer — one transaction for the three per-field server setters, so the id refusal cannot be dropped by a fourth

Checked and deliberately not done:

  • SetCallsEnabled / SetAuditKeyID share a before/after ResolvedCalls() pair whose ordering is load-bearing, but there are only two of them and collapsing them would rely on "an identical write does not bump the generation" being true. Correctness that has to be reasoned about is not a tidy-night change.
  • internal/registry: zero duplicated blocks, zero dead functions.
  • The omitzero rule (AGENTS.md) verified across every persisted selector: ServerEntry.Tools, ToolSelector.Allow, Profile.Servers, and the api/ctlapi wire twins all carry omitzero. Profile.Tools is a map where absence of a key already means "no rule", so omitempty there is correct.

SetServerEnabled, SetServerTrace and SetServerTools each opened the same
transaction: look the id up in tx.Servers, refuse if it is absent, assign
one field, write the doc back, report the spec. Eighteen lines apiece,
differing in the assignment.

The refusal is the part worth making structural. Every reference to a
server id is checked so a typo becomes an error rather than a ghost entry
— and a fourth setter written by copying one of these three is exactly
how that check goes missing, silently, because assigning a field of a doc
that came back zero-valued reads as having worked.

mutateServer is that transaction once, taking the assignment as a func
that may itself refuse (SetServerTools keeps its allowList step inside
it). No behaviour change.

make ci green.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dinstein
dinstein merged commit 4e11e2e into main Aug 7, 2026
3 checks passed
@dinstein
dinstein deleted the tidy-confops branch August 7, 2026 12:33
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