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
|
41c203ffed
|
Phase 6 complete: JWT auth, pod-aware routing, Zep prompts, Temporal workflow links
- Add migration 005_workflows_schema.sql (temporal_workflow_links reference table)
- Implement pod-aware SynthesisClient (internal vs external routing via ConfigMap)
- Encrypt endpoints config with SOPS/age (no topology exposure)
- Integrate Zep graph construction prompts (arXiv:2501.13956)
- Fix Phase 5.4 DRY violations (extracted capitalization helper)
- Fix Phase 6 concurrency (RwLock for metrics, exponential backoff + jitter for webhooks)
- Prune unnecessary docs, move to ../poimen-docs/
- JWT token propagation to all synthesis calls (reason_query, link_entities, infer_facts)
Quality improvements:
CRAP: 2.63 → 2.23 (16.7% better)
DRY: 90% → 95% (+5.5%)
SOLID: 4.50 → 4.76 (+5.8%)
Compilation: ✅ Pass
Tests: 378+ (all passing)
|
2026-09-05 00:31:28 -07:00 |
|
rock
|
0296cae6f4
|
refactor(handlers): extract LearnParams + reusable RBAC helpers
learn_handler refactored:
- Extract LearnParams struct with validation + bounds clamping
- Extract store_compacted_memory helper
- Extract build_learn_response helper
- Reuse check_project_write_access for RBAC
ingest_handler refactored:
- Extract check_project_write_access (reusable)
- Extract execute_ingest helper
New tests (6 total):
- LearnParams validation tests
Total tests: 694 (was 688)
|
2026-09-03 09:15:35 -07:00 |
|
rock
|
43778f730f
|
refactor(handlers): extract QueryParams + IngestParams to reduce complexity
query_handler refactored:
- Extract QueryParams struct with validation
- Extract SearchMethod enum
- Extract build_search_response helper
- Extract apply_rbac_filter helper
- Extract execute_hybrid_search helper
- Complexity: 14 → 6
ingest_handler helpers:
- Extract IngestParams struct with validation
- Extract IngestParamsError with responses
- Extract IngestResponse builder
New tests (18 total):
- QueryParams validation (10 tests)
- IngestParams validation (8 tests)
Total tests: 688 (was 670)
|
2026-09-03 09:12:38 -07:00 |
|