Consolidate the negotiate-down rationale - #6017
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6017 +/- ##
==========================================
- Coverage 72.21% 72.18% -0.04%
==========================================
Files 721 721
Lines 74987 74987
==========================================
- Hits 54152 54128 -24
- Misses 16956 16999 +43
+ Partials 3879 3860 -19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The rule that supportedVersions -- not a clean server/discover response -- is the authoritative Modern signal was explained in full at three sites: the errModernNegotiatedDown doc in modern.go, and both modernDiscover and probeRevision in client.go. That is the surface someone has to edit whenever the exact-match tripwire fires for a newer Modern revision, so three copies is three chances to update two of them. Keep the explanation on errModernNegotiatedDown, which is the thing being explained, and have the other two back-reference it. Both retain the concrete local behaviour they describe; only the shared reasoning moves. Comment-only change. Refs #6002
2d2130b to
a163320
Compare
|
Rebased onto #6013 was squash-merged as a single commit ( Rebuilt as Re-verified after the rebase rather than assuming the cherry-pick was faithful:
Also note the earlier |
jhrozek
left a comment
There was a problem hiding this comment.
Reviewed the diff — comment-only, verified nothing but // lines changed. The consolidation is the right call: three copies of a rule that all have to change together when a newer Modern revision lands is a real hazard, and keeping it on errModernNegotiatedDown puts it on the thing being explained.
Two textual nits, neither blocking:
-
modern.go:110 says "the exact-match tripwire in modernDiscover", but the tripwire lives in discoverModernCapabilities (client.go:1068) — modernDiscover just builds the client and delegates. The other two references in this file get it right (modern.go:427 and :433 both name discoverModernCapabilities), so this one is the odd one out. Slightly unfortunate given the whole point is a single authoritative place naming the edit surface.
-
The removed modernDiscover text cited mcp/client.go:428-444, and the surviving canonical cites :360-369. Those are different spots in go-sdk — :360-369 is the -32022/data.supported path (source 2), :428-444 was the discover/supportedVersions path (source 1). :428-444 is now gone from the repo entirely, so the canonical block documents both sources but only carries source 2's citation. Worth listing both.
Happy either way — fold them in or land as-is.
Follow-up to review feedback on #6017, which landed as-is. Both are factual errors in the comment block that PR made canonical, which makes them worth fixing rather than leaving: the whole point of consolidating was to have one place that correctly names the surface a future editor has to touch. The block pointed at "the exact-match tripwire in modernDiscover", but the tripwire is the supportedVersions check in discoverModernCapabilities; modernDiscover only builds the transport and delegates to it. Two other references in the same file already named discoverModernCapabilities correctly, so this one was the odd one out. The block also documents two sources for the sentinel but carried only the second one's go-sdk citation. The first source's citation (mcp/client.go:428-444, the discover/supportedVersions path) left the repo entirely when the duplicated text in modernDiscover was removed, so the reference for source (1) was silently lost. Both are now cited and labelled by source. Comment-only change.
Summary
#6002 item 4. The rule that
supportedVersions— not a cleanserver/discoverresponse — is the authoritative Modern signal was explained in full at three separate sites: theerrModernNegotiatedDowndoc inmodern.go, and bothmodernDiscoverandprobeRevisioninclient.go.That matters more than ordinary comment duplication because it is precisely the surface someone must edit when the exact-match tripwire fires for a newer Modern revision. Three copies is three chances to update two of them and leave the third quietly contradicting the code.
The explanation now lives on
errModernNegotiatedDown— the thing being explained — marked as the canonical site and naming its two dependents. The other two back-reference it. Both retain the concrete local behaviour they describe (what each function returns, and when); only the shared reasoning moved, so neither doc comment became less useful on its own.Comment-only: no statement, expression, or signature changed.
Type of change
Test plan
task test) — unchanged; onlypkg/apiandpkg/secrets/keyringfail, both environmental and verified identical onmaintask lint) — 0 issues (this is the gate CI runs:golangci-lintplusgo vet ./...)Verified the de-duplication actually happened rather than being asserted:
grep -rn "answers both server/discover\|answers server/discover even" pkg/vmcp/client/*.gonow returns exactly one hit, the canonical site inmodern.go. Before the change it returned three.API Compatibility
v1beta1API.No API surface of any kind is touched.
Does this introduce a user-facing change?
No.
Special notes for reviewers
The issue itself rates this item low-value, and I agree — it is worth having only because that comment block is load-bearing for the tripwire. Reasonable to reject in favour of leaving the duplication in place; nothing depends on it.
Refs #6002
Generated with Claude Code