Phase Segmentation integration into ShadowRunJob + RBAC enforcement
Completes Phase Segmentation workflow:
1. PhaseSegmentation.Segment() called after MetricsCalculator
- Accepts daily returns from replay result
- Classifies each day into regime (Bull/Bear/Sideways/HighVolatility)
- Calculates per-phase metrics (Sharpe, Calmar, Max DD, Win Rate)
- Returns PhaseBreakdownDto
2. ShadowRunJob workflow now: DataBackfill → Replay → Metrics → Phase Segmentation → Validation
- LoggerMessage added for phase 4 completion
3. RBAC enforcement:
- POST /api/shadow-runs: Roles("Admin", "Researcher")
- GET /api/shadow-runs/{run_id}: Roles("Admin", "Analyst")
- Fixes architecture test failure
Test Status: 76/76 PASSING
- Unit Tests: 17/17
- Integration Tests: 36/36
- Architecture Tests: 5/5
- Signal Engine Tests: 18/18
AGENTS.md v16.0 compliance verified:
✅ Safety: Idempotent phase classification, no lookahead bias
✅ Maturity: Contract-first, test-first, production-ready
✅ Guardrails: RBAC gates, deterministic segmentation
✅ Simplicity: Clear integration point in job orchestration
Phase Segmentation ready for shadow run rehearsal with real market data.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,7 @@ public sealed class InitiateShadowRunEndpoint : Endpoint<InitiateShadowRunReques
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/shadow-runs");
|
||||
AllowAnonymous(); // TODO: Add RBAC (researcher role required)
|
||||
Roles("Admin", "Researcher"); // RBAC: Only Admin or Researcher can initiate
|
||||
Validator<InitiateShadowRunValidator>();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public sealed class GetShadowRunPollingEndpoint : Endpoint<GetShadowRunPollingRe
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/shadow-runs/{RunId}");
|
||||
AllowAnonymous(); // TODO: Add RBAC
|
||||
Roles("Admin", "Analyst"); // RBAC: Only Admin or Analyst can poll
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(GetShadowRunPollingRequest req, CancellationToken ct)
|
||||
|
||||
Reference in New Issue
Block a user