Skip to content

fix: proto descriptor collision and PyPI wheel packaging#47

Merged
beonde merged 2 commits intomainfrom
fix/proto-descriptor-collision
Mar 27, 2026
Merged

fix: proto descriptor collision and PyPI wheel packaging#47
beonde merged 2 commits intomainfrom
fix/proto-descriptor-collision

Conversation

@beonde
Copy link
Copy Markdown
Member

@beonde beonde commented Mar 27, 2026

Summary

Fixes two related issues that prevent the SDK from working alongside capiscio-mcp-python:

1. Proto Descriptor Pool Collision (P0-5)

When both capiscio-sdk and capiscio-mcp-python are installed, importing both causes a protobuf descriptor pool collision because both register capiscio/v1/mcp.proto.

Fix: Lazy-load MCP proto modules in the SDK's RPC client — they're only imported when MCP-specific methods are actually called. Added try/except around AddSerializedFile in mcp_pb2.py with FindFileByName fallback.

2. PyPI Wheel Missing Proto Files (P0-4)

Hatchling excludes the nested capiscio/ directory under gen/ because it looks like a separate top-level package not matching the packages = ["capiscio_sdk"] filter.

Fix: Added [tool.hatch.build.targets.wheel.force-include] to explicitly include the proto gen directory. Verified: wheel now contains all 18 proto files.

Files Changed

  • capiscio_sdk/_rpc/client.py — lazy-load _ensure_mcp_protos()
  • capiscio_sdk/_rpc/gen/capiscio/v1/mcp_pb2.py — try/except descriptor registration
  • pyproject.toml — force-include for proto gen files

Testing

  • Proto collision verified: both packages import cleanly side-by-side
  • Wheel build verified: 18 proto files included in distributable

When both capiscio-sdk and capiscio-mcp are installed, they ship
identical capiscio/v1/mcp_pb2.py files. The second import crashes with
DescriptorPoolConflict.

Fix:
- Lazy-load MCP proto modules in client.py (only when MCP methods called)
- Add try/except around AddSerializedFile with FindFileByName fallback
@github-actions
Copy link
Copy Markdown

✅ Documentation validation passed!

Unified docs will be deployed from capiscio-docs repo.

@github-actions
Copy link
Copy Markdown

✅ All checks passed! Ready for review.

@github-actions
Copy link
Copy Markdown

✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes protobuf descriptor pool collisions and missing generated proto stubs in built distributions so capiscio-sdk-python can coexist with capiscio-mcp-python in the same environment.

Changes:

  • Lazy-load MCP protobuf modules and MCP service stub creation to avoid importing MCP protos in core flows.
  • Add a descriptor registration fallback in mcp_pb2.py to reuse an already-registered capiscio/v1/mcp.proto.
  • Force-include generated protobuf package directories in wheel and sdist builds.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pyproject.toml Forces inclusion of generated protobuf package directory in wheel/sdist artifacts.
capiscio_sdk/_rpc/gen/capiscio/v1/mcp_pb2.py Adds try/except around descriptor registration to avoid collisions.
capiscio_sdk/_rpc/client.py Makes MCP stubs/protos lazy-loaded to prevent import-time descriptor collisions.

@github-actions
Copy link
Copy Markdown

✅ Documentation validation passed!

Unified docs will be deployed from capiscio-docs repo.

@github-actions
Copy link
Copy Markdown

✅ All checks passed! Ready for review.

@github-actions
Copy link
Copy Markdown

✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests.

@beonde beonde merged commit 6ed5f6b into main Mar 27, 2026
13 checks passed
@beonde beonde deleted the fix/proto-descriptor-collision branch March 27, 2026 03:32
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.

2 participants