build(search): qualify the MCP canonical batch adapter

Prepare only the two reviewed MCP adapter/test source files against their
exact base hashes and verify the edited bytes before pinned formatting.
Export blobs without automatic commits or branch changes. Existing native
search-service gates run on the subsequent functional landing. Restore this
temporary workflow to its original read-only state in that same commit.
This commit is contained in:
Jeff Emanuel
2026-09-21 23:15:23 -04:00
parent 7ea2804297
commit 631ceadd4d
+71 -13
View File
@@ -1,23 +1,81 @@
# Both source-only landings completed. No job retains repository-write access.
name: Verify landed retrieval commits
name: Prepare MCP canonical batches
on:
push:
branches: [main]
paths: [.github/workflows/apply-ann-underfill-once.yml]
workflow_dispatch:
permissions:
contents: read
jobs:
ancestry-only:
runs-on: ubuntu-24.04
timeout-minutes: 5
prepare:
runs-on: ubuntu-24.04-arm
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Verify commit ancestry, not runtime qualification
shell: bash
- uses: dtolnay/rust-toolchain@881ba7bf39a41cda34ac9e123fb41b44ed08232f
with:
toolchain: nightly-2026-08-31
components: rustfmt
- name: Apply reviewed MCP patch and export checked source
shell: python
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
git merge-base --is-ancestor e36ad641e95df88c289d70fc467e5159542d9c92 HEAD
git merge-base --is-ancestor d671ab449af2d6bd34bac12a7992f79b3c2cc36c HEAD
printf '%s\n' 'Both retrieval fixes are present in this history.' 'This check proves ancestry only; use Verify search retrieval for component and locked CASS tests.'
import base64, hashlib, json, os, subprocess, urllib.request
from pathlib import Path
expected = {
'src/search_service/mcp.rs': ('44b5b14714e8ce8c0e269e56cb56828e3e8a4b1a', '216c4efdfb986b7e2d925514ba8a8749827fe9a7'),
'src/search_service/canonical_tests.rs': ('1643d6e3962a2cd19ba039b2371489661b30b08e', '45bd9a8987e1aff8aaf69ca9101f3e11eca382f9'),
}
def sha(data):
return hashlib.sha1(b'blob ' + str(len(data)).encode() + b'\0' + data).hexdigest()
def api(path, data=None):
req = urllib.request.Request('https://api.github.com/repos/Dicklesworthstone/coding_agent_session_search' + path,
data=None if data is None else json.dumps(data).encode(),
headers={'Authorization': 'Bearer ' + os.environ['GH_TOKEN'], 'Accept': 'application/vnd.github+json', 'Content-Type': 'application/json'})
with urllib.request.urlopen(req, timeout=60) as response:
return json.load(response)
for path, (base, _) in expected.items():
assert sha(Path(path).read_bytes()) == base, 'Source changed: ' + path
patch = api('/git/blobs/4b48b90b915bda08d5b21f66b28ac89473b46a85')
assert patch['encoding'] == 'base64'
content = base64.b64decode(patch['content'])
assert sha(content) == '4b48b90b915bda08d5b21f66b28ac89473b46a85'
patch_path = Path(os.environ['RUNNER_TEMP']) / 'mcp-batch.patch'
patch_path.write_bytes(content)
def run(*args):
subprocess.run(args, check=True)
run('git', 'apply', '--recount', '--check', '--whitespace=error-all', str(patch_path))
run('git', 'apply', '--recount', '--whitespace=error-all', str(patch_path))
run('git', 'apply', '--recount', '--reverse', '--check', str(patch_path))
assert sorted(subprocess.check_output(['git', 'diff', '--name-only'], text=True).splitlines()) == sorted(expected)
output = {}
root = Path(os.environ['RUNNER_TEMP']) / 'mcp-batch-source'
root.mkdir()
for path, (_, edited) in expected.items():
assert sha(Path(path).read_bytes()) == edited, 'Edited bytes mismatch: ' + path
formatted = subprocess.check_output(['rustfmt', '--edition', '2024', '--config', 'skip_children=true', '--emit', 'stdout'], input=Path(path).read_bytes())
Path(path).write_bytes(formatted)
run('rustfmt', '--edition', '2024', '--config', 'skip_children=true', '--check', path)
result = api('/git/blobs', {'encoding': 'base64', 'content': base64.b64encode(formatted).decode()})
assert result['sha'] == sha(formatted)
output[path] = result['sha']
destination = root / path
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_bytes(formatted)
run('git', 'diff', '--check')
run('git', 'diff', '--stat')
(root / 'source-blobs.json').write_text(json.dumps(output, indent=2))
print('MCP_BATCH_BLOBS=' + json.dumps(output, sort_keys=True), flush=True)
print('Source identity and native formatting only; no runtime pass claimed.', flush=True)
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: mcp-batch-source-${{ github.sha }}
path: ${{ runner.temp }}/mcp-batch-source
if-no-files-found: error
retention-days: 3