Skip to content

Store a migrated element's name apart from its reference - #299

Merged
jesshaley merged 5 commits into
V2from
claude/element-name-apart
Oct 30, 2026
Merged

jesshaley merged 5 commits into
V2from
claude/element-name-apart

Conversation

@jesshaley

@jesshaley jesshaley commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Decisions

  • Decided by Jess Haley, 2026-10-29 [element name and reference stored apart] (did-schema schemas/V_eta_go_forward_class_audit.md). A migrated element writes its v1 name, exactly, to the entity's name, and local_identifier stays the dataset-unique handle. The reference is read back as what follows the known name. As a result, every name and reference rebuilds, including a name that contains " (ref " or " | ". No new term and no schema change. carry-055 is no longer needed.
  • Decided by Jess Haley, 2026-10-30 [element name kept apart, base.name carried] (option (i)). local_identifier stays NDI's <name> | <reference>, the form built since [element local identifier is name and reference]; the earlier line's (ref N) wording was a wrong premise. An element whose v1 base.name is not empty is carried whole as v1, as malformed, under the new register row carry-149. ndi.element/newdocument writes base.name as '': at NDI-matlab main 441530d0, +ndi/element.m newdocument sets only element.*.

Dependency: carry-149 is on did-schema branch claude/ecstatic-pascal-md91fw (75db7c9), not yet on main. This repository's CI reads did-schema main, or a branch with the same name. Until carry-149 reaches main, the "Every carry note cites a carry register row" step fails its R1 check: the code cites a row that main's register does not have. Merge the did-schema side first.

Change

  • +migrators_j/element.m:
    • Writes name = v1 element.name, exactly; nothing is written when the name is empty.
    • Writes local_identifier with the new did2.convert.elementHandle. An integer reference produces the same text as before (int2str, as elementLocalIdentifier and NDI's display form write it). A non-integer reference is written with num2str(x,17), and a text reference verbatim.
    • The unpackable-pair carry branch (carry-055) is removed.
    • Elements that are still carried:
      • name and reference both empty: carry-048;
      • a reference that is neither one number nor one text: carry-120;
      • a non-empty base.name: carry-149, note [carry-149] malformed: ....
  • New did2.convert.elementNameReferenceApart(entityName, localId): when local_identifier starts with the entity's name, it reads the reference after it ( | X, or (ref X)). Otherwise, and for an entity with no name, it falls back to today's did2.convert.elementNameReference.
  • +roundtrip/element.m:
    • Reads element.name from the entity's name and the reference from what follows it, and rebuilds base.name as ''.
    • A document migrated before this change has no name, or a name that does not start its local_identifier. Its name and reference come from the old parse, and base.name from entity.name.
  • +roundtrip/private/manifestProbemap.m: reads the instrument's name and reference the same way.
  • epochMint.m / resolveEpochProbemap.m: the probe-map join key now comes from elementHandle, so it matches the identifiers that elements now get.
  • elementLocalIdentifier.m / elementNameReference.m are kept as mirrors of NDI's; their headers now point to the new functions. The jBaseName.m header is updated.

Tests

  • testRawV1RoundTripElement:
    • New testNameAndReferenceStoredApartRoundTrip. These elements convert and round-trip exactly, with entity.name checked:
      • leftcortex (ref 3) with reference 2, and with no reference;
      • leftcortex | 2 with no reference, and with reference 5;
      • reference 1.5;
      • a text reference;
      • an empty name with reference 2.
        These cases are inverted from the carry-055 rows of testCarriedElementsCiteTheirRows. That test now has a carry-120 row for a non-scalar reference.
    • New testAnEntityWithoutNameReadsByTheOldParse: an entity with no name still round-trips in both the | 2 and (ref 2) forms. So does a pre-change entity whose name is its base.name.
    • testABaseNameIsTheEntityName is replaced by testANonEmptyBaseNameIsCarried. The new test expects a non-empty base.name to be carried under [carry-149] malformed:. It keeps the old test's other checks: an empty base.name converts, entity.name is the element name, and the device validates.
    • testTheLocalIdentifierIsNameBarReference also checks entity.name.
  • testMigratorsJ: three bath tests gave their stimulator element base.name 'stimulator'. That value was incidental and is not one the writer produces. These fixtures now use '', as the writer does, so the stimulator is not carried.
  • Python, run locally against a did-schema checkout holding carry-149: check_carry_citations.py OK, with no carry-055 site left. check_migrator_roster.py OK. The quick workflow's python tool tests pass.

Not run locally: no MATLAB. CI is the only MATLAB run.

Known limit

A document migrated before this change is misread in one case: its entity.name holds its base.name, and that text happens to start its local_identifier. The round trip then reads it as the new layout and rebuilds base.name as ''. This has not been measured on the corpora.

Follow-up needed in NDI-matlab (separate PR)

+vintage/elementFields.m, elementDoc.m and elementNameReference must read the element name from the entity's name first and take the reference after it, falling back to the old parse. Until then, NDI splits local_identifier alone, which goes wrong for elements that now convert but used to be carried:

  • a name holding | with no reference;
  • a non-integer or text reference;
  • an empty name.

NDI's elementLocalIdentifier probe-map joins have the same gap.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf

[element name and reference stored apart] (Jess Haley, 2026-10-29,
did-schema V_eta_go_forward_class_audit.md): +migrators_j/element.m writes
the v1 element.name, exactly, to the entity's `name`, and keeps
'<name> | <reference>' in local_identifier (did2.convert.elementHandle).
The round trip reads the reference as what follows the known name
(did2.convert.elementNameReferenceApart), falling back to today's parse
for an entity with no `name`. A name that reads as a pair, a non-integer
and a text reference now convert; the unpackable-pair carry site is gone.

A non-empty v1 base.name, which [v1 name is the entity name] wrote to
entity.name, now has no field and is carried with no register row: an
open question for the team.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Decided by Jess Haley, 2026-10-30 [element name kept apart, base.name
carried] (did-schema V_eta_go_forward_class_audit.md): local_identifier
stays '<name> | <reference>', and an element whose v1 base.name is not
empty is carried whole as v1, malformed, under register row carry-149.
The carry site cites the row; testANonEmptyBaseNameIsCarried expects it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
…s carried

The run's migration_notes has no carried_as_v1 field when no document in
it was carried (CI on 050744f: 'Unrecognized field name carried_as_v1' in
testNameAndReferenceStoredApartRoundTrip, whose elements now convert).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
@jesshaley
jesshaley marked this pull request as ready for review October 30, 2026 07:31
@jesshaley
jesshaley merged commit 0e25c5b into V2 Oct 30, 2026
11 checks passed
jesshaley pushed a commit that referenced this pull request Oct 30, 2026
The one conflict, testRawV1RoundTripElement testCarriedElementsCiteTheirRows:
V2 (#299) replaced the carry-055 cases with the carry-120 one; this branch
added the carry-151 'unit, probe not in the batch' case. Both kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
jesshaley pushed a commit that referenced this pull request Oct 30, 2026
Merges origin/V2 (through #311), including #299 [element name and reference
stored apart]: carry-055 is gone, a reference neither one number nor one
text is carry-120, a non-empty base.name is carry-149, a unit whose probe is
not in the batch is carry-151.

Conflicts, both sides kept:
- +migrators_j/element.m header: V2's element.name / local_identifier rows
  (carry-048 / carry-120) with this branch's element.type rows (device kind,
  element type assertion only where the kind does not rebuild the word).
- +roundtrip/element.m header: V2's name/reference rows and pre-2026-10-29
  fallback with this branch's element.type-from-kind row.
- testRawV1RoundTripElement: V2's header row and tests; this branch's
  testEveryDeviceHasItsDecidedKind and
  testTheElementTypeAssertionIsKeptOnlyWhereTheKindDoesNotRebuildIt; the
  carried list is this branch's (stimulator, event, electrode spellings,
  neuron, cell, lfp, patch on a non-probe class) plus V2's carry-120,
  carry-048 and carry-151 rows, without the carry-055 rows (V2 converts
  them) and without the carry-121 rows (batch 2 makes them microscopes).
  testGroupIsWrittenAsTheRegistryNamesIt and
  testAUnitThatDisagreesWithItsProbeIsCarried, which #299 removed with no
  replacement while its header still cites carry-120 for the unit case,
  are kept.

Added on the merge:
- resolveEpochProbemap writes the decided recording / imaging mode as the
  recording observation's method term ([element type is a device kind
  term], [imaging mode is a method term], [element types batch 1],
  [element types batch 2], [cell-attached is OBI]): patch-attached
  OBI:0002179, brightfield-imaging EMPTY:0000300; counter
  mode_methods_written, rendered by census_digest.py. Test:
  testMigratorsJRecordingObservation/testTheDecidedModeIsTheObservationsMethodTerm.
- testRawV1RoundTripBath/testTheSwitchChangesNoBath compares the carried
  stimulator element by id only: a carried document is its v1 source as
  each path spells it (it failed on #304's head, CI run of 41ab1d6).

No file cites carry-055 or carry-121. MATLAB has not run on this merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
@jesshaley
jesshaley deleted the claude/element-name-apart branch October 30, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants