Skip to content

feat(schemas): derive the gateway's advertised tool schemas from their models (piece A, see Consiliency/pmcp#236) - #300

Merged
ViperJuice merged 1 commit into
mainfrom
feat/236-derived-schemas
Sep 26, 2026
Merged

ViperJuice merged 1 commit into
mainfrom
feat/236-derived-schemas

Conversation

@ViperJuice

@ViperJuice ViperJuice commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Piece A of #236, implemented from the merged plan (#291). I applied it exactly as the plan's executor steps say. All six files are byte-identical to the reference code the plan board reviewed over eight rounds (wip/236-schema-drift-rev2-code @ cb6afa4).

What changes

  • Each gateway tool's advertised inputSchema is now derived from the pydantic model its handler validates with, built once per process. The gate and the model can no longer drift.
  • An unregistered tool name fails closed with Unknown tool. The guard sits inside the audited path, before any dispatch or scoped-audit model check.
  • Argument descriptions keep main's hand-written text, except for update_server.force. task.ttl gets an int64 range, and evidence_label_digest gets an exact length.
  • The behaviour changes are listed in the CHANGELOG entry. They cover constraints now enforced at the gate, null accepted for optional arguments, stricter type coercion on invoke.task.*, and a scoped-audit consequence that lasts until Record tools/call gate rejections in the scoped-advisor audit (prerequisite for piece B of #236) #296.

Release gate (not a merge gate): before the next tag, run the host tools/list smoke test the plan requires, tracked in #301. This PR emits type: [X, "null"] and null in enum.

Piece B (extra="forbid") is not in this PR. It is gated on #296. Deferred classes are tracked in #297 and #298.

Verification (this branch, off main 1fb36f2)

Check Result
All six files cmp against the reviewed reference identical
tests/test_gateway_tool_schemas.py 220 passed
ruff check, ruff format --check, mypy src/ clean
Full suite -m 'not live' 4291 passed, 3 skipped, 25 deselected

See #236.

🤖 Generated with Claude Code

https://claude.ai/code/session_017HCiJU6dVVrNdcz461oN33

…r models (piece A, see #236)

Implements piece A of the merged plan
(.consiliency/plans/detailed-236-schema-drift-20260923-0915.md,
#291), applied exactly as its executor steps state; every
file is byte-identical to the reviewed reference code
(wip/236-schema-drift-rev2-code @ cb6afa4).

- tools/schema.py derives each tool's inputSchema from the pydantic model
  its handler validates with (refs inlined, titles dropped, optional fields
  `type: [X, "null"]`), built once per process.
- server.py fails closed on a name the registry does not list, inside the
  audited path and before the scoped-audit model check.
- types.py carries the argument descriptions (main's hand-written text
  kept), task.ttl's range and the digest's exact length.
- tests/test_gateway_tool_schemas.py (220) + a committed schema snapshot.

Behaviour changes are listed in the CHANGELOG entry. Piece B (forbid
unknown keys) is gated on #296.

Full suite -m 'not live': 4291 passed, 3 skipped, 25 deselected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017HCiJU6dVVrNdcz461oN33
@ViperJuice
ViperJuice merged commit cdaf3c6 into main Sep 26, 2026
14 checks passed
ViperJuice added a commit that referenced this pull request Sep 27, 2026
… (see #294)

- C1: an exact npm pin is silent only when nothing besides the argv can
  change what npm runs for it: npm_config_* keys judged by an allowlist
  derived from the npm 10.9.9 and 11.19.0 config definitions, NODE_OPTIONS,
  the overlay keys identity selects, a local prefix, and the project, user,
  global and builtin npmrc files, in both identity modes.
- C2: _is_exact_pin decides per launcher; a docker tag floats and only a
  content digest pins, for the warning and for [PINNED]/[FLOATING].
- NB-1: the fallback cause names a launcher identity does not read.
- NB-2: the floating text claims only what holds on every npm release.
- NB-3: the #300 test count is attributed correctly (416 for two files).

Re-measured on 959d4d4: 153 pin tests (41 red on rev 5), 56/56 mutants
red, full suite 4489 passed, conformance 0/0 on npa 12.0.2 and 13.0.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LT8D8tRmExyQve69DCWRik
@ViperJuice
ViperJuice deleted the feat/236-derived-schemas branch October 5, 2026 05:30
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