Repository navigation
Commit c5361e2
feat(connector-github): pin the two included MCP tools and record the listing provenance (#31647)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi99NHVBVyv4gRvhhpXs72Am2)_
Fixes #28647
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:GitHub 连接器应用给它用到的两个 MCP 工具(`search_issues`、`issue_read`)各加了一个
sha256 锁定值,README 新增「Provenance」一节,写明上游地址、锁定值、谁在什么时候用什么 token 测的,以及上架清单
sha256 的算法和结果。
- 为什么改:按 #28590 的裁决 B,货架上的每个 MCP 应用都要锁定它包含的工具,清单的 sha256
就是这组锁定值的摘要;GitHub 以后改了工具定义,实例会降级并点名工具,而不是悄悄换行为。
- 风险与回滚:锁定值是 2026-11-06 维护者本机用权限较宽的 `gh` token 测的;如果只读 token
拿到的工具定义不同,连接器首次连接会降级并点名该工具(重测、换锁定值即可)。回滚就是 revert 本 PR。应用是私有包,不发 npm。
-
先看:`packages/apps/connector-github/src/connectors/github.connector.ts`(新增
`toolsSnapshot`)、`packages/apps/connector-github/README.md`(Provenance
一节)、`packages/apps/connector-github/test/listing.test.ts`(新的锁定值测试块)。
- 两分钟验证:`pnpm --filter @objectstack/connector-app-github test`,预期 2
个文件、18 个测试全绿,不访问 GitHub。
- 需要你做的:无,席位落地。
## What changes
- **`src/connectors/github.connector.ts`**:
`providerConfig.toolsSnapshot` pins both included tools, with the
digests posted on #30116 (comment 6691107153) verbatim:
- `search_issues`:
`443421e063c9330d4504a88b57def74d1f1e3d0793479068073630a1846eaeb0`
- `issue_read`:
`380e96f3d78b5c893668ab48a2d72191a3906bdc4e5e5c89f9e92c3e9de6c392`
- **`README.md`**: a new `## Provenance` section, following the shape
the Stripe and DocuSign apps use for their listing provenance (a README
section; no manifest field carries provenance in this repository). It
records `upstream` (the server URL), how `commit` is recorded (the
repository commit the package is published from; a file cannot name the
commit that contains it, so the publisher records it), the two pins, the
measurement date (2026-11-06T17:27Z), who measured them (the maintainer,
on their own machine), the token used (the maintainer's local `gh` CLI
token, broader than read-only, as triage asked to record), the pin-set
sha256
`e922e2420b05707fb3ec9df270009da30d57177c297a6d7c3ee0b4ccbbad7516`, and
the exact recipe with a one-line `printf | sha256sum` that reproduces
it.
- **`test/fixtures/github-mcp-tools.json`** (new): the measurement's
stdout from #30116, the two tool definitions included, so the pins are
recomputed offline.
- **`test/listing.test.ts`**: a new top-level
`describe('connector-github tool pins')` in the existing listing
harness. It fails when an included tool has no pin, a pin is not 64
lowercase hex, or a pin names a tool `include` leaves out; it recomputes
both pins from the fixture with `computeMcpToolsSnapshot`; and it checks
the README records the URL, each pin and the pin-set digest. No network
call.
- **`test/boot.test.ts`** (forced test edit): the fake MCP server now
serves the measured definitions from the fixture instead of hand-written
stand-ins. With the pins in place, the old stand-ins hash differently,
so the instance would degrade with `CONNECTOR_UPSTREAM_CHANGED` and
three boot tests would fail (measured below). The extra `issue_write`
tool the app must not expose is kept.
The pin-set digest recipe: serialize the `toolsSnapshot` record as JSON
with keys sorted (UTF-16 code-unit order) and no whitespace, which for a
record of strings is its RFC 8785 (JCS) form, then sha256 of the UTF-8
bytes, lowercase hex. The card names this `stableStringify`; no
repository-wide `stableStringify` is exported (four private copies
exist), so the README states the rules instead of a function name.
No changeset: `@objectstack/connector-app-github` is `private: true`, so
it publishes nothing; the PR carries `skip-changeset`.
## Tests
- Step 0, offline recompute: `computeMcpToolsSnapshot` over the
fixture's `tools` gives exactly the two posted digests (`search_issues
MATCH`, `issue_read MATCH`), at `69244406`.
- Base (`69244406`): `pnpm --filter @objectstack/connector-app-github
test`: Test Files 2 passed, Tests 14 passed.
- Head: the same command: Test Files 2 passed, Tests 18 passed;
`typecheck` exit 0; `pnpm --filter @objectstack/connector-mcp test`:
Test Files 9 passed, Tests 119 passed.
- Ablations (each via `scripts/ablation-replace.mjs`, which restores and
checks the blob; `git diff HEAD` empty after each):
- Drop the `issue_read` pin: listing tests red, `expected [ 'issue_read:
no pin' ] to deeply equal []`; 4 failed, 9 passed.
- Malformed pin (the `search_issues` pin in uppercase hex): red,
`expected [ Array(1) ] to deeply equal []`; 4 failed, 9 passed.
- Boot fake back to the pre-pin stand-in definitions: 3 boot tests red,
the instance `degraded` with `providerConfig.toolsSnapshot does not
match the tools its MCP server serves: tool 'search_issues' changed …;
tool 'issue_read' changed …`. This is the forced boot-test edit,
measured.
## Acceptance notes
- The pins were measured with the maintainer's local `gh` token, not a
read-only one. If GitHub serves a read-only token different definitions
for these two tools, the first connection degrades the instance naming
the tool; re-measure with a read-only token and re-pin. Triage
(6723942187) ruled that a follow-up, not a blocker.
- The declaration above is measured, not copied: `toolsSnapshot` is an
existing `providerConfig` key the `mcp` provider already reads; this PR
adds data to it. The app's metadata format and the spec are unchanged.
## Verification
All readings at head `9f1340c6`.
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 50 commands; all 50 ran with exit 0.
Reconciliation: `dispatch-gates --ran`: 50 derived, 50 run, 0
NOT-MEASURED, 0 UNRUN (exit 0).
- Two of them first exited 3 on container prerequisites, not on the
diff, and were green on rerun: `check-plugin-teardown-shape --self-test`
(its pinned fixture commit was outside the shallow clone; fetched it),
and `check:dual-build-cjs-loads` (needs every package's `dist/`; ran a
full `pnpm build` under the verify lock, exit 0).
- `pnpm exec eslint --no-inline-config packages/apps/connector-github`
(the package has no lint script; root eslint on the directory): exit 0.
- Full dogfood: not run, since the title has no `!` and there is no
narrowing arm.
<details><summary>Derived gate list (50, all exit 0)</summary>
```text
node scripts/check-closing-keyword-parity.mjs (+ --self-test)
node scripts/check-comment-mask-adoption.mjs (+ --self-test)
node scripts/check-comment-mask-corpus.mjs
node scripts/check-dts-emitted.mjs --self-test
node scripts/check-issue-citations.mjs
node scripts/check-plugin-teardown-shape.mjs (+ --self-test)
node scripts/ci/assert-turbo-remote-cache.mjs --self-test
node scripts/ci/plan-test-core-shards.mjs --self-test
node scripts/ci/prune-turbo-cache.mjs --self-test
node scripts/docs-audit/check-affected-docs.mjs
node scripts/docs-audit/check-drift-comment.mjs
pnpm --filter @objectstack/spec run check:duration-unit-keys
pnpm --filter @objectstack/spec run check:template-manifests
pnpm check:ci-filter-parity, closed-ceremony-text, cross-package-test-inputs, doc-authoring,
driver-memory-census, dts-closure, dual-build-cjs-loads, engine-double-contract, gitlink-declared,
issue-citations, keyed-text-bounds, lean-entry-closure, logger-receiver-detach, nul-bytes,
objectql-double-limit, org-identifier, page-declaration-shape, platform-object-tenancy-census,
published-files, query-options-erasure, refd-timer-probe, registry-log-declared,
rest-log-spy-declared, slot-lookup, sourcemap-no-sources-content, system-context-census,
test-source-alias, tier-file-adoption, type-check-coverage, type-check-debt,
undeclared-dep-imports, vouch-for-reference-callers, watch-hint-literal, where-matcher
```
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmQCkyoaDHDp37j8kV2)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 737b160 commit c5361e2
5 files changed
Lines changed: 356 additions & 11 deletions
File tree
- packages/apps/connector-github
- src/connectors
- test
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
| |||
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
40 | 53 | | |
41 | 54 | | |
42 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
30 | 39 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
0 commit comments