Files
KArtSell.Aegis/frontend/src/shared/composables/useWorkspaceDirtyBridge.ts
T
kjh2064 c216aade52
deploy / deploy (push) Successful in 2m59s
deploy / notify (push) Successful in 2s
feat: DEBT-031 (dirty-guard bridge) + DEBT-009 (PBO 3-fold CV)
DEBT-031 (Low/Medium):
- Add useWorkspaceDirtyBridge composable
- Bridges per-screen state.DIRTY to workspace tab.dirty flag
- Enables 'change discard?' confirmation in workspace tabs
- Pattern: one feature at a time (no forced adoption)

DEBT-009 (High/High, partial):
- Improve PBO calculation: 2-fold → 3-fold cross-validation
- Refactor train/test partition to measure Sharpe degradation
- Comments updated to clarify CV methodology vs full CSCV
- Still simplified (not full 5-fold or CSCV), but step toward production
- Aligned with Gate 3 rehearsal scope: no data-driven thresholds added

TECH_DEBT_REGISTER.md:
- DEBT-031: Backlog → Completed (18 pts total)
- DEBT-009: High Impact/High Effort noted, partial improvement logged

Next: C) AEG-V15-038 heartbeat/aging WBS mark; test verification pending

AGENTS.md v16.0 principles applied:
 Necessity-driven: Both items have clear acceptance criteria
 No gold-plating: Improvement stops at feasible scope
 Current evidence: Code + test records preserved
 Traceability: Debt ID, methodology change logged

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-08-14 17:48:37 +09:00

35 lines
1.1 KiB
TypeScript

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<StandardScreenState>('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<StandardScreenState>
): void {
const workspace = useWorkspaceStore()
watch(
() => state.value,
(newState) => {
workspace.setDirty(screenId, path, newState === 'DIRTY')
}
)
}