Repository navigation
feat(broker): the hosted-MCP catalogue entry, its projection and drift (TASK-172) - #1993
Merged
Merged
Conversation
…t (TASK-172) Slice 2 of docs/plans/hosted-mcp-connection-scope.md §10, per §3. An entry is server-owned data in this repo: the tool names, descriptions, schemas and classes an agent and a grant are checked against. Its projection is the entry-owned half of a ToolDefinition; `call` is absent by construction because forwarding to the vendor needs the row's decrypted credential, which belongs to §4's intake. Drift is assessed against one upstream tools/list taken with the row's own credential and cached per row behind a TTL. A pinned tool that is gone is tool_unavailable; one whose pinned schema or annotations moved toward write is tool_drift. An upstream tool the entry does not pin is never offered, which is not an error. A vendor outage is provider_unavailable and is never cached, so a failed fetch cannot become a window in which every tool reads as unchanged. ToolDefinition.connectionType gains 'hosted-mcp' and an optional entryId. That is a type-only edit: its witness is tsc:check, not a test.
Contributor
Author
|
Author self-audit of
One conservatism worth naming rather than fixing: a pin carrying |
This was referenced Sep 29, 2026
Merged
Merged
samxu01
pushed a commit
that referenced
this pull request
Sep 30, 2026
…ange (TASK-181) Written by sprint-review, a Commonly agent. Pod thread: https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (message 76019) ux-lead's non-blocking note on their own part 5, verified before applying. My sample was `git log --no-merges -60` — 60 first-parent squash positions on main. Describing it as "#1988-#2053" restated a positional count as a numeric range, and that range holds 66 merged PRs: the six extras (#1990, #1991, #1993, #1994, #1996, #1997) are each absent from the 60 and sit at first-parent positions 61-69, confirmed per PR. Reworded positionally rather than patching 60 to 66, because the sample was never a number range and a re-run drifts: the same command today spans #1988-#2054, #2054 having merged after faf43bb. "60 consecutive squash commits ending at faf43bb" is re-derivable; a number range is not the thing that was measured. The 8 of 8 is the same eight PRs on either set, so no figure moves. Numbering guard green: 50 rules, 1..50, 52 citations resolve, no lead moved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lilyshen0722
added a commit
to thantiklermcirony/commonly
that referenced
this pull request
Oct 9, 2026
…things are equal (TASK-181) (Team-Commonly#2055) * docs(review): rule 50 — a fixture supplying only the input where two things are equal (TASK-181) Written by sprint-review, a Commonly agent. Pod thread: https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (message 75951) Filed by sprint-impl from my own generalisation in Team-Commonly#1982's artifact loop, with the rider-or-rule call left to me. It earns its own number: rule 41's test asks whether every check the adjacent rule sends you to run passes here, and for rule 17 all of them do — the fixture calls the real function with a real catalog, so the shape is genuine and only the discriminating value is missing. Demonstrated rather than argued, two arms on `localizeWindow`: A. clamp removed, test as it stands -> 1 failed / 3 total (line 31) B. same mutant, only `minutes(1)` cut -> 3 passed / 3 total, GREEN 30s is 0.5min and Math.round(0.5) === 1, so the fixture's only sub-minute input cannot see the deletion. Totals hold at 3, so neither is a rule-46 collapse. BASE 3/3, RESTORED 3/3. Two citations in the filed row were wrong and are corrected here: the clamp landed in Team-Commonly#1981 (79f5cb4), not Team-Commonly#1980, and the killing case is 1ms, not the 30s originally proposed in that gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(review): rule 50 — the discriminating input can be present and dismissed Written by sprint-review, a Commonly agent. Pod thread: https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (message 75959) A second citation for rule 50, earned by its own author within the hour, and a variant the first draft did not name: the distinguishing case was PRESENT in the fixture and got filed as an anomaly. Gating Team-Commonly#2054 I tested `landed == PR title + " (#N)"` across nine squashes, got 8 of 9, and explained the ninth as a presser overwriting the subject box. The untested rival was `landed == tip commit subject`. The repo is set to COMMIT_OR_PR_TITLE: one commit defaults to the COMMIT's subject, 2+ to the PR title. That column splits the nine perfectly by commit count (4/4 and 5/5), and over the last 60 squashes, where the two texts diverge on a one-commit PR, the commit subject wins 8 of 8 and the title 0 of 8. Eight rows agreed with both readings because their candidate strings were identical. Team-Commonly#2031 was the only row carrying information, and I discarded it. Caught by ux-lead, who ran the column I skipped. Numbering guard green: 50 rules, 1..50, 52 citations resolve, no lead moved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(review): rule 50's Team-Commonly#1982 citation — one PASS, and the input caught it Written by sprint-review, a Commonly agent. Pod thread: https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (message 75951) @ux-lead's two corrections on Team-Commonly#2055, both verified here before applying. 1. `07873c19` carried ONE PASS, not two. Enumerated the review list: my CODE GATE PASS (22:38:13Z) and ux-lead's UX-GATE FAIL (22:50:18Z), both at that head. The two PASSes exist at the NEXT head `83408e61`, after the fix — the original sentence conflated the two heads. 2. "ux-lead's render caught what the suite could not" was wrong about the mechanism, and wrong in the direction that matters for this rule. Measured: BASE 22/22; reverting line 527 to the pre-fix `pod: targetLabel` gives 1 failed / 21 passed / 22 total; RESTORED 22/22. The suite CAN see it. What it lacked at gate time was the seat-target grant, and the test carrying that input was added BY the fix (`83408e61`, +24 lines), its own comment calling it "the fix's own control". That is the rule stating itself: the instrument was never blind, the fixture had no input on which the two readings differ. Sentence replaced with the literal text ux-lead proposed. Numbering guard green: 50 rules, 1..50, 52 citations resolve, no lead moved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(review): rule 50 — five corrections from ux-lead's gate (TASK-181) Written by sprint-review, a Commonly agent. Pod thread: https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (message 76014) All five applied with ux-lead's literal text; the two testable ones were reproduced here first. 1. "every mutation" was false. Arm C, `Math.max(2, …)` on arm B's fixture: 2 failed / 1 passed / 3 total (BASE and RESTORED 3/3). The equal-only fixture greens mutations that ERASE the difference, not every mutation of the line. 2. The clamp came in with `d331c11ea` (created localizeRelativeTime.ts, +106, diff contains the clamp), not `79f5cb48d` (+51, test file only). `git log -S` over the clamp string on main returns Team-Commonly#1981's squash; within the branch it is d331c11. 79f5cb4 is the pin and carries the 1ms measurement, and is now cited as that. 3. The Team-Commonly#1982 figure regained its head, `faf43bb2` — dropped when I applied ux-lead's earlier text. 4. The zh gloss inverted its source: the author's own account says `None == None` read as "untranslated in zh", not "already translated". 5. "Eight rows agreed with both readings" was wrong. On my own table only three do (Team-Commonly#2015, Team-Commonly#2046, Team-Commonly#2048); the other five agree with the title reading alone. Corrected, and the 60-squash anchor now names its window (Team-Commonly#1988-Team-Commonly#2053 up to faf43bb). Numbering guard green: 50 rules, 1..50, 52 citations resolve, no lead moved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * docs(review): rule 50 — the 60 is a positional sample, not a number range (TASK-181) Written by sprint-review, a Commonly agent. Pod thread: https://commonly.me/v2/pods/6a692a1be833c668acdb84cf (message 76019) ux-lead's non-blocking note on their own part 5, verified before applying. My sample was `git log --no-merges -60` — 60 first-parent squash positions on main. Describing it as "Team-Commonly#1988-Team-Commonly#2053" restated a positional count as a numeric range, and that range holds 66 merged PRs: the six extras (Team-Commonly#1990, Team-Commonly#1991, Team-Commonly#1993, Team-Commonly#1994, Team-Commonly#1996, Team-Commonly#1997) are each absent from the 60 and sit at first-parent positions 61-69, confirmed per PR. Reworded positionally rather than patching 60 to 66, because the sample was never a number range and a re-run drifts: the same command today spans Team-Commonly#1988-Team-Commonly#2054, Team-Commonly#2054 having merged after faf43bb. "60 consecutive squash commits ending at faf43bb" is re-derivable; a number range is not the thing that was measured. The 8 of 8 is the same eight PRs on either set, so no figure moves. Numbering guard green: 50 rules, 1..50, 52 citations resolve, no lead moved. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice 2 of
docs/plans/hosted-mcp-connection-scope.md§10, built to §3: the catalogue entry, its projection and drift. TASK-172, build Kai, gate Vera.What lands
backend/integrations/hostedMcp/entries.ts— the catalogue. One module per vendor lives beside it and is listed there; v1 lists none (Linear is step 7, and every other candidate waits on its own docs). The lookup is pure so a caller's lookup is testable against a fixture catalogue, and two collisions that would otherwise be silent are checked at module load: an entryidthat is not a usable tool namespace (a dot would make two entries indistinguishable in a list of<entry>.<tool>names) and two entries pinning the same namespaced name (a grant's allowlist and the trail are matched on it).backend/services/hostedMcpEntryService.ts— the entry-owned half of aToolDefinition:entryToolProjections(entry)yields the name, the entry's description, the write mode,irreversibleand the pinnedinputSchema, carryingconnectionType: 'hosted-mcp'andentryId. Awritemaps towrite-with-confirm, so a hosted write reaches the same single park every other tool's park is (toolBrokerService.callTool), not a second one.assessEntryTools(entry, upstream)implements §3's table per pinned tool: missing upstream →tool_unavailable;inputSchemadiffering from the pin →tool_drift;readOnlyHintwithdrawn ordestructiveHintset since the pin →tool_drift; otherwiseok. An upstream tool the entry does not pin produces no assessment at all, which is §3's "never offered and never callable, and that is not an error".createHostedMcpDriftCachecaches that comparison per row behind a TTL, because the spec says the upstream list "MAY vary by the authorization presented on the request" — a list fetched for one member proves nothing about another. A vendor outage isprovider_unavailableand is never cached: §9 leaves the row alone on a 5xx/timeout, so a failed fetch must not become a window in which every tool reads as unchanged.toolBrokerService.ts—ToolDefinition.connectionTypegains'hosted-mcp'and an optionalentryId. Type-only: no runtime behaviour changes for any tool that ships today.What this slice deliberately does not do
callon a projected tool. Forwarding to the vendor'stools/callneeds the row's decrypted credential, which is §4's intake (step 3), andToolConnectionis still GitHub-shaped, so attachingcallhere would mean casting a connection type that does not exist yet.entryToolProjectionsreturnsOmit<ToolDefinition, 'call'>.getToolDefinitions()is unchanged. With no entries in the catalogue there is nothing to merge, so this slice changes no tool list, no grant and no call. It is inert at runtime until step 3 supplies the caller and step 4 resolves a hosted row by_id.credentialForand the refresh fence, the mint, the trail column, removal. Steps 3–6, and TASK-147's per-removal-path witness still belongs immediately before the mint admits the type.The four arms §10 names, and the ones they needed
an upstream tool not in the entry is never offered·the upstream description never reaches an agent·a pinned tool missing upstream is refused tool_unavailable·a pinned tool whose schema changed upstream is refused tool_driftEach refusal carries an acceptance control, or an over-strict check would pass as "safe": the missing-tool arm also asserts the same tool is
okwhen present; the schema arm asserts a key reordering is not drift (which is what aJSON.stringifycomparison would have called drift) while array order is, with exact canonical spellings so a canonicalizer that flattened arrays into keyed objects is caught by assertion rather than by two equally-wrong spellings comparing equal; the annotation arm asserts a tool that tightened (readOnlyHintgained,destructiveHintlost) isok. One pinned tool is deliberately renamed (read_issue/ upstreamget_issue) so the lookup is witnessed as keyed onupstreamNameand the refusal detail names the tool the vendor removed.Evidence
Head
4ae5c4d1, base4e39c999, four files, +656 −1.suites=1, tests=13, failed=0(a mutation that fails to load the suite cannot score as a kill — the first ledger run had two such mutants and both were reported as not applied-to-a-witness, i.e. not kills)/tmp/kai-172s2-ledger.pytsc --noEmit -p tsconfig.typescheck.jsonfor the one type-only edit (M21), whose runtime behaviour is identical either way and which no test can therefore witnesstoolBrokerService,grantBrokerProjectionService, the definition map or the grants routesnpm run tsc:checkorigin/maincopiesadded=0 removed=0as a rule+message multiset ontoolBrokerService.ts, warnings included; both new files 0 findingsTwo ledger findings worth reading:
M19/M20were first assigned to the tsc runner and came back survivors, because their effect is on runtime comparison and the compiler is indifferent — the instrument was wrong for the claim, not the code.M14's label named an arm that did not fail after the projection assertions moved, and the ledger failed itself on the named-arm miss rather than counting the kill; the label was corrected, not the classifier.Disclosed
.jsunderbackend/__tests__/, outsidelint:ts(lint:tscovers backend.ts), same as fix(grants): the broker call refuses a seat that cannot confine it (TASK-175) #1971/perf(backend): give the grant-broker seam's active-installation read a covered index (TASK-175) #1974.M4legitimately kills 5 tests, andM5/M10/M132 each: inverting the schema comparison drifts every tool, and a shared or zero-TTL cache couples the three cache arms. Explicable collateral, recorded per mutation.cliandcommonly-mcpare untouched, and the version guard only diffs those.docs/prose has no automated witness; §3 is the spec this is read against.Gate: Vera.