LabKit MATLAB Workbench

history

Runtime V2 lifecycle ownership across the app fleet

id: LK-20260715-runtime-v2-app-migration
date: 2026-07-15
sequence: 59
type: refactor
compatibility: breaking
component: `labkit.ui` | `5.2.0 -> 6.0.0`
component: `labkit_DICPostprocess_app` | `1.3.6 -> 1.4.0`
component: `labkit_DICPreprocess_app` | `1.4.0 -> 1.5.0`
component: `labkit_ChronoOverlay_app` | `1.3.6 -> 1.4.0`
component: `labkit_CIC_app` | `1.3.8 -> 1.4.0`
component: `labkit_CSC_app` | `1.3.10 -> 1.4.0`
component: `labkit_EIS_app` | `1.3.4 -> 1.4.0`
component: `labkit_VTResistance_app` | `1.3.8 -> 1.4.0`
component: `labkit_GaitAnalysis_app` | `1.0.0 -> 1.1.0`
component: `labkit_BatchImageCrop_app` | `1.6.8 -> 1.7.0`
component: `labkit_CurvatureMeasurement_app` | `1.3.5 -> 1.4.0`
component: `labkit_FLIRThermal_app` | `1.3.0 -> 1.4.0`
component: `labkit_FocusStack_app` | `1.4.9 -> 1.5.0`
component: `labkit_ImageEnhance_app` | `1.5.8 -> 1.6.0`
component: `labkit_ImageMatch_app` | `1.5.8 -> 1.6.0`
component: `labkit_VideoMarker_app` | `1.2.0 -> 1.3.0`
component: `labkit_FigureStudio_app` | `0.1.5 -> 0.2.0`
component: `labkit_NerveResponseAnalysis_app` | `1.3.5 -> 1.4.0`
component: `labkit_ResponseReviewStats_app` | `1.3.5 -> 1.4.0`
component: `labkit_RHSPreview_app` | `1.3.4 -> 1.4.0`
component: `labkit_ECGPrint_app` | `1.3.5 -> 1.4.0`
scope: `docs/`
scope: `docs/ui-runtime-redesign.md`
scope: runtime migration guidance

Context

App lifecycle, callback ordering, UI-derived state, project persistence, graphics resources, and result packaging were implemented repeatedly across apps. Migrating only the lifecycle names would have preserved the main author cost: each app would still need to understand raw controls, figure callbacks, and multiple competing state copies.

Decision and rationale

Make Runtime V2 the only write path and give the framework ownership of launch, startup, the FIFO event queue, atomic state commits, deterministic presentation, dialogs, interaction resources, project persistence, and result manifests. Apps retain explicit project/session/presentation/result contracts and all domain calculations, workflow decisions, plots, schemas, and exports.

This deliberately optimizes ownership and learning cost rather than total app line count. Explicit app contracts can add code in a large scientific app, but they replace hidden closure state and callback plumbing with one inspectable model. The remaining 36 public UI functions have distinct reviewed contracts; the earlier 32-function planning target was not forced through vague APIs.

Changes

User and data impact

App entrypoint names, scientific calculations, workflow decisions, plots, and existing export filenames remain stable. Current projects have a consistent save/reopen path, external sources use portable references, and result exports include a standard manifest. Runtime errors and modal interactions now pass through framework services, which also makes hidden validation deterministic.

Compatibility and migration

The migrated app versions require labkit.ui >=6 <7; they must not be copied into a UI 5 checkout. Supported V1 snapshots and documented legacy projects remain importable but are not written again. After import, save a new current project if continued editing or recovery is required.

Validation

Focused Runtime V2, project, interaction-hub, DIC point-matching, CIC, Figure Studio, app-boundary, and public-surface tests passed. The latest repair checkpoint additionally passed CIC/VT GUI workflows (2/2), Gait/app compatibility tests (21/21), Curvature and Video Marker GUI methods (6/6), focused framework menu/interaction tests (8/8), and three targeted interaction-hint methods (3/3). A real local legacy Video Marker autosave was read successfully without copying it into the repository. The documentation hierarchy checkpoint passed relative-link validation and 44/44 focused documentation, app-structure, build-task, and history guardrails. The Phase-6 buildtool changedFast checkpoint passed 15 framework GUI tests, 284 headless tests with one environment-assumption skip, and six representative GUI workflows. The final broad gate and any manual pointer or visual checks are reported with the merge handoff rather than embedded as mutable history.

Video Marker replacement tests exercise integer and subpixel translation, flat-patch fallback, repeated-input determinism, prediction caching, and coordinate parity with vision.PointTracker when that product is installed. buildtool baseMatlab confirms the production source resolves only to MATLAB.

Evidence

Known limitations and follow-up

Explicit domain contracts mean that large apps do not necessarily have fewer production lines. Further extraction is justified only by repeated mechanics, not by file-size targets. Pointer feel, drag ergonomics, and scientific visual judgment still require the documented manual app review before merge.