From 4c437932813fc41850b7c5f247b1a0da3b811e2b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 21:50:55 +0000 Subject: [PATCH] Carry distance_metadata and global-clock oneepoch whole as v1 [reshaped retire classes carried] (Jess Haley, 2026-10-29, did-schema V_eta_go_forward_class_audit.md, "B"): v1 distance_metadata and oneepoch are carried whole as v1 for now, not reshaped into their retire classes. - +migrators_j/oneepoch.m: a oneepoch on a global clock, which kept the class with its element_epoch block folded on, is carried as the untouched v1 source citing carry-148 (awaiting_home). The carry-126 (device-local) and carry-100 branches are unchanged; the fold code is removed. - +migrators_j/distance_metadata.m: every document the reshape reached is carried citing carry-147 (awaiting_home); carry-100/carry-049 unchanged; the endpoint-reshape helpers are removed. - The two round-trip inverses are kept, noted as reached by no migrator output (as position_metadata's). Contents.m roster regenerated. Tests inverted, not deleted: testMigratorsJ (distance_metadata and the four oneepoch tests), testRawV1RoundTripOneEpoch, testRawV1RoundTripPosition. Needs did-schema #238 (register rows carry-147, carry-148) on main. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf --- src/did/+did2/+convert/+migrators/Contents.m | 5 +- .../+did2/+convert/+migrators_j/Contents.m | 5 +- .../+convert/+migrators_j/distance_metadata.m | 150 ++--------- .../+convert/+migrators_j/element_epoch.m | 4 +- .../+did2/+convert/+migrators_j/oneepoch.m | 90 ++++--- .../+convert/+roundtrip/distance_metadata.m | 7 + src/did/+did2/+convert/+roundtrip/oneepoch.m | 7 + tests/+did2/+unittest/testFixtureCorpus.m | 9 +- tests/+did2/+unittest/testMigrators.m | 3 +- tests/+did2/+unittest/testMigratorsJ.m | 250 +++++++----------- .../+unittest/testRawV1RoundTripOneEpoch.m | 52 ++-- .../+unittest/testRawV1RoundTripPosition.m | 62 +++-- .../+unittest/testResolveEpochProbemap.m | 3 +- 13 files changed, 283 insertions(+), 364 deletions(-) diff --git a/src/did/+did2/+convert/+migrators/Contents.m b/src/did/+did2/+convert/+migrators/Contents.m index 2e8548cc..e83c0009 100644 --- a/src/did/+did2/+convert/+migrators/Contents.m +++ b/src/did/+did2/+convert/+migrators/Contents.m @@ -42,8 +42,9 @@ % % The position_metadata, distance_metadata and stimulus_bath base migrators % are deleted too: each class has a +migrators_j migrator, which reads raw v1 -% (distance_metadata's reshapes the v1 spelling itself, where it used to hand -% the renamed body to the base migrator). +% (distance_metadata's reshaped the v1 spelling itself, where it used to hand +% the renamed body to the base migrator; since [reshaped retire classes +% carried], Jess Haley, 2026-10-29, it carries every document whole as v1). % % The element, ontology_image and ontology_label base migrators are deleted % (2026-10-27): each class has a +migrators_j migrator that reads raw v1, and diff --git a/src/did/+did2/+convert/+migrators_j/Contents.m b/src/did/+did2/+convert/+migrators_j/Contents.m index c4da6df5..dfea9d20 100644 --- a/src/did/+did2/+convert/+migrators_j/Contents.m +++ b/src/did/+did2/+convert/+migrators_j/Contents.m @@ -695,8 +695,7 @@ % deleted 2026-10-21; the class is now `schemas/V_eta/stable/demo.json`); the % fold itself is in private/jDemoFold. % distance_metadata -% Brainstorm-J migrator: reshape a did_v1 distance_metadata into the validated -% V_eta distance_metadata. 1 -> 1. +% Brainstorm-J migrator: carry a v1 distance_metadata whole as v1. 1 -> 1. % electrode_offset_voltage % Brainstorm-J migrator: did_v1 electrode_offset_voltage -> an `observation` % with value kind `voltage` about the probe's entity, qualified by the @@ -820,7 +819,7 @@ % sorted unit's own entity (+ the shared session anchor, the software and its % run); no entity of its own. % oneepoch -% Brainstorm-J migrator: keep the class, fold its inherited block. +% Brainstorm-J migrator: carry a v1 oneepoch whole as v1. 1 -> 1. % ontology_image % Brainstorm-J migrator: did_v1 ontology_image, dispatched ON SHAPE. The % current NDI shape (`ontology_nodes` + an `ontologyTableRow_id` edge + the diff --git a/src/did/+did2/+convert/+migrators_j/distance_metadata.m b/src/did/+did2/+convert/+migrators_j/distance_metadata.m index 676d693f..e547561b 100644 --- a/src/did/+did2/+convert/+migrators_j/distance_metadata.m +++ b/src/did/+did2/+convert/+migrators_j/distance_metadata.m @@ -1,6 +1,22 @@ function bodies = distance_metadata(preBody) -%DISTANCE_METADATA Brainstorm-J migrator: reshape a did_v1 distance_metadata into -% the validated V_eta distance_metadata. 1 -> 1. +%DISTANCE_METADATA Brainstorm-J migrator: carry a v1 distance_metadata whole as +% v1. 1 -> 1. +% +% ================ [reshaped retire classes carried] ===================== +% Decided by Jess Haley, 2026-10-29 (did-schema +% V_eta_go_forward_class_audit.md, "B"): v1 `distance_metadata` and +% `oneepoch` are carried whole as v1 for now, not reshaped into their retire +% classes; the reshape waits for their V2 homes (`distance_metadata`: a +% decision still to make, docs/V2_PLAN.md G50). So EVERY distance_metadata +% is carried whole as v1 (the untouched v1 source, with a `carried_as_v1` +% note): one holding a field outside its NDI template under carry-100, as +% before, and every other one under register row carry-147, awaiting_home. +% The reshape into the V_eta `distance_metadata` (a class whose disposition +% is `retire`) described below is no longer done; the description is the +% record of what was replaced. did2.convert.roundtrip.distance_metadata, its +% inverse, is reached by no migrator output any more; a carried document's +% round trip is the carry itself (did2.convert.roundtrip.check). +% ======================================================================= % % Routed from did2.convert.v1_to_v2 only when TargetVersion == 'V_eta'. The v1 % doc is FLAT and records the two ENDPOINTS of a distance measurement, not the @@ -96,34 +112,17 @@ 'distance_metadata body is missing the distance_metadata property block.'); end -% the endpoint labels: the v1 suffixes, and on the renamed path (v1_to_v2 -% 'RawV1Classes', {}, until universalRenames is deleted) the suffixes of the -% spelling that pass gives them (ontology_node_a, integer_i_ds_a, ...) -labels = upper(suffixes); -renamed = renamedSuffixes(blk); -labels = [labels, upper(renamed(~ismember(upper(renamed), labels)))]; -[labels, order] = sort(labels); -raw = [suffixes, repmat({''}, 1, numel(labels) - numel(suffixes))]; -raw = raw(order); -endpoints = struct('label', {}, 'measurement', {}, ... - 'integer_ids', {}, 'string_ids', {}, 'numeric_values', {}); -for k = 1:numel(labels) - endpoints(end+1) = buildEndpoint(blk, labels{k}, raw{k}); %#ok -end - -unitsNode = ''; -if isfield(blk, 'units') - unitsNode = char(blk.units); -end - -v2Body = preBody; -if isfield(v2Body, 'depends_on') && ~isempty(v2Body.depends_on) - % the {name, document_id} entries the renamed path gave the document - deps = did2.convert.v1read.readDependsOn(src); - v2Body.depends_on = struct('name', {deps.name}, 'document_id', {deps.document_id}); -end -v2Body.distance_metadata = struct('endpoints', endpoints, 'units', ontologyTerm(unitsNode)); -bodies = {v2Body}; +% [reshaped retire classes carried] (Jess Haley, 2026-10-29, did-schema +% V_eta_go_forward_class_audit.md): no longer reshaped into the retire class +% `distance_metadata`; carried whole as v1 until its V2 home is decided. +b = did2.convert.v1read.readBase(src); +id = b.id; +if ~ischar(id); id = ''; end +% carry-register: carry-147 +did2.convert.reportNote('carried_as_v1', 'distance_metadata', id, ... + ['[carry-147] awaiting_home: distance_metadata, until its V2 home is ' ... + 'decided ([reshaped retire classes carried])']); +bodies = {src}; end function suffixes = endpointSuffixes(block) @@ -138,94 +137,3 @@ end end end - -function suffixes = renamedSuffixes(block) -% Every x with an `ontology_node_x` field (universalRenames' spelling). -suffixes = {}; -fns = fieldnames(block); -for k = 1:numel(fns) - tokens = regexp(fns{k}, '^ontology_node_(.+)$', 'tokens', 'once'); - if ~isempty(tokens) && ~any(strcmpi(suffixes, tokens{1})) - suffixes{end+1} = tokens{1}; %#ok - end -end -end - -function [v, found] = endpointField(block, rawName, x, renamedName, label) -% The v1 field _, else universalRenames' _