Skip to content

refactor(config): one set of config-document editors, out of proxy and dash - #1336

Merged
amiddavid merged 4 commits into
mainfrom
feat/mv-1304-configedit
Nov 24, 2026
Merged

amiddavid merged 4 commits into
mainfrom
feat/mv-1304-configedit

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The config-document editors now live in package config. Proxy and dash call them. Closes #1304. Refs #1309.

What changed

  • New config/edit.go: EditToolfilterRemoved, EditToolfilterDefer, EditAdaptCompaction, DeclConfigName, RemovalNote, ToolfilterRemoved, ToolfilterLists, NameList, WithName, WithComponent.
  • Adapt grid moved: AdaptCandidates, AdaptKnobs, AdaptKnobAllowed, AdaptMerge now live in config. dash keeps AdaptCompactionCandidates, AdaptCompactionMerge, AdaptCompactionKnobAllowed and the Kind* constants as aliases of them.
  • removedFrom and nameList were the same decode. Now one: config.NameList.
  • editRemoved and editDefer shared one body. Now toolfilterBlock and applyToolfilter in config.
  • Proxy keeps thin wrappers so no existing test needed an edit. The only host logic left is editStatus: config.ErrUnloadable becomes 409, any other error 400.
  • Not touched: docDefers and deferOn (refactor(tooldefer): move the tool-deferral flow out of the proxy #1299). deferSettings still calls docDefers for "is deferral on". The library editor takes that answer as the on argument, so it holds no deferral check.

Behaviour

None. Written text, error text and HTTP status are the same.

Data dependence

Same as before. These editors read and write the config document only. No stored customer data. No docs/data-dependence/ row changes.

How it was tested

macOS, Go 1.27.4.

  • Golden files first. 42 files in config/testdata/editgolden/ hold the exact text each editor writes (comments are normalised by ApplyForm, key order fixed). They were checked against unmodified origin/main and pass there. The proxy test and the config test read the same files.
  • Mutation: removing delete(blk, "always_defer") makes the config and proxy golden tests fail (defer-on-always, defer-flip-always).
  • go build ./... && go vet ./... && gofmt -l .: clean.
  • go test ./config ./proxy/... ./dash/... ./cmd/...: pass.
  • Race: ./config pass, ./dash/... pass. ./proxy/... had one failure, TestMetricsCallLatency (p99 timing, run while 6 other agents used the machine). It passes alone with -race, with the editor, defer, tool-filter and adapt tests.

Technical notes

  • config now imports internal/skills for DeclConfigName. internal/skills imports no repo package, so there is no cycle.
  • dash.Kind* alias config.Kind*, so the kind strings have one source.

…d dash

Move the toolfilter, save-more tools and adapt-compaction document edits into
package config: EditToolfilterRemoved, EditToolfilterDefer, EditAdaptCompaction,
DeclConfigName, RemovalNote and their helpers. The proxy keeps thin wrappers that
map an editor error to an HTTP status. dash keeps its exported names as aliases.

The text written is byte-identical. Golden files taken before the move pin it,
and both the proxy and the config tests read them.

Closes #1304
Refs #1309

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 a5dd8330d8bb approve

Verdict: approve

Findings

None. The move is behavior-preserving. I compared each moved function line by line
against the code the diff removes, and found no difference in logic, error text or
HTTP status.

Non-blocking

  • config/edit.go:246-252 — AdaptCandidates and AdaptKnobs are exported mutable globals.
    dash.AdaptCompactionCandidates and dash.adaptKnobs now alias the same slice and
    map. Today every caller only reads them, so nothing breaks. But any consumer that
    appends to the slice or writes to the map changes the grid for every host at once.
    A future change could unexport them and offer read accessors, or return copies.
  • proxy/toolfilterctl.go:216 — withComponent has no production caller left. Only
    proxy/adapttoolsctl_test.go calls it. The other wrappers (removedFrom,
    deferSettings, withDecl, declConfigName) still serve production routes.
    Consider dropping this one and pointing the test at config.WithComponent.
  • config/edit.go:69-90 — each editor parses the document two to three times per call.
    EditToolfilterRemoved runs ParseForm, then ToolfilterRemoved parses again.
    The same shape existed in the proxy before the move, so this is not a regression.
    A later change could let the editor accept the parsed Form.
  • config/edit_test.go:75-77 — the config test hardcodes the host's deferral answer
    (on := dn == "always"), which restates docDefers' rule. Drift is caught anyway:
    the proxy golden test drives editDefer, which uses the real docDefers, and reads
    the same golden files.

What I checked

  • Read CLAUDE.md and docs/design.md.
  • Read the full diff (one commit, 51 files) and the code around each change.
  • Compared every moved function against the removed code, line by line:
    EditToolfilterRemoved vs editRemoved, EditToolfilterDefer vs editDefer,
    EditAdaptCompaction vs adaptCompactionDoc, NameList vs nameList and the
    inline switch in removedFrom, RemovalNote vs applyNote, DeclConfigName vs
    declConfigName, WithName vs withDecl, WithComponent vs withComponent,
    AdaptMerge vs dash.AdaptCompactionMerge. All identical in logic.
  • Error parity: ErrUnloadable's text is byte-identical to the three 409 strings the
    old proxy code built (adaptctl, toolfilterctl, savemoretools). ErrNotAdaptable
    renders the old 400 message verbatim. editStatus maps 409 for ErrUnloadable and
    400 for everything else, which matches every old status choice.
  • Import graph: config imports only errors, sort, strings and
    internal/skills (which imports nothing from this module). dash and proxy
    import config; config imports neither, so the new dash → config edge and
    the Kind* const aliases create no cycle.
  • The aliased globals (AdaptCompactionCandidates, adaptKnobs) are read-only at
    every call site in dash and proxy; preserveUnmodelled does not mutate
    PipelineKnown.
  • Golden files: checked the byte format against the test code, including the
    trailing space in PIPELINE \n for the error cases (strings.Join(nil, ",") is
    empty). The 42 goldens cover all 8 input documents for all 5 edit kinds plus the
    two adapt edge cases (refused value, stored value outside the grid). Both the
    config test and the proxy test read the same files, so a change that alters one
    byte fails in both packages.
  • Checked every modified file's imports against its remaining code; none unused.
  • Commit message: DCO sign-off and Assisted-By: present, per repo convention.
  • Tests were not run (live tests not approved for this review). The claim that the
    golden files were taken before the move rests on the line-by-line comparison
    above, not on a run.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 a5dd8330d8bb approve

Verdict: approve

Findings

None. I compared every moved function line by line against its old body in proxy/toolfilterctl.go, proxy/savemoretools.go, proxy/adaptctl.go, proxy/adapttoolsctl.go and dash/adaptcompaction.go. Each is a faithful move. I found no case where the written document, the error text or the HTTP status changes.

Non-blocking

  • dash/adaptcompaction.go:71 and dash/adaptcompaction.go:75 — AdaptCompactionCandidates and adaptKnobs are var aliases of the config package's slice and map. Go slices and maps share backing state, so a future sort or write in dash would change the grid in config too. Today every use is read-only (checked all 7 use sites). A getter function, or a copy at the alias, would remove the trap.
  • config/edit_test.go:40 — editGolden has no UPDATE_EDIT_GOLDEN path, but the proxy twin (proxy/configedit_golden_test.go:48) does. To refresh a golden you must run the proxy test. One refresh path for both would be clearer.
  • Each editor parses the document two or three times (ParseForm, then ToolfilterRemoved/ToolfilterLists, and docDefers again in the host). The old code did the same, and the documents are small. Not worth a change now.
  • The PR text says 37 golden files. The tree holds 42. Count error in the prose only.
  • proxy/adapttoolsctl.go:3 — the config import sits in the stdlib import group. Style only.

What I checked

  • The move is faithful. I read the old bodies out of the diff and the new bodies in full:
    EditToolfilterRemoved vs the old editRemoved; EditToolfilterDefer vs the old editDefer;
    EditAdaptCompaction vs the old adaptCompactionDoc; RemovalNote, DeclConfigName,
    WithName, WithComponent, NameList, AdaptMerge, AdaptKnobAllowed vs their old
    proxy and dash bodies. Every step, every key written, every deletion and every
    Pipeline/PipelineKnown assignment matches.
  • Error text and status. ErrUnloadable's message is byte-identical to the three old
    inline 409 messages (I concatenated each old string pair and compared).
    editStatus maps ErrUnloadable to 409 and everything else to 400, which is the old
    mapping in all three hosts. ErrNotAdaptable's text matches the old 400 message.
  • The defer path reads the same values. Old editDefer read keep and always from one
    ParseForm and on from docDefers. New editDefer passes on from docDefers and reads
    keep/always inside config.EditToolfilterDefer via ToolfilterLists. Both parse the same
    document with the same ParseForm, so the values are the same.
  • Golden tests. Both new tests read the same 42 files in config/testdata/editgolden.
    The config test's on := dn == "always" matches what docDefers answers for each of the 8
    input documents (I checked each: only always has toolfilter in its pipeline with
    defer: auto). I traced removed-add-full, defer-flip-always, defer-flip-minimal,
    adapt-full, adapt-minimal and adapt-nopipe through ParseForm, AdaptMerge and
    ApplyForm by hand; each golden matches the traced output.
  • Import cycle. config now imports internal/skills. I checked: internal/skills
    imports no repo package. dash already imported config. No cycle.
  • Shared state. All users of AdaptCandidates, AdaptKnobs, AdaptCompactionCandidates
    and adaptKnobs are read-only. ApplyForm's normalize/validate and
    preserveUnmodelled do not mutate PipelineKnown, so assigning the package-level
    AdaptCandidates into a form is safe.
  • Name collisions. No other file in package config defines the new exported names.
  • Leftover callers. removedFrom, withDecl, withComponent, declConfigName,
    applyNote, deferSettings, editDefer, editRemoved and adaptCompactionDoc keep their
    old signatures; the existing tests in proxy/adapttoolsctl_test.go still exercise them.
    withComponent keeps its test callers. No dead code was left.
  • Repo rules. No component added, so no docs/data-dependence/ row is needed. The PR
    states "Behaviour: none" and my line-by-line comparison confirms it. The commit carries the
    DCO sign-off and Assisted-By:. The new tests wait on no clock.
  • I did not run builds or tests: this review reads code only, as instructed. The PR reports
    the goldens pass on unmodified origin/main; my reading of the moved code is the check
    I could do here, and it agrees.

…efresh

- AdaptCandidates and AdaptKnobGrid return copies. The package globals are
  unexported, so a caller cannot change them. dash keeps its own copies.
- The config golden helper has the same UPDATE_EDIT_GOLDEN refresh as the proxy twin.
- Put the config import in the repo import group in proxy/adapttoolsctl.go.

Refs #1304

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round 1 notes, all handled. Head: b75a271.

  1. Exported mutable globals: fixed in b75a271. AdaptCandidates() and AdaptKnobGrid() return copies. The globals are unexported. dash holds its own copies and no dash test changed. TestAdaptAccessorsReturnCopies changes a returned copy and checks the next call.
  2. Golden refresh: fixed in b75a271. editGolden has the same UPDATE_EDIT_GOLDEN path as the proxy twin. The two stay separate helpers because they sit in different packages and test files.
  3. Import group: fixed in b75a271.
  4. Golden count: fixed. The PR text now says 42.

Kept as is:

  • withComponent wrapper. It keeps the existing proxy test unedited, as the move rules require.
  • 2-3 parses per editor. The old code did the same. The documents are small.
  • Hard-coded on in config/edit_test.go. The proxy golden test runs the real docDefers on the same golden files, so the two answers are checked against each other.

Tests at b75a271 (macOS, Go 1.27.4): build, vet and gofmt -l clean. Unit tests pass for ./config, ./proxy/... and ./dash/.... Race passes for ./config and ./dash/....

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 b75a271b0c0c approve

Verdict: approve

Findings

None. The one new commit fixes the shared-state trap from round 1 and changes
nothing else in behavior.

Round-1 findings, checked against b75a271

  • Mine, non-blocking 1 (exported mutable globals AdaptCandidates / AdaptKnobs): fixed.
    The globals are unexported (adaptCandidates, adaptKnobs). AdaptCandidates()
    returns a slice copy; AdaptKnobGrid() returns a deep copy (outer map, inner
    maps, value slices). dash takes its own copies at init
    (dash/adaptcompaction.go:71,75), so no aliasing remains between the packages.
    EditAdaptCompaction now assigns a fresh copy to PipelineKnown
    (config/edit.go:351), so even a future mutation inside ApplyForm could not
    reach the grid. TestAdaptAccessorsReturnCopies mutates a returned copy and
    checks the next call, including AdaptKnobAllowed.
  • Mine, non-blocking 2 (withComponent has no production caller): rejected by the author, reason accepted.
    The wrapper keeps the existing proxy test unedited, which the move rules ask
    for. It is a one-line delegate to config.WithComponent, so it carries no risk.
  • Mine, non-blocking 3 (two to three parses per editor): rejected, reason accepted.
    The old code did the same, and the documents are small. Not a regression.
  • Mine, non-blocking 4 (hard-coded on in the config test): rejected, reason accepted.
    The proxy golden test runs the real docDefers over the same golden files, so
    the two answers are checked against each other.
  • Reviewer 1's findings: agree, all fixed in b75a271. I checked each myself:
    the mutable-alias finding (same fix as mine, verified above), the missing
    UPDATE_EDIT_GOLDEN path in the config editGolden (now present,
    config/edit_test.go:41-47, same shape as the proxy twin), the import group in
    proxy/adapttoolsctl.go (now in the repo group), and the golden-count prose
    (now 42; I counted 42 .golden files in config/testdata/editgolden).
  • The author's round-1 notes (amiddavid, 2026-11-24T09:49:58Z) answer every
    non-blocking point. I found no request in them that is unaddressed.

Non-blocking

  • dash/adaptcompaction.go:71 — AdaptCompactionCandidates is still an exported
    mutable var in dash. That was also its shape before this PR, and it no
    longer shares state with config, so this is the status quo, not a new trap.

What I checked

  • Last review: round 1, a5dd833, 2026-11-24T09:24:35Z.
  • New commits read: 1 (b75a271 "refactor(config): return copies of the adapt
    grid, share the golden refresh").
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files
    .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt).
  • New items since my last review: my own round-1 review, reviewer 1's round-1
    review, and the author's round-1 notes comment. Each is addressed above.
  • Read the new commit's full diff (git diff a5dd8330..b75a271b) and the changed
    files around the changes. Grep confirms no reference to the old exported
    globals remains: every use of AdaptCandidates/AdaptKnobGrid goes through
    the copy-returning accessors, and IsAdaptCandidate/AdaptKnobAllowed read
    the unexported globals only.
  • Verified the copies are real: AdaptCandidates is
    append([]string(nil), adaptCandidates...); AdaptKnobGrid rebuilds the outer
    map, each inner map, and each value slice. dash's package-init copies run
    after config's init, because dash imports config.
  • Verified editGolden's new refresh path writes to
    config/testdata/editgolden and matches the proxy helper's shape.
  • No behavior change: the accessors only change who holds the slice and map, not
    the values. The commit message states this and the diff confirms it.
  • The author reports tests at b75a271 (macOS, Go 1.27.4): build, vet, gofmt
    clean; unit tests pass for ./config, ./proxy/..., ./dash/...; race for
    ./config and ./dash/.... I did not run tests myself (not approved this
    round).

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 b75a271b0c0c approve

Verdict: approve

Findings

None.

Earlier findings

  • Reviewer 1, round 1, non-blocking: dash vars aliased config's mutable grid. Fixed in
    b75a271b. adaptCandidates and adaptKnobs in config/edit.go are now unexported.
    AdaptCandidates() returns a slice copy; AdaptKnobGrid() returns a deep copy (outer map,
    inner maps, value slices). dash/adaptcompaction.go:71,75 now takes its own copies at init,
    so a dash write can no longer reach config. EditAdaptCompaction puts a fresh copy into
    f.PipelineKnown, and preserveUnmodelled only reads it. Checked.
  • Reviewer 1, round 1, non-blocking: config golden test had no refresh path. Fixed.
    editGolden in config/edit_test.go now has the same UPDATE_EDIT_GOLDEN path and the same
    "run with UPDATE_EDIT_GOLDEN=1" hint as the proxy twin. Checked.
  • Reviewer 1, round 1, non-blocking: config import in the stdlib group. Fixed in
    proxy/adapttoolsctl.go. Checked.
  • Reviewer 1, round 1, non-blocking: PR text said 37 goldens, tree holds 42. Fixed. The PR
    body now says 42. Checked against the live PR body.
  • Reviewer 2, round 1, non-blocking: withComponent wrapper has no production caller.
    The author kept it, to leave the existing proxy test unedited. The reason is sound: the
    wrapper is one line and the test still checks real behavior through it. Accepted.
  • Reviewer 2, round 1, non-blocking: 2-3 parses per editor. The author kept it. The reason
    is right: the old proxy code had the same shape, so this is not a regression. Accepted.
  • Reviewer 2, round 1, non-blocking: hard-coded on in the config test. The author kept
    it. The reason is right: the proxy golden test runs the real docDefers over the same
    golden files, so the two answers check each other. Accepted.

New commit

b75a271b changes 4 files, 54 insertions, 12 deletions. I read the full diff and the code
around each change:

  • config/edit.go — the two globals became unexported; two copy-returning accessors were
    added; IsAdaptCandidate, AdaptKnobAllowed and EditAdaptCompaction now read the
    unexported globals. The values are the same, so no behavior change. No other package used
    the old exported vars: I grepped the whole tree at the new head; every reference is either
    the new accessors, the new test, or dash's updated init.
  • config/edit_test.go — new TestAdaptAccessorsReturnCopies. It mutates a returned
    candidate slice, a returned grid's inner map, inner slice and outer map, then checks the
    next call sees the original values, and that AdaptKnobAllowed still answers from the
    untouched grid. The checks are correct for slice, map and nested isolation.
  • dash/adaptcompaction.go — the two vars now copy from config at init. All 7 dash use
    sites read only, so the copy is equivalent.
  • proxy/adapttoolsctl.go — import moved to the repo group. strings and skills are
    still used in the file.

Non-blocking

  • config/edit.go:278 — the comment on IsAdaptCandidate still says "one of AdaptCandidates",
    which is now a function, not a list. Wording only.

What I checked

  • Last review: round 1, a5dd833, 2026-11-24T09:25:19Z.
  • New commits read: 1 (b75a271b "refactor(config): return copies of the adapt grid, share
    the golden refresh").
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files
    .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt; the inline
    file is empty).
  • New items since my last review:
    • Reviewer 2's round-1 review (posted 09:24:35Z, 44 seconds before mine). I read it in
      full now. Its four non-blocking notes overlap mine; the author fixed the aliasing note
      and gave sound reasons for keeping the other three. Nothing in it needs a new finding.
    • Author comment at 09:49:58Z. I checked each claim against the code: globals unexported
      with copy accessors (true), golden refresh path added (true), import group fixed (true),
      PR count now 42 (true, read from the live PR body).
    • Commit b75a271b. Reviewed above, as a first review.
  • No golden file changed in the new commit, so the byte-identity pin from round 1 still holds.
  • I did not run builds or tests: this review reads code only, as instructed.

Comment only.

Refs #1304

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

approved: b75a271 (base 30a8076) patch-id c1468d6b10c5
head: b75a271 (base 30a8076) patch-id c1468d6b10c5
--- git range-diff
1: a5dd833 = 1: a5dd833 refactor(config): one set of config-document editors, out of proxy and dash
2: b75a271 = 2: b75a271 refactor(config): return copies of the adapt grid, share the golden refresh
SAME CHANGE: only the base moved. The approval of b75a271 still counts. Say so on the PR.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

approved: b75a271 (base 30a8076) patch-id c1468d6b10c5
head: bdc646c (base 30a8076) patch-id 1107d9c73dc4
--- git range-diff
1: a5dd833 = 1: a5dd833 refactor(config): one set of config-document editors, out of proxy and dash
2: b75a271 = 2: b75a271 refactor(config): return copies of the adapt grid, share the golden refresh
-: -------- > 3: bdc646c docs(config): fix a comment that named the old AdaptCandidates variable
COMMENTS ONLY: b75a271..bdc646c changes only comment lines in .go and .sh files. The approval of b75a271 still counts. Say so on the PR.

…igedit

Signed-off-by: DAVID AMID <[email protected]>

# Conflicts:
#	proxy/savemoretools.go
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Merged origin/main into this branch (merge commit 9106e89, not a rebase). One conflict.

Conflict: proxy/savemoretools.go, in deferSettings

Resolution: deferConf{on: tooldefer.DocOn(doc), keep: keep, always: always}. The "is deferral on" answer is #1325's. The lists come from config.ToolfilterLists. I also changed one comment in editDefer to say tooldefer.DocOn.

docDefers in proxy/tooldefer.go is now a one-line wrapper of tooldefer.DocOn from #1325. I did not touch it.

Tests (macOS, Go 1.27.4): build, vet and gofmt -l are clean. Unit tests pass for ./config, ./proxy, ./dash/... and ./tooldefer/.... The golden tests are included and pass unchanged.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 offload-review skill, @amiddavid's session resumed 2 of 2 3 of 3 9106e895ca9e approve

Verdict: approve

Findings

None. The branch gained one comment-only commit and a merge of origin/main.
The merge resolves its one conflict correctly. No behavior changed.

Earlier findings, checked against 9106e89

  • All round-1 and round-2 findings were fixed or accepted in round 2. Nothing
    reopened: the merge touches none of the fixed code paths.
  • Reviewer 1's round-2 non-blocking (the IsAdaptCandidate comment named the
    old AdaptCandidates variable): fixed in bdc646c.
    The comment now reads
    "one of the adapt candidates". Comment only, no code change.

New commits

  • bdc646c — comment fix, verified. One line in config/edit.go:278. No
    code change.
  • 9106e89 — merge of origin/main, verified. One conflict, in
    proxy/savemoretools.go, in deferSettings:
    • This branch had deferConf{on: docDefers(doc), keep, always} with the lists
      from config.ToolfilterLists.
    • main (#1325) had replaced docDefers with tooldefer.DocOn and still used
      the local nameList, which this branch had moved to config.NameList.
    • The resolution takes both: on from tooldefer.DocOn, the lists from
      config.ToolfilterLists. That is the correct combination. I read the merged
      deferSettings and editDefer in full, and the file's imports
      (tooldefer added, sort gone).
  • The other commits in git log b75a271b..HEAD (9f34a5c, de4e2f9, d6cc528,
    98c9a74, 8e3e674, 28383ae, c3096ca) came from main through the merge.
    They are not this PR's changes: the PR diff against the new base c3096ca is
    the same 51-file set I reviewed in rounds 1 and 2, plus the merged
    savemoretools.go lines. I read their messages and stats, and checked the two
    that touch this PR's files (#1325 for savemoretools.go, #1315 for
    CLAUDE.md).

Merge-safety checks

  • tooldefer.DocOn answers what the old docDefers answered for every
    input this PR's paths can see. Old: Decode succeeds and defer == "auto".
    New: Decode succeeds and reformat.DeferMode(defer) is on. DeferMode
    maps "" and "off" to off, "auto" to on, anything else to an error, and
    the error path returns false. So the answers agree on empty, off, auto
    and invalid values. The 42 golden files therefore stay valid, as the author
    reports.
  • The golden tests' deferral premise still holds. The proxy golden test
    drives editDefer → deferSettings → tooldefer.DocOn. Of the 8 input
    documents, only always has toolfilter in its pipeline with defer: auto,
    which matches the config test's hard-coded on := dn == "always".
  • No silent drop on either side of the merge. I diffed the merge result
    against both parents for proxy/savemoretools.go: against the branch it adds
    only #1325's tooldefer.DocOn swap; against main it applies only this PR's
    editor refactor. The other PR files (config/edit.go, config/edit_test.go,
    proxy/toolfilterctl.go, proxy/adaptctl.go, proxy/adapttoolsctl.go,
    dash/*, the goldens) are untouched by main, so the merge carried them
    through unchanged.
  • The PR now also satisfies main's new rule ("What goes in the proxy",
    CLAUDE.md from #1315): config-document edits are named there as business
    logic that must live in a library package. This PR is the move that rule
    asks for.

Non-blocking

  • docDefers in proxy/tooldefer.go:251 and the direct tooldefer.DocOn call
    in proxy/savemoretools.go now both exist. Both defer to the same function,
    so they cannot disagree. A later cleanup could drop the proxy wrapper. This
    shape came from main's #1325, not from this PR.

What I checked

  • Last review: round 2, b75a271, 2026-11-24T09:51:46Z.
  • New commits read: 2 on this branch (bdc646c "docs(config): fix a comment
    that named the old AdaptCandidates variable"; 9106e89 "Merge origin/main"),
    plus 7 main commits reached through the merge, listed above.
  • Read in full: 4 reviews, 4 comments, 0 inline comments (from the three files
    .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt;
    the inline file is empty).
  • New items since my last review, and what I did about each:
    • Range-diff notes at 09:53:29Z ("SAME CHANGE") and 09:53:47Z ("COMMENTS
      ONLY"). Mechanical skill output; the claims match what I verified in the
      diffs.
    • Reviewer 1's round-2 review. Its one non-blocking (comment wording) is
      fixed in bdc646c, which I checked.
    • Author's merge note at 10:51:07Z. It describes the conflict and the
      resolution; I verified both against the code and both parents.
  • Read git diff b75a271b..bdc646c1 (one comment line), the merge diffs
    against both parents for the conflicted file, and
    git diff --stat c3096caa..9106e895 (the same 51-file PR set,
    +1153/−294).
  • Read tooldefer/on.go and reformat.DeferMode
    (components/reformat/toolfilter.go:146) to confirm the deferral answers
    did not change.
  • The author reports tests at 9106e89 (macOS, Go 1.27.4): build, vet, gofmt
    clean; unit tests pass for ./config, ./proxy, ./dash/... and
    ./tooldefer/..., golden tests included and unchanged. I did not run tests
    myself (not approved this round).

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 offload-review skill, @amiddavid's session resumed 1 of 2 3 of 3 9106e895ca9e approve

Verdict: approve

Findings

None.

Earlier findings

  • Reviewer 1, round 2, non-blocking: the IsAdaptCandidate comment named the old
    AdaptCandidates variable.
    Fixed in bdc646c1. The comment now says "one of the adapt
    candidates". That commit changes one comment line and nothing else. Checked.
  • All round-1 findings were settled in round 2 (fixed in b75a271b, or kept with a reason I
    accepted). Nothing reopened.

New commits

Two commits since b75a271b, plus main merged in:

  1. bdc646c1 "docs(config): fix a comment that named the old AdaptCandidates variable".
    One comment line in config/edit.go. No code change. Checked in full.
  2. 9106e895 — merge of origin/main (c3096caa) into the branch. Not a rebase: the
    two PR commits keep their SHAs. Main brings 7 commits (docs #1316 and #1315, opencode
    signals #1317, Codex session keying #1322, opencode docs #1339, tooldefer move #1325,
    campaign move #1332). Only proxy/savemoretools.go conflicted, and I checked the
    resolution against both parents:
    • Against our parent (bdc646c1), the merge takes main's rename only:
      docDefers(doc) becomes tooldefer.DocOn(doc) in deferSettings, and the editDefer
      comment follows. Nothing else of ours changed.
    • Against main's parent (c3096caa), the merge keeps our whole refactor:
      deferSettings reads its lists through config.ToolfilterLists, and editDefer writes
      through config.EditToolfilterDefer with editStatus.
    • Both sides are preserved. tooldefer.DocOn (main #1325) answers the same as the old
      docDefers for every input: reformat.DeferMode maps ""/"off" to off, "auto" to
      on, and anything else to an error, which DocOn turns into off — the old code compared
      == "auto". Same answers, so the golden tests' on values are unchanged.
    • docDefers stays in proxy/tooldefer.go:251 as a one-line wrapper of
      tooldefer.DocOn, used by the start-up scan and one test. The author's comment says
      the same; checked.
    • Main's change to components/reformat/toolfilter.go only extracts DeferMode from the
      constructor. The declared field set is unchanged, so ParseForm's readBlocks and the
      golden outputs are unaffected.

The PR's own diff against its new base (c3096caa..9106e895) is the same 51 files I approved
in round 2, plus the comment fix and main's one-line DocOn rename. No golden file changed.

One note on the new CLAUDE.md rule from main (#1315): "edits to the config document" are
business logic and belong in a library package. This PR is the compliance for the toolfilter,
save-more tools and adapt-compaction edits: the editors live in config, and the proxy keeps
only decode, call and status mapping. The PR matches the rule it precedes.

Non-blocking

  • Nothing new. The round-2 notes that remain (2-3 parses per editor, the withComponent
    test-only wrapper, the hard-coded on in the config test) were all kept by the author with
    reasons I accepted in round 2.

What I checked

  • Last review: round 2, b75a271, 2026-11-24T09:52:04Z.
  • New commits read: 2 (bdc646c1 "docs(config): fix a comment that named the old
    AdaptCandidates variable", 9106e895 "Merge remote-tracking branch 'origin/main' into
    worktree-mv-1304-configedit"). The merge brings 7 main commits; I read their stats and the
    two that touch this PR's files in full (#1325's proxy/savemoretools.go,
    proxy/tooldefer.go and components/reformat/toolfilter.go changes).
  • Read in full: 4 reviews, 4 comments, 0 inline comments (from the three files
    .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt; the inline
    file is empty).
  • New items since my last review:
    • Reviewer 2's round-2 review (09:51:46Z, 18 seconds before mine). Read in full. It agrees
      with my round-2 result and adds nothing unanswered.
    • Comment at 09:53:29Z and 09:53:47Z: approval bookkeeping (range-diff, patch-id). The
      "comments only" claim for bdc646c1 I verified myself: one comment line.
    • Comment at 10:51:07Z: the merge note. I checked each claim: the conflict site, the
      resolution text, and the docDefers wrapper. All true.
    • Commits bdc646c1 and 9106e895. Reviewed above, as a first review.
  • Confirmed the PR diff against the new base is the same file set as round 2 (51 files) and
    that b75a271b..9106e895 touches our files only in proxy/savemoretools.go (the DocOn
    rename) and config/edit.go (the comment fix).
  • I did not run builds or tests: this review reads code only, as instructed. The author
    reports the golden tests pass unchanged at 9106e895; my reading of the merge and of
    reformat.DeferMode agrees.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

refactor(config): one set of config-document editors, out of proxy and dash

1 participant