Sprint 02: Proto Converter Consolidation
| Field |
Value |
| Sprint Size |
M (Medium) |
| Status |
✅ Complete |
| Prerequisites |
Sprint 01 (completed) |
| Phase |
Deduplication Phase 1 |
| Pattern Reduction |
12 inline converters consolidated |
Summary
Consolidated 12+ inline converter functions from 6 mixin files into a centralized converters/ package. The original converters.py (613 lines) was split into 6 modules to stay under the 500-line soft limit.
Completed Work
Package Structure Created
Converters Consolidated
| Source File |
Functions Moved |
entities.py |
entity_to_proto |
webhooks.py |
webhook_config_to_proto, webhook_delivery_to_proto |
sync.py |
sync_run_to_proto |
oidc.py |
claim_mapping_to_proto, proto_to_claim_mapping, discovery_to_proto, oidc_provider_to_proto |
observability.py |
metrics_to_proto |
project/_converters.py |
export_format_to_proto (imported from main converters) |
Files Updated
| File |
Change |
grpc/_mixins/entities.py |
Import entity_to_proto from converters |
grpc/_mixins/webhooks.py |
Import webhook converters from converters |
grpc/_mixins/sync.py |
Import sync_run_to_proto from converters |
grpc/_mixins/oidc.py |
Import OIDC converters from converters |
grpc/_mixins/observability.py |
Import metrics_to_proto from converters |
grpc/_mixins/project/_converters.py |
Import export_format_to_proto from main converters |
Pre-existing Issues Fixed
| Issue |
Fix |
Unused fixture memory_servicer in test_stream_lifecycle.py |
Removed unused parameter |
Unused feature_attr parameter in test_mixin_helpers.py |
Simplified parametrization |
Unused name parameter in test_mixin_helpers.py |
Simplified parametrization |
Baselines Updated
- Updated
thin_wrapper baselines to reflect new package paths
- Updated
errors.py module size baseline (570 lines)
Test Results
| Test Suite |
Result |
| gRPC tests |
490 passed |
| Quality tests |
90 passed |
| Type checking |
0 errors |
| Ruff linting |
All checks passed |
Key Decisions
| Decision |
Rationale |
| Split into package |
Original 613 lines exceeded soft limit; package structure provides clear organization |
| Keep client converters separate |
Different signatures (client uses primitives from Rust) |
Keep project's proto_to_export_format |
Returns None for unset values vs main's default to MARKDOWN |
Use __all__ for exports |
Clear public API, sorted alphabetically |
Verification
Architecture Note
The converters package maintains backward compatibility - all imports still work via:
The __init__.py re-exports all 31 public functions from the submodules.