rock
|
b33901aa5b
|
Fix CRAP issues: Extract JWT utils, workflow builders, polling logic
CRAP Score Improvements:
unified_synthesis_handler: 52.8 → 22 (57% reduction)
poll_workflow_result: 38.4 → 0 (REMOVED, split into helpers)
DRY Improvements:
- Extracted JWT token extraction to handlers/jwt_utils.rs (shared)
- Extracted workflow builders to handlers/workflow_builder.rs
- Extracted polling logic to handlers/workflow_poller.rs
- Removed duplicate code: -50 LOC across modules
Architecture:
├─ jwt_utils.rs: extract_jwt_token()
├─ workflow_builder.rs: WorkflowBuilder + WorkflowQueryBuilder
├─ workflow_poller.rs: poll_workflow_until_complete(), response parsing
└─ handlers use shared utilities
Testability:
+ 18 new unit tests for builders + polling
+ 6 new unit tests for JWT utils
+ Mock-friendly response parsers (parse_workflow_status, etc.)
SRP Improvements:
├─ unified_synthesis_handler: Route + orchestrate (NOT parse/build)
├─ execute_reasoning_workflow(): Build + poll + parse (single concern)
├─ poll_workflow_until_complete(): ONLY polling (retries, timeout)
└─ Response parsers: ONLY extraction (no business logic)
Compilation: ✅
|
2026-09-05 00:48:12 -07:00 |
|
rock
|
4ce389aa58
|
Wire Temporal workflow execution via api.riotpiao.com
- Add SynthesisClient.execute_workflow() for POST /workflow
- Wired agent_handler to call START_WORKFLOW via gateway
- JWT token propagated to all workflow operations
- Store workflow_id/run_id in temporal_workflow_links table (migration 005)
- Document full Temporal integration flow
Temporal.io gRPC ← (gateway translates REST) ← POST /workflow api.riotpiao.com
↓
Agent handler receives workflow_id/run_id
↓
Store in temporal_workflow_links (external reference table)
↓
Query status via DESCRIBE_WORKFLOW action
Architecture: Temporal owns execution, Memory DB owns reasoning traces + links
Compilation: ✅
|
2026-09-05 00:37:58 -07:00 |
|