Skip to content

fix(hosted-mcp): a catalogue pin cannot contradict its class or its namespace (TASK-172) - #2014

Merged
lilyshen0722 merged 2 commits into
mainfrom
kai/task172-entry-preconditions
Sep 29, 2026
Merged

lilyshen0722 merged 2 commits into
mainfrom
kai/task172-entry-preconditions

Conversation

@lilyshen0722

@lilyshen0722 lilyshen0722 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

TASK-172's entry-time preconditions (Vera's, on the row), as one PR. assertHostedMcpEntries is the only thing standing between a hand-written catalogue entry and the first vendor, and until now it checked collisions only.

The three guards

  • A tool name cannot carry the namespace separator. linear.a.b would name two things, and the segment is what a seat reads.
  • A pin cannot contradict its own class. class: 'read' beside destructiveHint: true or readOnlyHint: false is refused. The class is what writeModeFor turns into read — so the call runs unparked — and what the drift comparison starts from, so movedTowardWrite can no longer report the vendor moving: the pin has already recorded the move §3 says has to be a PR.
  • A read pin has to CLAIM read-only, not merely avoid denying it (Vera's HOLD, measured through assessEntryTools). movedTowardWrite's first direction is keyed on the pin's own claim (pinned.readOnlyHint === true), so a read pin carrying no annotation can never be told the vendor withdrew it: a silent pin against an upstream answering readOnlyHint: false scores ok, and the read grant stands against the vendor's explicit denial. A silent pin is the default an author writes, so this is the likely state rather than an exotic one.

The claim guard sits after the explicit-denial guard, so readOnlyHint: false is refused by the message that names its own contradiction rather than relabelled as a missing claim. That ordering is load-bearing and measured (M04 and M09).

Consequence, recorded rather than met later: a read pin now needs its vendor to keep saying readOnlyHint: true, since a vendor that says nothing reads as a withdrawal of the claim. A tool whose vendor annotates nothing can only be pinned write. That is a scope question for whoever writes the first catalogue entry, not a defect in this guard.

The charset, and why it is not the literal one

The precondition as written is /^[a-z0-9-]+$/. Measured against the tool names this broker already offers:

name segment literal charset
list_issues (github.list_issues) REFUSED
get_pull_request REFUSED
list_pull_request_files REFUSED
…the other five in toolBrokerService.getToolDefinitions REFUSED

8 of 8 shipped segments are refused by it (the check is on the segment; the assembled names were only ever illustration, and the . is refused by both forms). A hosted entry would be the first name in the tool list written against a different convention from every name already in it. So the guard is /^[a-z0-9_-]+$/: the character worth excluding is the separator, not the one the shipped vocabulary is spelled with. Vera ruled kebab-only closed on 2026-09-29 after re-measuring both directions (8 of 8 refused, 8 of 8 accepted).

Blast radius had the literal form been chosen: it reddens 6 arms in hostedMcpEntry.test.js (13 passed / 6 failed) — loudly, not by re-attributing them — because that file's fixtures spell names with _. The other seven catalogue-touching suites are untouched because their fixtures never reach the assertion.

Rule 42 discipline

A guard added above existing ones can invalidate the arms below it, so the existing arms whose inputs reach the new guards were enumerated rather than assumed. The refusal arms in hostedMcpEntry.test.js are the duplicate-entry-id arm (id: 'lin.ear', whose tools pass the new charset) and the duplicate-tool-name arm ([pinned({}), pinned({})], both clean on class, claim and charset) — both still answered by the guard they name, confirmed by the neighbourhood staying green. No arm was re-aimed because none was re-routed.

Arms, each with its acceptance control

  • dotted, spaced and capitalised names refused; list-issues and the shipped list_issues pass;
  • destructiveHint: true on a read pin refused; the same annotation on a write pin passes, and destructiveHint: false on a read pin passes (a tightened claim is not a contradiction);
  • readOnlyHint: false on a read pin refused; the same on a write pin passes;
  • a read pin carrying no readOnlyHint refused (including one carrying only destructiveHint: false); a write pin carrying no annotations passes, and the shipped read pin passes;
  • the annotation refusals are asserted to differ by name, and the denial arm asserts the denial message — which is what keeps the ordering load-bearing;
  • the hole the claim guard closes is measured through assessEntryTools: the silent pin scores ok against a vendor saying readOnlyHint: false, the claimed pin scores tool_drift / "readOnlyHint withdrawn upstream".

Evidence

  • Ledger /tmp/kai-172vp-ledger.py: 10 mutants, 9 killed, 1 MEASURED EQUIVALENT, 0 survivors — each guard dropped, the charset loosened to its literal form, the charset tightened to it, the two messages swapped, the class test armed on write, the claim guard weakened to === false, moved above the denial guard, and narrowed to === undefined. The equivalence is stated with its reason: every case === undefined would miss is answered by the guard directly above it, which is exactly the ordering M09 shows is loaded. Anchors assert their occurrence count; the file is restored to a pristine copy after every run and asserted.
  • hostedMcpEntry.test.js 19/19; the eight catalogue-touching suites 92/92; full backend 492 suites / 4690 passed / 0 failed.
  • eslint: entries.ts 0 findings; the test file holds at its 15 pre-existing messages — the first draft's for...of was replaced rather than shipped as a 16th.

Backend-only: no version bump.

Not in this diff

§10 step 5, the trail column (whose credential ran), follows in its own PR per the plan.

…amespace

TASK-172's two entry-time preconditions, as one PR. `assertHostedMcpEntries`
is the only thing standing between a hand-written entry and the first vendor,
and it checked collisions only. Two contradictions could land half-wired:

- A tool name carrying the `.` the namespace is built from makes `linear.a.b`
  name two things, and the segment is what a seat reads.
- A pin whose class is `read` while its own annotations say
  `destructiveHint: true` or `readOnlyHint: false`: the class is what
  `writeModeFor` turns into `read` (so the call runs unparked) and what the
  drift comparison starts from (so `movedTowardWrite` can no longer report the
  vendor moving — the pin has already recorded the move §3 says has to be a
  PR). Both directions are refused by name, so the refusal says which
  annotation was found.

The charset is `[a-z0-9_-]`, not the literal `/^[a-z0-9-]+$/`, and the reason is
measured rather than argued: the literal form refuses the spelling of **8 of 8**
tool names this broker already offers (`github.list_issues`,
`github.list_pull_request_files`, and the six others in
`toolBrokerService.getToolDefinitions`), so a hosted entry would be the first
name in the tool list written against a different convention. The character
worth excluding is the separator. Applying the literal form reddens **5 arms**
in `hostedMcpEntry.test.js` (measured 12 passed / 5 failed) — loudly, not by
re-attributing them — because its fixtures spell names with `_`; the other
seven suites are untouched because their fixtures never reach the assertion.
If the ruling is kebab-only, it is a one-character change plus five fixture
renames, and I will do it on request.

Arms, each with its acceptance control: a dotted, spaced and capitalised name
are refused while `list-issues` and the shipped `list_issues` pass; a read pin
carrying `destructiveHint: true` is refused while the same annotation on a
`write` pin and a `read` pin carrying `destructiveHint: false` pass; a read pin
denying `readOnlyHint` is refused while the same on a `write` pin and a pin
carrying no annotations pass; and the two annotation refusals are asserted to
differ by name, since a module-load throw has no code and the text is the only
thing that says which annotation was found.

Ledger: 6 mutants, 6 killed, 0 survivors (`/tmp/kai-172vp-ledger.py`) — each
guard dropped, the charset loosened to its literal form, the charset tightened
to it, the two messages swapped, and the class test armed on `write`.

Evidence: suite 17/17; the eight catalogue-touching suites 90/90; full backend
492 suites / 4688 passed / 0 failed; eslint 0 new findings (`entries.ts` 0,
the test file back to its 15 pre-existing messages — the first draft's `for...of`
was replaced rather than left as a new error).

Next per §10: step 5, the trail column. Not in this diff.
… denying it

Vera's HOLD on #2014, and her measurement is right at the source: the first
direction of `movedTowardWrite` is keyed on the PIN's own claim
(`pinned.readOnlyHint === true`), so a read pin carrying no annotation can never
be told the vendor withdrew it. A silent pin against an upstream answering
`readOnlyHint: false` is scored `ok`, and the read grant stands against the
vendor's explicit denial — and a silent pin is the default an author writes.

`assertHostedMcpEntries` now refuses `class: 'read'` unless
`annotations?.readOnlyHint === true`.

The new guard sits AFTER the explicit-denial guard, so a pin that says
`readOnlyHint: false` is refused by the message that names its own
contradiction instead of being relabelled as a missing claim. The ordering is
load-bearing and measured: dropping the denial guard (M04) or moving the claim
guard above it (M09) both redden the arm that asserts the denial is refused by
name.

Arms, with controls: the claim-less read pin is refused while a `write` pin
carrying no annotations passes and the shipped read pin (which claims
read-only) passes; and the hole the guard closes is measured through
`assessEntryTools` — the silent pin scores `ok` against a vendor saying
`readOnlyHint: false`, while the claimed pin scores `tool_drift` /
"readOnlyHint withdrawn upstream".

Consequence, recorded rather than met later: a read pin now needs its vendor to
keep saying `readOnlyHint: true`, since a vendor that says nothing reads as a
withdrawal of the claim. A tool whose vendor annotates nothing can therefore
only be pinned `write`. That is a scope question for the first catalogue entry,
not a defect in this guard.

Ledger `/tmp/kai-172vp-ledger.py`: 10 mutants, 9 killed, 1 MEASURED EQUIVALENT,
0 survivors — the new guard dropped (M07), weakened to `=== false` (M08), moved
above the denial guard (M09), narrowed to `=== undefined` (M10). M10 is
equivalent precisely BECAUSE the denial guard sits above it, which is the
ordering M09 shows is loaded. Anchors assert their occurrence count; the file is
restored to a pristine copy after every run and asserted.

Evidence: suite 19/19; the eight catalogue-touching suites 92/92; full backend
492 suites / 4690 passed / 0 failed; eslint 0 new findings.
@lilyshen0722
lilyshen0722 added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 14bea08 Sep 29, 2026
19 of 23 checks passed
lilyshen0722 added a commit to thantiklermcirony/commonly that referenced this pull request Oct 9, 2026
…lent vendor gets no entry (TASK-172) (Team-Commonly#2016)

* docs(plans): a read pin needs the vendor's own readOnlyHint, and a silent vendor gets no entry (TASK-172)

Records the rule Team-Commonly#2014 enforces at entry load and the ruling on its cost
(pod 75440): a vendor whose tools carry no readOnlyHint gets no entry,
never a write-only one, because the class records what a tool does. The
vendor list gains the annotation check, step 7 reads the hints first,
and §11 carries Linear's unknown and the one case worth reopening.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plans): a claim the pin recorded must still be made, destructiveHint included (TASK-172)

Folds the second drift arm's ruling (pod 75449) into the read-hint note. The spec defaults both hints to their unsafe value, so silence withdraws a recorded readOnlyHint: true or destructiveHint: false; a default newly spelled on a pin that recorded nothing is not drift; and a read pin still drifts on destructiveHint: true, because the entry load refuses one carrying it. §10 step 2 names the three cases, and §11's source check is scoped to the files each server declares its MCP tools in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plans): the contradiction is with a recorded readOnlyHint, not the read class (TASK-172)

A read pin that recorded readOnlyHint: true drifts on a live
destructiveHint: true, the pair the entry load refuses. Every other
newly spelled default changes nothing, so a pin that recorded neither
claim does not drift. Each arm reads the pin's annotations, never its
class, and a read pin is not asked to record destructiveHint: false,
which the spec makes meaningful only when readOnlyHint is false (pod
75454).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(plans): a refusal names the withdrawn claim before the contradiction (TASK-172)

A pin that recorded both readOnlyHint: true and destructiveHint: false,
against a tool now saying destructiveHint: true, fires two arms. The
refusal names the destructiveHint: false it lost, not the generic
contradiction, and §10 step 2 gains that case (pod 75457). The
recorded-neither case is a write pin, since the entry load refuses a
read pin that records no readOnlyHint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
lilyshen0722 added a commit to thantiklermcirony/commonly that referenced this pull request Oct 9, 2026
… withdraws them (Team-Commonly#2023)

Three arms replace the two that came before (75449, 75454, 75457; written into
§3 by Team-Commonly#2016):

- a recorded `readOnlyHint: true` is withdrawn when the vendor stops saying it
  (unchanged);
- a recorded `destructiveHint: false` is withdrawn when the vendor stops saying
  it. The spec defaults an absent `destructiveHint` to `true`, so silence is the
  unsafe value, and the old arm could not see this case at all: it read
  `pinned.destructiveHint !== true`, and an unannotated pin has no
  `destructiveHint` to withdraw (vera 75423, measured 75445);
- a live `destructiveHint: true` beside a recorded `readOnlyHint: true` is the
  pair the entry load refuses (Team-Commonly#2014), and drift does not admit later what entry
  refuses.

Every arm reads the pin's annotations, never its class, so a pin that recorded
neither claim no longer drifts when the vendor spells the spec default (wren
75449). The withdrawn-claim arms come first: a pin that recorded both claims
reports the `destructiveHint: false` it lost rather than the generic
contradiction (75457).

The three drift fixtures Team-Commonly#2014 makes entry-illegal are re-pointed at
`class: write` — `tightened`, `unpinned`, `silent` — and the recorded-nothing
pair is flipped to `ok`, which is what the ruling predicts for a write pin. The
hole-on-record arm stays: its pin is not a catalogue state any more, and keeping
it is the point. A census of every `pinned()` call in the suite, run against
Team-Commonly#2014's head, is what found them (75461, 75462).

Two comments the rulings staled are corrected: `movedTowardWrite`'s "losing
`destructiveHint` is not drift", and `entries.ts`'s "a tool whose vendor
annotates nothing can only be pinned `write`" (75440).

Ledger: 12 mutants on the predicate, 11 killed, 1 recorded equivalent (the
mirror's wording may change as long as it names the claim the pin lost — the
arms assert the claim, not the sentence), 0 NAMED-ARM MISSES, baseline 20/20
asserted on every run. Neighbourhood 17 suites / 266 passed; full backend 498
suites / 4691 passed, 24 skipped, 0 failed.
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