LabKit MATLAB Workbench

history

Canonical role-based source collections

id: LK-20260716-canonical-role-based-sources
date: 2026-07-16
sequence: 73
type: refactor
compatibility: compatible
component: `labkit_RHSPreview_app` | `1.4.0 -> 1.4.1`
component: `labkit_NerveResponseAnalysis_app` | `1.4.0 -> 1.4.1`
scope: project payload schema
scope: source roles and relinking

Context

RHS Preview and Nerve Response Analysis stored external files in separate app-specific fields such as rhsSource, filterSources, and protocolSource. The records already carried explicit roles, but Runtime V2 could only discover the canonical project.inputs.sources collection during portable save/load and missing-file relinking.

Decision and rationale

Store every external dependency in one canonical collection and select records by their app-owned role. The framework remains domain-neutral, while each app continues to distinguish preview recordings, filter recordings, filter JSON, and optional protocols without duplicating persistence mechanics.

Changes

User and data impact

Project reopen, result provenance, and future missing-file recovery can now see all selected dependencies. Preview, filtering, event detection, CAP metrics, and output formats are unchanged.

Compatibility and migration

Existing version 1 payloads remain readable and preserve every source record. The old fields are removed only from the migrated in-memory project; saving writes the version 2 canonical collection.

Validation

Focused unit tests verify role-preserving migrations and project versions. Focused GUI workflows verify RHS indexing, multiple filter-file management, project save/reopen, filter analysis, export, and transient cache rebuilding.

Evidence

Known limitations and follow-up

This change makes every source discoverable but does not yet rebase relative paths at the final project save destination. That framework serialization change is tracked as the next persistence batch.