Skip to content

Migration phase 1: register citations, deterministic ids, filters as methods - #251

Merged
jesshaley merged 22 commits into
V2from
claude/phase1
Oct 27, 2026
Merged

jesshaley merged 22 commits into
V2from
claude/phase1

Conversation

@jesshaley

Copy link
Copy Markdown
Collaborator

This is phase 1 of the plan for a complete generic migration (did-schema docs/V2_PLAN.md). It builds the DID-matlab half of decisions by Jess Haley recorded in did-schema schemas/V_eta_go_forward_class_audit.md. The schema it needs, did-schema #162 ([filters are methods]), is now on did-schema main (4b63810).

What changes

Carry register ([carry register])

  • Every carry note cites its register row ([carry-NNN] with a % carry-register: marker). The citation check is strict.
  • The migration report counts carries by row.

Deterministic ids ([migration reliability practices] (b))

  • Minted documents get ids derived from the source id, role and ordinal.
  • This covers epoch ids and deferred-bath ids.

Early pieces fixed ([early migration pieces fixed])

  • "Already converted" is a stamp check (4).
  • resolveLawnPlateSubjects is deleted (6).

Decisions built

  • [ingested session membership]
  • [pass-through filter sample frequency]
  • [untied epochs keep the session anchor]
  • [vehicle rate needs a map]
  • [second measurement value needs a map]
  • registry spellings ([migrator writes the registry spelling])

Defects are errors ([pipeline defects are not carries])

  • A schema that still declares filter_id fails with did2:convert:schemaTooOld instead of quarantining.

[filters are methods]

  • The frequency_filter path is removed.
  • A filter becomes a method, and sampled_body.method_id points at it.

Measured, not enforced

  • Unregistered terms the migration writes are reported. TermRegistry stays off while migrating.

Pairing

NDI-matlab branch claude/phase1 (185e381b4) carries the matching NDI test update for [untied epochs keep the session anchor]. Its e2e run against this branch and #162's schema passed (run 40427562043: 481 passed, 0 failed). The NDI PR follows this one.

CI


Generated by Claude Code

claude added 20 commits October 26, 2026 15:29
Decided by Jess Haley, 2026-10-26 [carry register] (did-schema
schemas/V_eta_go_forward_class_audit.md): every carry note a migrator
writes cites its row of did-schema schemas/V_eta_carry_register.json, and
a DID-matlab test fails on a carry whose reason is not registered.

- Each `carried_as_v1` note now carries a `[carry-NNN]` tag before the
  reason it covers: at the start when the whole note is one row's
  ('[carry-022] needs_mapping: ...'), before each item when a note lists
  reasons of different rows. 24 of the register's 26 rows are cited.
- Every carry site (37) has a `% carry-register:` comment above it naming
  its row(s), or `none` where the register has no row yet. No row is
  invented: the `none` sites are listed by the gate for the team.
- Rows whose v1_class is `treatment` / `imageStack` are cited only for
  that class (jTreatmentBodies.treatmentRow, image_stack.carryRowOf);
  treatment_drug, virus_injection and image carries reach the same code
  and are listed as having no row.
- jCarryWhy recognises a needs_mapping entry after its row tag.
- tools/check_carry_citations.py (the gate) fails on a row id the
  register does not hold, a carry site with no marker, or a marker naming
  a row whose tag the code does not write; it lists `none` sites (and
  fails on them with --strict). tools/test_check_carry_citations.py tests
  it on temp trees. Both run in test-migrators-quick.yml against the
  did-schema checkout there.
- Tests that asserted a note's start now assert its row tag
  (testMigratorsJ, testOntologyTableRowSubject).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
did-schema claude/carry-register-rows (#151) holds 56 carry register rows.
Every carry site whose reason now has a row writes its `[carry-NNN]` tag and
names the row in its `% carry-register:` marker:

- element_epoch clock (038), daqreader_ndr file_extension (039),
  daqmetadatareader_epochdata_ingested (046), stimulus_presentation (045),
  stimulus_response_scalar (050), subject (033), subject_group (034),
  syncrule_mapping (036), treatment_transfer (035), treatment not a
  manipulation (032), position_metadata (053), image.label (051),
  imageStack document_id (052), lightsheet empty level (037), element (048
  empty, 055 not reversible), hartley stimulus_properties not compared (040),
  neuron counts with no waveform (041), metadata_editor (043, 044, 054),
  calculator fields with no fold home (056), pyraview unmapped filter (042),
  universalRenames would discard (049, v1_class '*', temporary).
- jTreatmentBodies.treatmentRow tags by class: treatment 023/024,
  treatment_drug 027/028 (and 031 for a conflicting amount), virus_injection
  029/030.
- Tests that assert a note's start or parse its fields follow the tags.
- test-migrators-quick reads the register from the same-name did-schema
  branch, else claude/carry-register-rows while it exists, else main, and
  prints the ref. The gate stays non-strict: 8 sites still have a reason
  with no row (listed by the gate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Practice (d) of [migration reliability practices] (Jess Haley, 2026-10-26,
did-schema V_eta_go_forward_class_audit.md): carry counts by register row in
the migration report.

- reportNote 'collect' adds, for carried_as_v1 only, register_rows /
  register_row_counts (parsed from each DETAIL's `[carry-NNN]` tags, exact:
  from distinct_details), notes_citing_a_row and notes_citing_no_row; the
  denominator is .count.
- v1_to_v2 prints the per-row block under the carried_as_v1 note, denominator
  first.
- writeCorpusReport writes a carried_as_v1 block in every corpus report that
  collected notes (no carry is a measured 0), and census_digest renders it
  (NOT MEASURED when absent), with tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
The gate's real-tree test read ./did-schema (main), which lacks the rows
carry-027..056, so it failed (Quick migrator tests run 40398051666). It now
runs after the register ref is resolved, with DID_SCHEMA_ROOT set to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
… fixed] (6))

Decided by Jess Haley, 2026-10-26 [early migration pieces fixed] (6) (did-schema
V_eta_go_forward_class_audit.md): the uncalled resolveLawnPlateSubjects and its
mentions are deleted from DID-matlab ([dataset-specific logic leaves the
generic migration]).

- Deleted: src/did/+did2/+convert/resolveLawnPlateSubjects.m (with its
  WIRING-EXEMPT line), tests/+did2/+unittest/testLawnPlateSubjects.m (tested
  only it), tools/dev/lawn_plate_mutation_harness.py (a transliteration of it).
- Mentions removed: subject.m, epochMint.m, Contents.m, resolveValidIntervals.m,
  foldGenericFiles.m, the "is NOT run" notes in runCorpusDiscovery,
  testFixtureCorpus, testCorpusPRED, writeCorpusReport, and the dead
  `lawn_plate_subjects` case of runCorpusDiscovery's pass printer.
- tools/test_affected_corpora.py used the name as a synthetic batch-pass
  path; it now uses resolveDeferredBaths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
…eces fixed] (4))

Decided by Jess Haley, 2026-10-26 [early migration pieces fixed] (4) (did-schema
V_eta_go_forward_class_audit.md): "already converted" is a stamp check
(`did_v1` / `did_v2`), not a rank against `V_eta`.

isAlreadyTarget now asks did2.schema.isV2Stamp of the body's stamp and of the
stamp the target writes (targetStamp: 'V_eta' -> 'did_v2') instead of
comparing schemaVersionRank values. 'V_eta' is NOT accepted as a stamp: that
follows [V_eta stamp not accepted] (Jess Haley, 2026-10-25, "Stop accepting
veta"), which refuseUnknownSchemaVersion already enforces. The v1_to_v2
header, Contents.m and schemaVersionRank's header say so; testDocumentStamps
pins every known name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
[early migration pieces fixed] (3) (Jess Haley, 2026-10-26): the TermRegistry
strict check is to stay on during migration, an unregistered term becoming a
carry with a register row or a registry row. No register row covers an
unregistered term yet, so turning it on now would quarantine. It stays off in
v1_to_v2 and epochMint for now; testFixtureCorpus gains a report-only test
that lists every unregistered term each fixture body's v1 class writes, and
what the batch passes write, so the team can add registry or register rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
…ty practices] (b))

Practice (b) of [migration reliability practices] (Jess Haley, 2026-10-26,
did-schema V_eta_go_forward_class_audit.md): deterministic ids for new
documents, so two runs on the same input give the same ids.

- New did2.convert.mintId: an id in did.ido's format (16 hex, '_', 16 hex)
  derived by SHA-256 from (source id, role, ordinal); the first half is the
  source's own when it is a did.ido id. Contexts: v1_to_v2 opens one per
  source body keyed on its v1 base.id; the minting batch passes
  (foldGenericFiles, resolveEpochProbemap, resolveOpenmindsCitations,
  resolveValidIntervals) open one per run and name the source at each site.
  With no context, or no source id, the id is random, as before.
- did2.build.document mints a missing Id through it (role 'build:<class>'),
  so every statement, relation and anchor a migrator builds is derived.
- Sites changed: neuron_extracellular (neuron), dataset_remote (organization),
  jSorterOutput (file uid), jAcquisitionChannels, metadata_editor (person,
  award, publication, web resource), entities.orgFor, entities.freshBase,
  resolveValidIntervals.freshBase, foldGenericFiles (opaque body, file uid),
  resolveEpochProbemap (file uid).
- testMintId: format, two runs equal, random outside a context, and
  v1_to_v2 twice over one treatment_drug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
…ces] (b))

epochMint mints one epoch entity per (session, epoch string): its id is now
did2.convert.mintId('epoch', '<session>|<epoch>'). resolveDeferredBaths opens
a mintId context keyed on the bath's v1 id, so the chemicals and formulation
it builds take derived ids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
testTwoRunsGiveTheSameIds minted the same (source, role) under two contexts,
which mintId by design derives to one id (Quick migrator tests run
40399932860). The test now names a distinct source per context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Decided by Jess Haley, 2026-10-26 (did-schema V_eta_go_forward_class_audit.md):
- [ingested session membership]: for an INGESTED session, jMembershipBodies
  drops `session_reference` when it equals the session entity's
  local_identifier, and writes the creator class as a "software class"
  (EMPTY:0000401) parameter of the "database ingestion" method; a reference
  that differs carries the document as v1 citing carry-060. The session is
  read from the batch through the new did2.convert.sessionReferences
  (v1_to_v2 indexes every v1 session first, as it does presentations); a
  session not in the batch cannot be compared and is carried (no row).
  Tests: equal (placed, creator kept), differing (carry-060), and the open
  cases.
- [vehicle rate needs a map]: a treatment_drug vehicle per-body-mass
  placeholder cites carry-057 (jTreatmentBodies).
- [second measurement value needs a map]: jMeasurementFold cites carry-058
  (measurement) and carry-059 (subjectmeasurement).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
…gh filter sample frequency])

Decided by Jess Haley, 2026-10-26 [pass-through filter sample frequency]
(did-schema V_eta_go_forward_class_audit.md): the sampleFrequency an all-pass
pyraview filter states is not carried when it equals the pyraview's
native_rate, which the V2 body keeps; a value that differs is carried as v1,
malformed (carry-061).

jFrequencyFilter takes the caller's native rate (pyraview passes its stated
native_rate); with none stated the old carry stands. Tests: equal (placed, no
carry) and differing (carried, carry-061).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Decided by Jess Haley, 2026-10-26 [untied epochs keep the session anchor]
(did-schema V_eta_go_forward_class_audit.md): an element epoch that cannot be
tied to an acquisition system is not carried when all of its extents come
from one untied source and agree: it keeps a session-anchored time reference,
using only the times the epoch states. Several sources, or disagreeing
extents, still carry it.

epochMint holds untied sources aside and, after the tie loop, anchors an
epoch's extents on the session document when exactly one untied source
states them, no tied source does, and no clock is stated twice with
different times; otherwise every untied source is carried as before. New
counter epoch_extent_untied_session_anchored (rendered by census_digest).
testEpochMint: a 20211116-shaped epoch (no epochprobemap) keeps one
session-anchored reference; two untied sources are carried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Quick migrator tests run 40402155824 (attempt 2): the session-anchored
reference names the session entity (its id is the session id, as
migrators_j.session writes it), not the v1 session document's id; and
testResolveEpochProbemap asserted the old carry of a single untied extent. It
now asserts that a single agreeing untied source is not kept as carried, and
that two untied sources of one epoch are both carried and kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
did-schema claude/registry-terms adds carry register rows for six carry
sites whose reasons had none (Jess Haley, 2026-10-26: "yes, add the rows
and terms"; the kinds of the new rows are proposed, not decided):
carry-067 a v1 image's document_id edge; carry-068 an unreadable
is_linked; carry-069 an ingested session not in the batch; carry-070 /
carry-072 a vehicle amount placeholder on a treatment / virus_injection;
carry-071 / carry-073 a conflicting amount on them. An empty is_linked
cites carry-066.

Still with no row (listed by check_carry_citations, so it stays non
strict): metadata_editor's form field with no binding in the loaded
schema, a linked session's reference and a non-copy creator input, and a
pyraview sampleFrequency on the pre-[filters are methods] path.

The quick workflow reads the register from did-schema
claude/registry-terms while that branch exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Fixtures (tests): node and label now agree, checked on OLS4 and Addgene.
chebi:28001 is vancomycin: haloperidol is CHEBI:5613, muscimol CHEBI:7035.
uberon:0000922 is "embryo": the graft's "embryonic tissue" is UBERON:0005291.
addgene:26973 is pAAV-hSyn-hChR2(H134R)-EYFP (label was "AAV-ChR2").
edam:3382 is topic_3382 Imaging, not a format: EDAM:format_3591 TIFF.

[migrator writes the registry spelling] / [term labels stay as the ontology
spells them] (Jess Haley, 2026-10-26): a licence is written through
did2.convert.registeredTerm (spdx:CC-BY-4.0 'Creative Commons Attribution 4.0
International'); an image file format named by a registered name ('tiff')
is the registry's TIFF EDAM:format_3591; axis letters x, y, z, t are
NCIT:C44477 X-Coordinate, NCIT:C44478 Y-Coordinate, NCIT:C44479 Z-Coordinate,
om:Time time (did2.convert.axisTerm), each only where the loaded registry
holds the node, else by name as before. did2.convert.axisKey reads an axis
back by node, then name; foldGenericFiles uses it.

[pipeline defects are not carries] (Jess Haley, 2026-10-26): metadata_editor
with a form field whose binding the loaded schema lacks, and pyraview's
filter sampleFrequency on the pre-[filters are methods] frequency_filter
path, raise did2:convert:schemaTooOld instead of carrying the document.
Tests for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
did-schema #151 and #152 are merged to main (a56fb15), so the carry
register is read from the did-schema the workflow already checks out (a
same-name branch, else main); the claude/registry-terms and
claude/carry-register-rows fallbacks are dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
did-schema main (a56fb15, #151/#152 merged) registers UBERON:0002436,
Spatial Frequency and Temperature, so the migrator writes them as the
registry spells them ([migrator writes the registry spelling], Jess Haley,
2026-10-26). Quick migrator tests run 40420831525: nine assertions expected
the source spelling. They now expect the registry's node or label when the
loaded registry holds the term, the source spelling otherwise (regNode,
regName).

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

[filters are methods] (Jess Haley, 2026-10-22): did-schema
claude/filters-are-methods deletes frequency_filter and renames
sampled_body.filter_id to method_id. The nine tests that assert a
frequency_filter document or a filter_id edge now assume-skip unless the
loaded sampled_body declares filter_id, naming the decision. Each gains a
method-path twin asserting the same facts on the method document (design
term, band, passband edges, order, ripple, attenuation, units, the one
method per pyraview, validation). The two method-path tests and the twins
run on the loaded schema when its sampled_body declares method_id, and on a
renamed copy otherwise; no assumeFail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
[filters are methods] (Jess Haley, 2026-10-22): did-schema deletes
frequency_filter and sampled_body.filter_id. jFrequencyFilter builds only
the method document; a loaded sampled_body that still declares filter_id
raises did2:convert:schemaTooOld for every filter it would build ([pipeline
defects are not carries], 2026-10-26), and one declaring neither edge
raises did2:convert:noFilterEdge. pyraview drops its FilterId branch and
did2.build.sampledBody drops the FilterId option.

The guarded frequency_filter tests are removed; their facts are asserted
on the method document by the tests added in the previous commit. The
schemaTooOld test now covers a block with and without a sampleFrequency,
on the loaded schema when it declares filter_id or on a copy renamed back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Comment thread src/did/+did2/+convert/v1_to_v2.m Fixed
neuron_extracellular.m: carryTag was initialised to '' and then assigned
in both branches of the if/else before its only read, so the initialiser
was dead. The six onCleanup assignments keep their variable (it holds
the cleanup's lifetime); only the stale %#ok<NASGU> pragma is removed.

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

Quick CI run 40431025867 (4bc6af8), and 40430884715 on 3c717eb, which
was green as run 40425115184, failed two tests; the lint commit is not the
cause:

- testBatchPassWiring/testCrossRepoDivergenceIsExactlyTheCheckedInTable:
  "carryRowOf runs on the NDI side ONLY". NDI-matlab #1074 (38adc701b, in
  V2 and the claude/phase1 branch CI checks out) made ndi.migrate.local call
  ndi.migrate.internal.carryRowOf ([carry register], Jess Haley,
  2026-10-26). The table gains its row: a lookup, whose DID-side counterpart
  is reportNote's registerRowCounts reading the same [carry-NNN] tag.
- testMigratorsJ/testTreatmentSubstanceIsDoseManipulation: expected
  'numeric value', got 'Numeric Value'. did-schema main (#161) registers
  NCIT:C81274 "Numeric Value", so the migrator writes the registry's label
  ([migrator writes the registry spelling], [term labels stay as the
  ontology spells them]); the test expects regName('numeric value'), as
  b560110 did for the other registered terms.

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 27, 2026 02:01
@jesshaley
jesshaley merged commit 1f83af3 into V2 Oct 27, 2026
12 checks passed
@jesshaley
jesshaley deleted the claude/phase1 branch October 30, 2026 13:59
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.

3 participants