Repository navigation
fix: preserve schema-twin bytes during Git checkout - #3120
wozhenbang2004 wants to merge 7 commits into
Conversation
|
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Checked the attribute rule in a scratch repo: with the same path pattern, One thing the PR text doesn't cover: existing Windows clones with |
|
Thanks for checking this. The test hashes only the two schema files; I've added an Existing checkouts section with the targeted I also verified this on Windows using the exact files from this PR in an isolated repo. The attribute-only pull left the old CRLF copies unchanged, and the refresh restored both pinned hashes and sizes without changing the index contents. The working tree was clean, and the fresh-checkout case passed too. This ran on Windows Server 2025 with Git 2.56.0.windows.2. It was a focused checkout test, not the full SDK suite. |
|
That covers the gap. The Windows run is the right evidence: the attribute-only pull leaving the old CRLF copies in place, then the refresh restoring both hashes and sizes, is the exact sequence an existing clone goes through. The command is scoped to the two paths, so it won't touch anything else in the working tree. One suggestion: if the byte-count test fails, could its assertion message name the two files and point at this "Existing checkouts" section? Someone on an old clone will see the failure before they read the PR text. Does the test's current message say which of the two files differs? |
Updated error messages for byte size and SHA256 checks to include additional context regarding CRLF checkouts and re-vendor instructions.
|
The errors now include the full schema filename rather than just the revision, and point to the recovery steps in |
|
The new messages read well: the filename plus a pointer to the |
|
I've clarified that the recovery hint applies when you haven't edited the file and have The upstream test jobs currently run on Ubuntu. The Windows run linked above is from my fork and checks checkout recovery, not the Vitest suite. Would you prefer a targeted Windows CI check in this PR, or a separate follow-up? |
|
Thanks, the clarified scope reads right: |
|
I set Another Windows run caught a recovery issue: The latest run passed the recovery checks and all 180 tests in |
|
The stat-cache detail is a good catch: |
|
Yes, from the repository root: git ls-files --eol -- packages/core-internal/test/corpus/schema-twins/2025-11-25.schema.json packages/core-internal/test/corpus/schema-twins/2026-07-28.schema.jsonBoth files should show |
|
That is the check I wanted: scoped to the two paths, and |
|
The Windows run doesn't print I checked the same sequence locally on Linux: after pulling the attribute change, the old copies show |
|
That covers both states, and the Linux sequence ( |
|
Yes, that’s covered in the recovery section. It says to move the two files to an external backup directory before running |
|
Thanks, the backup-then- |
|
The Windows test clones explicitly use |
|
That settles it: with |
|
The Windows run covers |
|
Tested this on a Windows 11 desktop against full clones of the repo (Git 2.52.0.windows.1, which is where I hit this for #3117):
I checked sizes and hashes with a small script that does the same two assertions as the test, not the vitest run itself. Unrelated to this PR's scope: |
|
Thanks, that is a clear scope statement. Since |
|
Thanks, @DoroteoNavarrete, for checking this on a full Windows clone. Your results also cover fresh clones with |
Preserve the raw schema-twin JSON bytes when Git checks out the repository with
core.autocrlf=true.Motivation and Context
Addresses the schema-twin CRLF failure in #3117 only. The symlink, signal, and repository-wide Prettier cases remain separate. The provenance manifest intentionally pins the upstream bytes, so these two artifacts should bypass Git text conversion.
How Has This Been Tested?
On Linux with Git 2.51.1 and Node 24.22.1, a fresh
core.autocrlf=truesparse checkout failed both manifest byte-count and SHA-256 checks:After adding the attribute and materializing a new checkout with
git checkout-index, both byte counts and hashes matched exactly.git diff --cached --checkpassed. An independent isolated Git reproduction confirmed the result and that unrelated text still converts normally.A native Windows run passed on Windows Server 2025 with Git 2.56.0.windows.2, PowerShell 7.6.7, and Node 24.22.1. The test clones explicitly used
core.autocrlf=true. A stable-stat old checkout showed thatcheckout-index --force --indexcan leave the CRLF files untouched. Moving the two files to an external backup directory beforecheckout-index --indexrestored both pinned sizes and hashes. The checks also verified backup preservation, unchanged staged contents, unrelated staged/unstaged edits, and a fresh checkout.The same run passed all 180 tests in the unchanged
schemaTwinConformance.test.ts, using the exact corpus and source-locked dependencies in an isolated harness. The source was0e2bb6d; the subsequent commit only updates the recovery documentation. This was not the full SDK suite. Prettier 3.6.2 passed for the changed files using the project configuration; package builds and the full lint suite were not run locally.Existing checkouts
Pulling this change may leave previously checked-out CRLF copies unchanged. Move the two schema files listed below to a backup directory outside the repository, then run this from the repository root:
This recreates the files from the index without changing the staged contents. Keep the backups if they contain local edits. Fresh clones do not need this step.
Breaking Changes
None. Only
schema-twins/*.schema.jsonopts out of text conversion. No schemas, manifest entries, assertion logic, APIs, or dependencies change. The test messages now name the affected file and point to checkout recovery instructions in CONTRIBUTING.md.Types of changes
Checklist
Additional context
Developed with Codex assistance.