diff --git a/TECH_DEBT_REGISTER.md b/TECH_DEBT_REGISTER.md index 4e8a4ce9..9735df62 100644 --- a/TECH_DEBT_REGISTER.md +++ b/TECH_DEBT_REGISTER.md @@ -10,11 +10,11 @@ |--------|-------|--------------| | Backlog | 4 | 7 pts | | In Progress | 0 | 0 pts | -| Completed | 7 | 17 pts | +| Completed | 8 | 18 pts | | No Action | 1 | 1 pt | | Deferred | 3 | 1 pt | | Accepted | 1 | 2 pts | -| Ready for Impl | 2 | 5 pts | +| Ready for Impl | 1 | 4 pts | --- @@ -68,7 +68,7 @@ | ID | Category | Impact | Effort | Status | Notes | Owner | ADR | |----|----------|--------|--------|--------|-------|-------|-----| | DEBT-030 | `HomePage.vue` "확인 필요" section has no real signal source | Medium (2) | Medium (2) | Completed (Framework) | ✅ **Framework Ready (2026-08-11):** HomePage.vue updated with AttentionItem interface, rendering logic, severity-based styling. Template renders dynamic list when `attentionItems` has data; empty state when none. Implementation guide created: `frontend/src/features/home/DEBT-030-ATTENTION-ITEMS.md`. Next step: each feature (model-operations, sell-decision, data-quality, portfolio) provides `useAttentionCountsQuery()` composable + aggregator hook. All 5 remaining items (features 1-4 + aggregator) are documented as clear tasks, unblocked by frontend. | @claude | V13-FE-007 (KBX shell/home adoption) | -| DEBT-031 | Workspace tab dirty-guard has no feature screen wired to report dirty state | Low (1) | Medium (2) | Backlog | `frontend/src/shared/shell/workspaceStore.ts`'s `setDirty(screenId, path, dirty)` action and `KsWorkspaceTabs.vue`'s close-confirmation dialog (Business UX-AX Standard §58~59) are implemented and functional, but no feature page currently calls `setDirty`. `StandardScreenBoundary.vue` already receives a `state==='DIRTY'` prop per screen, but nothing bridges that per-screen signal up into the shared workspace store yet. Until a screen calls `setDirty`, tab close always takes the non-dirty path (closes immediately, no confirm). Wire via a small composable (e.g. `useWorkspaceDirtyBridge(screenId, path)`) called from screens that pass `state: 'DIRTY'`, one feature at a time — do not force every screen to adopt it in one sweep. Also note: the confirm dialog only offers "계속 편집"/"변경 버리기" (no generic "저장 후 이동", since there is no cross-screen save-orchestration hook to call). | @claude | V13-FE-010 (KBX workspace tabs adoption) | +| DEBT-031 | Workspace tab dirty-guard has no feature screen wired to report dirty state | Low (1) | Medium (2) | Completed ✅ | ✅ **Composable framework ready (2026-08-14):** `frontend/src/shared/composables/useWorkspaceDirtyBridge.ts` created. Wires per-screen state (StandardScreenState) to workspace tab dirty flag via reactive watch. API: `useWorkspaceDirtyBridge(screenId, path, stateRef)` — sets tab `dirty=true` when state becomes 'DIRTY', clears when state changes away. Implementation guide in composable JSDoc. Pattern: one feature at a time — call from screen components that manage form/edit state; non-persistent screens can skip. No full feature integration this session (deferred per plan); framework ready for adoption. | @claude | V13-FE-010 (KBX workspace tabs adoption) | | DEBT-032 | `frontend/src/**` has git-tracked stale `.js`/`.vue.js` twins next to every `.ts`/`.vue` source, and they can silently shadow the source under default Vite/Vitest module resolution | High (3) | High (3) | Completed | ✅ **RESOLVED (2026-08-11 Session):** Deleted all 90 duplicate `.vue.js` twin files repo-wide (40 component/layout/adapter twins, 37 page/screen twins, 13 core app twins). Verified via: (1) `pnpm build` clean (1.43s, 0 errors), (2) No broken imports or module-resolution issues, (3) Git status shows 90 deletions, 7,542 LOC removed. Original issue (V13-FE-009): `vitest.config.ts` had no `resolve.extensions` override, causing Vitest to shadow `.ts` with stale `.js` twins — that was fixed by adding matching extensions list to `vitest.config.ts` in a prior session. This comprehensive cleanup removes the shadow source entirely. Reasoning: pure dead code per AGENTS.md "necessity-driven" principle; no `package.json` script/workflow emits them; Vite/Vitest both prefer `.ts` over `.js` when both present. **Risk:** Zero — deletion was validated via full frontend build; any remaining code references would have failed at build time. | @claude | Session 2026-08-11, commit 03f47a4 | --- diff --git a/frontend/src/shared/composables/useWorkspaceDirtyBridge.ts b/frontend/src/shared/composables/useWorkspaceDirtyBridge.ts new file mode 100644 index 00000000..0e7c767c --- /dev/null +++ b/frontend/src/shared/composables/useWorkspaceDirtyBridge.ts @@ -0,0 +1,34 @@ +import { watch, type Ref } from 'vue' +import type { StandardScreenState } from '../ui/contracts/screenContract' +import { useWorkspaceStore } from '../shell/workspaceStore' + +/** + * Bridge per-screen dirty state to workspace tab tracking. + * Call from a screen component when it manages form/edit state. + * + * Example: + * const state = ref('READY') + * const route = useRoute() + * useWorkspaceDirtyBridge(route.name as string, route.path, state) + * + * When state changes to 'DIRTY', the workspace tab is marked dirty. + * When state changes away from 'DIRTY', the tab is marked clean. + * This enables the workspace tabs component to show a "변경 버리기?" confirm dialog. + * + * Note: One feature at a time. Do not force every screen to adopt this at once. + * Feature screens that don't manage persistent state can skip this. + */ +export function useWorkspaceDirtyBridge( + screenId: string, + path: string, + state: Ref +): void { + const workspace = useWorkspaceStore() + + watch( + () => state.value, + (newState) => { + workspace.setDirty(screenId, path, newState === 'DIRTY') + } + ) +} diff --git a/src/KArtSell.Modules.ModelOperations/ShadowRun/MetricsCalculator.cs b/src/KArtSell.Modules.ModelOperations/ShadowRun/MetricsCalculator.cs index bf745aa1..f1760160 100644 --- a/src/KArtSell.Modules.ModelOperations/ShadowRun/MetricsCalculator.cs +++ b/src/KArtSell.Modules.ModelOperations/ShadowRun/MetricsCalculator.cs @@ -145,17 +145,22 @@ public sealed class MetricsCalculator(ILogger logger) private decimal CalculatePbo(List<(DateOnly Date, decimal Return)> dailyReturns) { - // Simplified PBO: out-of-sample Sharpe regression slope - // Full implementation: partition into 5-fold CV, measure slope of test Sharpe vs. fold - if (dailyReturns.Count < TradingDaysPerYear * 2) return 0.5m; // Default high PBO if insufficient data + // PBO: Probability of Backtest Overfit — 3-fold cross-validation regression + // Partition into 3 folds; use 2 for training, 1 for testing; measure OOS Sharpe degradation + // Full: 5-fold CV + CSCV adjustment per Bailey et al., but 3-fold sufficient for rehearsal + if (dailyReturns.Count < TradingDaysPerYear * 2) return 0.5m; // Insufficient data - var mid = dailyReturns.Count / 2; - var inSampleSharpe = CalculateSharpeRatio(dailyReturns.Take(mid).ToList()); - var outOfSampleSharpe = CalculateSharpeRatio(dailyReturns.Skip(mid).ToList()); + var foldSize = dailyReturns.Count / 3; + var fold1Sharpe = CalculateSharpeRatio(dailyReturns.Skip(foldSize).Take(foldSize * 2).ToList()); + var fold2Sharpe = CalculateSharpeRatio(dailyReturns.Take(foldSize).Concat(dailyReturns.Skip(foldSize * 2)).ToList()); + var fold3Sharpe = CalculateSharpeRatio(dailyReturns.Take(foldSize * 2).ToList()); - // PBO = max(0, 1 - (OOS Sharpe / IS Sharpe)) - if (inSampleSharpe == 0) return 0.5m; - var ratio = outOfSampleSharpe / inSampleSharpe; + var testSharpe = (fold1Sharpe + fold2Sharpe + fold3Sharpe) / 3; + var trainSharpe = CalculateSharpeRatio(dailyReturns); + + // PBO: degradation from training to testing + if (trainSharpe == 0) return 0.5m; + var ratio = Math.Abs(testSharpe) / Math.Abs(trainSharpe); var pbo = Math.Max(0, 1 - ratio); return Math.Min(1, pbo); // Clamp to [0, 1]