Repository navigation
Flat-layout readers in +convert and +validate (ids, blocks, gap paths, kind cells) - #597
Merged
Merged
Conversation
…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
This was referenced Dec 3, 2026
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
marked this pull request as ready for review
December 3, 2026 23:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft. Flat-layout follow-up (did-schema #414), DID-matlab:
+convertand+validateread the documents they build in either layout, through the existing accessors (did2.document.idOf,did2.schema.cache/valueCellIn,blockView, made public here asdid2.document.blockOf). On did-schemamain(nested,valuecells) 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 branchclaude/flat-readersat #469's head (8a944406), sotest-builder.ymlandtest-migrators-quick.ymlrun against it, whiletest-code.ymlruns againstmain.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 indid2.document/getanddid2.query; nothing here changes it.Changes
did2.document.blockOf(doc, block)(the publicblockView;blockViewnow calls it) anddid2.document.setIdOf(doc, id). Every<expr>.base.idread in+convertand+validatebecomesdid2.document.idOf(<expr>)(216 reads in 78 files, by script; assignments left alone; v1 inputs included, sinceidOfreadsbase.idon a nested document). The guardsisfield(x,'base') && ... isfield(x.base,'id')become~isempty(did2.document.idOf(x))(38). Two re-ids of a built document usesetIdOf(jMethodSteps,epochMint's epoch time).+validate/pipelineMembers.mreadsentityanddirected_relationthroughblockOfdid2.build.gapPath(path or gaps, class, 'ValueKind', kind): a 'Gaps' path written as today (dose.value.volume) named asdid2.buildnames it on the loaded schema (unchanged when nested;dose.volumeon the flat kind-cell schema). Used by the ten 'Gaps' callers #589 listed.+build/private/fieldDef(did2.build.composite,valueCell): a pathvalue/<kind>.valueis the kind's cell, socomposite(kind, 'value', ...)(jQuantity, fitEntry) reads either schemabase(baseField,baseTextin 21 files,baseOfin the two lightsheet zarr migrators,ingestedArchiveFiles'baseId) readidthroughidOf. The first flat run showedresolveResponseParametersreading''as every built document's id+build/Contents.mlistsgapPathNot 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). Theirbase.idand block reads are follow-ups for those PRs (see below).Runs
did-schema
main(nested;test-code.yml, which readsmainwhatever the branch):did.unittest709 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.did.unittest709 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'):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/getcalled by a test with a block path (get('entity.local_identifier'),get('statement.variable'),get('term.value')), 65 injCalculation(#585's file, below), and 19 indid2.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 fromjCalculation's, the only failure raised inside+convertis onemigrationReportrefusal of a known-defect entry a test (testBuildGaps) writes with a nested path; none starts in a+convertor+validatereader. Before this PR they werejSoftware76,neuron_extracellular30,resolveOpenmindsCitations25,ontology_image19,image_stack2,pyraview1,foldGenericFiles1,probe_geometry4 (gap paths),did2.build.composite18 (thevaluecell name).Follow-ups
jCalculation.m(Build #486 leftovers and V1-V4: carry-186 kind, mean+F1 sources, vmspike input sample interval #585): line 555 reads.base.idof a built document; 65 flat failures (hartley_calc,stimulus_tuningcurve,contrast_tuningand the other tuning calculators) start there. ItsfitPath = 'contrast_sensitivity.value.model_fit'also needsdid2.build.gapPathor the cell name. The other Build #486 leftovers and V1-V4: carry-186 kind, mean+F1 sources, vmspike input sample interval #585 files andresolveEpochProbemap.m(#484 W1-W3 on the time model: wirings of an epoch group, repeat build option #594),timeReference.m(timeReference: per-end approximate, tolerance and source record where the schema declares them #595) were not read for this.doc.base.id,doc.<block>.<field>orget('<block>.<field>')on documents they built. On did-schemamainthey pass. They have to read throughidOf/blockOf/valueCellInbefore did-schema switches (step 8). Not done here: it is test code across about 150 files.+convertcode that reads v1 documents (preBody.base.*,getBlock(preBody, ...)) is unchanged and stays so: a carried v1 document keeps its blocks.Needs a decision
did2.document/get. [base.id read through the switch window] letsget('base.id')read a flatid. Shouldget('<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)
did2.document.blockOf,did2.document.setIdOf,did2.build.gapPath.gapPathnames 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