Skip to content

Flat-layout readers in +convert and +validate (ids, blocks, gap paths, kind cells) - #597

Merged
jesshaley merged 6 commits into
V2from
claude/flat-readers
Dec 3, 2026
Merged

jesshaley merged 6 commits into
V2from
claude/flat-readers

Conversation

@jesshaley

@jesshaley jesshaley commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Draft. Flat-layout follow-up (did-schema #414), DID-matlab: +convert and +validate read the documents they build in either layout, through the existing accessors (did2.document.idOf, did2.schema.cache/valueCellIn, blockView, made public here as did2.document.blockOf). On did-schema main (nested, value cells) every accessor reads as before, so nothing changes there. The flat kind-cell schema is did-schema #469; this branch's name has a did-schema mirror branch claude/flat-readers at #469's head (8a944406), so test-builder.yml and test-migrators-quick.yml run against it, while test-code.yml runs against main.

Decisions built

did-schema docs/plans/did_v2_go_forward_class_audit.md, Jess Haley: [flat document layout is the target] (2026-11-30), [no nested v2; layout switch is temporary] (2026-12-01), [a quantity cell is named for its kind] (2026-12-02), [external is declared on value, not in the kind cell] (2026-12-03). [base.id read through the switch window] (2026-12-02) was already built in did2.document/get and did2.query; nothing here changes it.

Changes

commit change
7dcc040 did2.document.blockOf(doc, block) (the public blockView; blockView now calls it) and did2.document.setIdOf(doc, id). Every <expr>.base.id read in +convert and +validate becomes did2.document.idOf(<expr>) (216 reads in 78 files, by script; assignments left alone; v1 inputs included, since idOf reads base.id on a nested document). The guards isfield(x,'base') && ... isfield(x.base,'id') become ~isempty(did2.document.idOf(x)) (38). Two re-ids of a built document use setIdOf (jMethodSteps, epochMint's epoch time). +validate/pipelineMembers.m reads entity and directed_relation through blockOf
ef858fe did2.build.gapPath(path or gaps, class, 'ValueKind', kind): a 'Gaps' path written as today (dose.value.volume) named as did2.build names it on the loaded schema (unchanged when nested; dose.volume on the flat kind-cell schema). Used by the ten 'Gaps' callers #589 listed. +build/private/fieldDef (did2.build.composite, valueCell): a path value / <kind>.value is the kind's cell, so composite(kind, 'value', ...) (jQuantity, fitEntry) reads either schema
f3f1c9f The local helpers that read one field of base (baseField, baseText in 21 files, baseOf in the two lightsheet zarr migrators, ingestedArchiveFiles' baseId) read id through idOf. The first flat run showed resolveResponseParameters reading '' as every built document's id
1c17a73 +build/Contents.m lists gapPath

Not touched (other open PRs)

resolveEpochProbemap.m, +roundtrip/private/epochGroupTimes.m, manifestProbemap.m (#594); +build/timeReference.m, timeSlots.m, timeValue.m (#595); jCalculation.m, jContrastSensitivityValue.m, jRawCarry.m, jResponseType.m, jTuningCurve.m, spike_extraction_parameters*.m, vmspikefilteringparameters.m, meanPlusF1Input.m, tuningInverse.m, the speed-tuning roundtrips, tuningBatchIndex.m (#585). Their base.id and block reads are follow-ups for those PRs (see below).

Runs

did-schema main (nested; test-code.yml, which reads main whatever the branch):

  • ef858fe, Test code run 47131929544: unit suite (job 144343671946) 2907 run, 2858 passed, 0 failed, 49 incomplete; did.unittest 709 of 709; corpus jobs JH and others, and the census / done-report job, passed. V2 at the base (062e9f5, run 47126115580) reads the same unit counts: 2907, 2858, 0, 49.
  • 1c17a73 (head), Test code run 47138367022: unit suite (job 144387436643) 2907 run, 2858 passed, 0 failed, 49 incomplete; did.unittest 709 of 709; corpus JH, corpus others and the census / done-report job passed. Fixture corpus and Codespell passed on every push.

The flat kind-cell schema (did-schema #469 head 8a944406, through the mirror branch; every job printed did-schema HAS branch 'claude/flat-readers'):

run commit did2.build tests (failed of run) quick migrator tests (failed of run)
V2 base, by dispatch: 47128920249 / 47128914040 062e9f5 141 of 438 1142 of 2907
47131929380 / 47131929552 ef858fe 130 of 438 969 of 2907
47134038734 (quick) f3f1c9f 967 of 2907
47138366426 / 47138366898 1c17a73 130 of 438 967 of 2907

What the 967 are, by the first frame outside the test file (1c17a73, job 144366655944; a test can fail at several points): 856 in the test file itself, 128 in did2.document/get called by a test with a block path (get('entity.local_identifier'), get('statement.variable'), get('term.value')), 65 in jCalculation (#585's file, below), and 19 in did2.build / the validator called by a test with a nested shape. The test-file failures are reads of the built document as nested: Unrecognized field name "base" 186, "statement" 31, "value" 29, "method" 17, "entity" 15, ... Apart from jCalculation's, the only failure raised inside +convert is one migrationReport refusal of a known-defect entry a test (testBuildGaps) writes with a nested path; none starts in a +convert or +validate reader. Before this PR they were jSoftware 76, neuron_extracellular 30, resolveOpenmindsCitations 25, ontology_image 19, image_stack 2, pyraview 1, foldGenericFiles 1, probe_geometry 4 (gap paths), did2.build.composite 18 (the value cell name).

Follow-ups

Needs a decision

  • Block-path reads through did2.document/get. [base.id read through the switch window] lets get('base.id') read a flat id. Should get('<class>.<field>') read a flat document's top-level field when the class is in its chain (128 flat test failures are that call)? Not built: it is not decided.

Proposed (not decided)

  • The names did2.document.blockOf, did2.document.setIdOf, did2.build.gapPath.
  • gapPath names a path written as today's nested path; callers keep writing nested paths and the helper translates, rather than each caller writing both forms.

https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf


Generated by Claude Code

…layout

Flat-layout follow-up (did-schema #414; [flat document layout is the
target], Jess Haley, 2026-11-30). On a flat schema did2.build writes a v2
document with its id at `id` and no class blocks (#589), and +convert and
+validate read the documents they built back as `x.base.id` and
`x.<block>.<field>`. On did-schema `main` nothing changes: every accessor
reads the nested shape as before.

- did2.document.blockOf(doc, block): the public form of +build's private
  blockView (which now calls it): the block of a nested document, the
  document itself when flat and the class is in its chain.
- did2.document.setIdOf(doc, id): writes `id` on a flat document, `base.id`
  otherwise. Used where a built document is re-id'd (jMethodSteps,
  epochMint's epoch time).
- `<expr>.base.id` reads in +convert and +validate become
  did2.document.idOf(<expr>) (mechanical; assignments left alone, v1 reads
  included since idOf reads `base.id` on a nested document), and the guards
  `isfield(x, 'base') && ... isfield(x.base, 'id')` become
  `~isempty(did2.document.idOf(x))`.
- +validate/pipelineMembers reads `entity` and `directed_relation` through
  blockOf.

Files other open PRs edit are not touched (#585, #594, #595:
resolveEpochProbemap, timeReference and the time-cell writers, jCalculation
and the #585 tuning files).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
- did2.build.gapPath(path | gaps, class, 'ValueKind', kind): a 'Gaps' path
  written as on today's nested schema (`dose.value.volume`,
  `coordinate_system.reference_point`), named as did2.build names it on the
  loaded schema: unchanged on a nested one; on a flat one the class block is
  dropped and `value` is the kind's cell ([a quantity cell is named for its
  kind], Jess Haley, 2026-12-02: `dose.volume`, `voltage.volts`). Used by
  the 'Gaps' callers #589 listed (gene_list_mapping, image_stack,
  neuron_extracellular, probe_geometry, virus_injection, jDoseBodies,
  jDoseValue (for jTreatmentBodies and treatment), jQuantity,
  resolveDeferredBaths). The name is Proposed.
- +build/private/fieldDef (did2.build.composite, did2.build.valueCell): a
  path `value` / `<kind>.value` is the kind's cell under the name the schema
  gives it, so jQuantity's and fitEntry's `composite(kind, 'value', ...)`
  read either schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
m = mintedIdxById(holder);
if ~timeModel
minted{m} = addDep(minted{m}, 'time_reference_id', nr.base.id);
minted{m} = addDep(minted{m}, 'time_reference_id', did2.document.idOf(nr));
The local helpers that read one field of a document's `base` block
(baseField, baseText in 21 files; baseOf in the two lightsheet zarr
migrators; ingestedArchiveFiles' baseId) read `id` through
did2.document.idOf, so a document did2.build wrote flat (`id`, no `base`)
gives its id instead of ''. On a nested document they read as before. The
first flat run of this branch showed it: resolveResponseParameters read ''
as every built document's id and reported each spike input as not found
(did2:convert:... in migrationReport, run 47131929552).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
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 December 3, 2026 23:08
@jesshaley
jesshaley merged commit 614f83f into V2 Dec 3, 2026
13 checks passed
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