Repository navigation
MCP upload/commit family seams and executable tools/call evidence - #554
Merged
Merged
Conversation
Add a self-contained upload-family hand-off covering the four upload pending operations (SaveUploadedFile, InitUpload, UploadChunk, rest_upload_stream). Tools reach the controller only through typed generated clients behind the production auth interceptor; the composed upload path consumes controller-owned bounded stream frames and holds a one-at-a-time commit lease. Exported seams (descriptors, tool specs, registration and invocation args) are for the single integration owner to join into the shared catalog after both lanes land. The STRICT publication gate deliberately stays RED with all nine pending operations; no catalog or pending-inventory file is edited here. Evidence: real stdio tools/call asserts exact typed-field mapping, handler outcomes, scope success/denial, fresh files:create[server_id] at commit with zero writes, exclusive leases, ambiguous-save verification and cap/cancel/ expiry/cross-scope/zero-byte refusals.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the MCP UPLOAD/COMMIT lane for the nine pending OSS-370 operations (OSS-371/372/373/375). Covers the four upload-family operations only:
rpc:FileService/SaveUploadedFilefile_service_save_uploaded_file/carbonpanel.v1.FileService/SaveUploadedFilefiles/create[server_id]rpc:UploadService/InitUploadupload_service_init_upload/carbonpanel.v1.UploadService/InitUploaduploads/createrpc:UploadService/UploadChunkupload_service_upload_chunk/carbonpanel.v1.UploadService/UploadChunkuploads/createsurface:rest_upload_streamscoped_stream_open→scoped_stream_chunk*→rest_upload_stream_commitSaveUploadedFile)files/create[server_id]What changed
New self-contained, lane-owned files only:
internal/mcp/family_upload_tools.go— tool implementations and exported seams:UploadFamilyDescriptors,UploadFamilyToolSpecs(),RegisterUploadFamilyTools(),UploadFamilyInvocationArgs(),MarshalUploadFamilyDescriptors(),UploadFamilyErrorSentinels().rest_upload_stream_commitconsumes controller-owned boundedstream frames and commits only through the typed upload path. No direct
filesystem helper writes a destination.
internal/mcp/family_upload_descriptors.json— machine-readable descriptor artifact.internal/mcp/family_upload_tools_test.go— executable evidence tests.knowledge/decisions/mcp-upload-commit-family.md(+ regenerated decisions index).No shared catalog or integration file is edited. The integration owner joins
the exported seams into the generated catalog, registration and invocation harness
after both lanes land.
RegisterUploadFamilyToolsrespects the productionregistration allowlist, so the catalog must be regenerated with these specs first.
Evidence (real MCP
tools/callover SDK stdio, production auth interceptor)TestUploadFamilyTypedInvocationEvidence— each direct tool reached its typedmethod; every non-confirm argument asserted against the exact generated protobuf
field; real handler success; ungranted
dp_token denied with a real Connectcode; invalid token refused as unauthenticated;
confirm=truegate observed.TestUploadFamilyFreshCreateAtCommit—uploads/create-only principal cancreate/complete a session but is refused at commit (
files/create[server_id])with zero destination writes; an entitled caller commits through the typed
save path only (1
SaveUploadedFile, 0 re-uploads) with exact destination bytes.TestUploadFamilyComposedStreamCommit— 300 KiB source (two 256 KiB frames)declared as an upper bound; authoritative final size/SHA asserted; exactly one
InitUpload+ expectedUploadChunks + oneSaveUploadedFile; exact bytes land.TestUploadFamilyComposedLeaseAndAmbiguous— two parallel commits of one handlegive exactly one success and one
in-flight commitbusy result; a lost replyafter dispatch is verified from the exact destination (size + SHA) with no
second upload; a never-dispatched save returns truthful UNKNOWN with a recovery
hint; handle terminal after either outcome.
TestUploadFamilyRefusalsZeroWrites— over-cap open, cross-owner claim, cancel,expiry, incomplete stream and zero-byte stream are all refused; no upload RPC
and no destination write on refusal.
Disposable fixtures only (
t.TempDir()storage, in-memory SQLite, httptestConnect handlers wrapped in
rpc.NewAuthInterceptor); no user worlds/files.Verification
Pinned Go
1.26.11:go build ./...— PASSgo vet ./...— PASSgo test ./... -count=1— PASS (all packages;internal/mcp34s)golangci-lint run --new-from-rev=HEAD ./...— 0 issuesbun scripts/proto-generate.mjs --check— PASS (generated outputs match)go run ./cmd/knowledge-lint -root . -fixthen without-fix— PASS (40/40 queries)go test -tags mcpfullcoverage ./internal/mcp/ -run TestFamilyAuditFullCoverage—RED as required: exactly the 9 agreed pending operations, publication BLOCKED.
This PR does not remove any pending entry or flip the gate.
Head
7570b13b35a88ec9ed8f3fafe6660921053a90d5(branchcodex/mcp-upload-ops, based onorigin/main9e81679b).No merge, release, GHCR or registry action is requested.