Sharang Parnerkar
7107a31496
refactor(backend/api): extract SourcePolicyService (Step 4 — file 7 of 18)
compliance/api/source_policy_router.py (580 LOC) -> 253 LOC thin routes
+ 453-line SourcePolicyService + 83-line schemas file. Manages allowed
data sources, operations matrix, PII rules, blocked-content log,
audit trail, and dashboard stats/report.
Single-service split. ORM-based (uses compliance.db.source_policy_models).
Date-string parsing extracted to a module-level _parse_iso_optional
helper so the audit + blocked-content list endpoints share it instead
of duplicating try/except blocks.
Legacy test compat: SourceCreate, SourceUpdate, SourceResponse,
PIIRuleCreate, PIIRuleUpdate, OperationUpdate, _log_audit re-exported
from compliance.api.source_policy_router via __all__.
Verified:
- 208/208 pytest pass (173 core + 35 source policy)
- OpenAPI 360/484 unchanged
- mypy compliance/ -> Success on 132 source files
- source_policy_router.py 580 -> 253 LOC
- Hard-cap violations: 12 -> 11
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 19:58:02 +02:00
..
2026-02-11 23:47:28 +01:00
2026-04-07 18:52:31 +02:00
2026-04-07 19:47:29 +02:00
2026-03-07 19:00:33 +01:00
2026-03-13 09:36:14 +01:00
2026-04-07 13:18:29 +02:00
2026-04-07 18:39:40 +02:00
2026-04-07 18:39:40 +02:00
2026-04-07 13:18:29 +02:00
2026-04-07 18:52:31 +02:00
2026-04-07 18:52:31 +02:00
2026-04-07 19:53:55 +02:00
2026-04-07 19:47:29 +02:00
2026-03-13 09:36:14 +01:00
2026-04-07 13:18:29 +02:00
2026-03-12 19:55:06 +01:00
2026-03-07 19:00:33 +01:00
2026-02-11 23:47:28 +01:00
2026-03-02 08:57:39 +01:00
2026-04-07 13:18:29 +02:00
2026-04-07 13:18:29 +02:00
2026-03-07 19:00:33 +01:00
2026-03-12 19:55:06 +01:00
2026-04-07 19:58:02 +02:00
2026-04-07 19:42:17 +02:00
2026-04-07 19:50:40 +02:00