diff --git a/TECH_DEBT_REGISTER.md b/TECH_DEBT_REGISTER.md index 7fc32011..5b2a15f8 100644 --- a/TECH_DEBT_REGISTER.md +++ b/TECH_DEBT_REGISTER.md @@ -8,7 +8,7 @@ | Status | Count | Total Impact | |--------|-------|--------------| -| Backlog | 0 | 0 pts | +| Backlog | 6 | 12 pts | | In Progress | 0 | 0 pts | | Completed | 1 | 1 pt | | No Action | 1 | 1 pt | @@ -30,6 +30,17 @@ | DEBT-005 | CA1861 (array overhead) | Low (1) | Low (1) | Deferred | Static readonly array allocations. Negligible perf; accept trade-off for readability. Revisit if conditions change. | @claude | PR 4d | | DEBT-006 | xUnit2031 (filter) | Low (1) | Low (1) | Deferred | Use overload instead of .Where() for Assert.Single. Analyzer nit; defer. Revisit if conditions change. | @claude | PR 4d | +### Gate 3 Simplified Analytics (Deferred per v16.0) + +| ID | Category | Impact | Effort | Status | Notes | Owner | ADR | +|----|----------|--------|--------|--------|-------|-------|-----| +| DEBT-009 | PBO/Sharpe calculation | High (3) | High (3) | Backlog | MetricsCalculator.cs:148,170 use simplified percentile formulas. Need proper CSCV-based PBO and DSR methodology. Required for production Sharpe baseline. Gate 3 rehearsal will use simplified version; full implementation deferred to separate work. | @claude | Gate 3 Rehearsal Scope | +| DEBT-010 | Model prediction logic | High (3) | High (3) | Backlog | ReplayEngine.cs:90,163 predict fixed quantities (100 units). Need actual position-sizing algorithm. Required for realistic cost simulation. Gate 3 uses fixed quantities; full implementation deferred. | @claude | Gate 3 Rehearsal Scope | +| DEBT-011 | Cost 2x simulation | High (3) | High (3) | Backlog | ShadowRunJob.cs:132 uses linear approximation (TotalReturn * 0.5m). Need full re-simulation with actual fee/slippage impact. Required for realistic scenario analysis. Gate 3 uses linear model; full implementation deferred. | @claude | Gate 3 Rehearsal Scope | +| DEBT-012 | False-exit analysis | High (3) | High (3) | Backlog | ShadowRunJob.cs:136-139, FalseExitAnalyzer.cs always returns 0. Unimplemented feature. Required for accurate sell-reason attribution. Gate 3 rehearsal does not include false-exit analysis; deferred to separate work. | @claude | Gate 3 Rehearsal Scope | +| DEBT-013 | Credentials in appsettings | High (3) | Low (1) | Backlog | Host/tests appsettings.json contains plaintext DB password (kartsell4321@!). Must migrate to Gitea Actions Secrets and environment variables. Security compliance required. | @claude | Security / Ops | +| DEBT-014 | Duplicate & reconciliation tracking | Medium (2) | Medium (2) | Backlog | MetricsSql.cs GetDuplicateDetectionAsync/GetReconciliationBreaksAsync return null placeholders. Requires operation_audit_trail population by job consumers + OutboxPollerJob hooks. Non-blocking; dashboard degrades gracefully. | @claude | Observability Enhancement | + ### Deferred Refactoring | ID | Category | Impact | Effort | Status | Notes | Owner | ADR | diff --git a/src/KArtSell.Host/Features/Observability/MetricsSql.cs b/src/KArtSell.Host/Features/Observability/MetricsSql.cs index 7312137d..a2fef771 100644 --- a/src/KArtSell.Host/Features/Observability/MetricsSql.cs +++ b/src/KArtSell.Host/Features/Observability/MetricsSql.cs @@ -71,24 +71,27 @@ public class MetricsSql public async Task<(int Detected, int Resolved, DateTime LastCheck)?> GetDuplicateDetectionAsync(CancellationToken cancellationToken = default) { - // Placeholder: outbox duplicate detection (table not yet in migrations) - // Returns null until outbox-duplicate-detection feature is implemented + // Placeholder: building_blocks.outbox_message table exists (0000_building_blocks.sql). + // Duplicate detection logging (via operation_audit_trail or dedicated table) not yet implemented. + // Returns null until OutboxPollerJob hooks duplicate tracking (see DEBT-014). await Task.CompletedTask; // Async compliance return null; } public async Task<(int Detected, int Resolved, List Pending)?> GetReconciliationBreaksAsync(CancellationToken cancellationToken = default) { - // Placeholder: Reconciliation break detection requires outbox/inbox log correlation - // Returns null until full audit trail correlation is implemented + // Placeholder: Reconciliation break detection requires outbox/inbox log correlation. + // Requires audit trail showing Evidence version mismatches. Not yet implemented. + // Returns null until operation_audit_trail is populated by job consumers (see DEBT-014). await Task.CompletedTask; // Async compliance return null; } public async Task<(decimal Baseline, decimal Current)?> GetModelDriftAsync(CancellationToken cancellationToken = default) { - // Placeholder: Model drift calculation requires baseline comparison from shadow_run metrics - // Returns null until full OOS metrics are integrated from model_operations.shadow_run + // Placeholder: Model drift calculation requires baseline/current sharpe comparison from shadow_run results. + // Returns null until Gate 3 rehearsal populates model_operations.shadow_run with real metrics. + // Once shadow_run results exist, baseline/current sharpe can be calculated and compared (see DEBT-009). await Task.CompletedTask; // Async compliance return null; } diff --git a/src/KArtSell.Host/Program.cs b/src/KArtSell.Host/Program.cs index 8d6dd1aa..cb8f5ef0 100644 --- a/src/KArtSell.Host/Program.cs +++ b/src/KArtSell.Host/Program.cs @@ -117,6 +117,11 @@ builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddHttpClient(); +// KRX Data Service (real API, with KRX_API_KEY; fallback to stub data if key missing) +builder.Services.AddHttpClient(); +builder.Services.AddScoped(sp => + sp.GetRequiredService()); + // Observability Metrics builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/src/KArtSell.Modules.ModelOperations/ModelOperationsModule.cs b/src/KArtSell.Modules.ModelOperations/ModelOperationsModule.cs index d4593b10..eb0e9537 100644 --- a/src/KArtSell.Modules.ModelOperations/ModelOperationsModule.cs +++ b/src/KArtSell.Modules.ModelOperations/ModelOperationsModule.cs @@ -17,7 +17,7 @@ public static class ModelOperationsModule services.AddScoped(); services.AddScoped(); services.AddSingleton(); - services.AddScoped(); + // KrxDataService registered in Host.Program.cs as typed HttpClient services.AddScoped(); return services; } diff --git a/tests/KArtSell.Integration.Tests/appsettings.Development.json b/tests/KArtSell.Integration.Tests/appsettings.Development.json index 5e6676ff..1bad606b 100644 --- a/tests/KArtSell.Integration.Tests/appsettings.Development.json +++ b/tests/KArtSell.Integration.Tests/appsettings.Development.json @@ -1,5 +1,5 @@ { "ConnectionStrings": { - "Postgres": "Host=127.0.0.1;Port=5432;Database=kartselldb;Username=kartsell;Password=kartsell4321@!" + "Postgres": "Host=127.0.0.1;Port=5432;Database=kartselldb_test;Username=kartsell;Password=kartsell4321@!" } }