Repository navigation
Read '<class>.<field>' from a flat document's top level through the switch window - #599
Merged
Merged
Conversation
…witch window did-schema docs/plans/did_v2_go_forward_class_audit.md, Decided by Jess Haley, 2026-12-03 [class-prefixed reads through the switch window] (Waltham-Data-Science/DID-schema#414): during the flat-layout switch window, did2.document/get('<class>.<field>') and did2.query also read a flat document's top-level <field> when <class> is in its class chain, read-only, as [base.id read through the switch window] does for base.id. Removed with the switch (step 10). A nested document reads as before. - did2.document.classPrefixedRest (Static, Hidden): the path without its class segment, for a flat document (id, document_class, no base) whose header's class_name or superclasses holds the segment and which has no top-level field of that name; '' otherwise. get() reads it after the base.id and base.session_id aliases; set() is unchanged. - did2.query walkPath reads it for a document (not a hasanyelement element). - compileQuery 'Flat': a positive term whose first segment is a present class compiles to (path as written) OR (rest, no base, no field named the class, isa the class); a negated one to 1=1. Both inexact (recheck). - testBuildFlatLayoutReadBoth: the assertion that entity.local_identifier does not match a flat entity is now the decided match. - Tests: testClassPrefixedFlatReads (nested unchanged, chain read, class not in chain, kind cell read literally, set unaffected, compileQuery); testSqliteDbFlatLayout agreement queries with class-prefixed paths. 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:30
jesshaley
pushed a commit
that referenced
this pull request
Dec 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
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. Builds one decision for the flat-layout switch (did-schema #414).
Decision built
did-schema
docs/plans/did_v2_go_forward_class_audit.md, Decided by Jess Haley, 2026-12-03 [class-prefixed reads through the switch window], tracked in Waltham-Data-Science/DID-schema#414: during the flat-layout switch window,did2.document/get('<class>.<field>')and DID-matlab queries also read a flat document's top-level<field>when<class>is in the document's class chain (its class or a superclass), read-only, as [base.id read through the switch window] does forbase.id; removed with the switch (step 10). On a nested document nothing changes.Every piece of code added is marked with the tag and "removed with the switch (step 10)".
Changes
did2.document.classPrefixedRest(doc, path)(Static, Hidden): the path without its first segment when the document is flat (top-levelidanddocument_class, nobase, the shapeidOfreads as flat), the first segment (no[*]) is the document'sclass_nameor one of itssuperclasses(the header the document carries; no schema is read), and the document has no top-level field of that name; else''.did2.document/get: reads that path after the existingbase.idandbase.session_idaliases.setis unchanged (writes the literal path).did2.querywalkPath: the same, for a document (not ahasanyelementelement, which has nodocument_class), after thebase.idalias. Every operator reads throughwalkPath.did2.database.compileQuery('Flat'only, as the base.id alias is): a positive term whose first segment is a class some stored chain holds (PresentClasses; any first segment when not given) compiles to(path as written) OR (rest AND no base AND no field named <class> AND isa <class>); a negated one to1=1. Both are counted inexact, sosqlitedbrechecks with the evaluator; neither leads (canLead). The nested compile is unchanged.testBuildFlatLayoutReadBoth/testQueryReadsBaseIdOfAFlatDocumentasserted thatentity.local_identifierdoes NOT match a flat entity; that assertion is now the decided match (verifyTrue).Tests
testClassPrefixedFlatReads(struct documents, no schema): nested document unchanged (its block; stillmissingFieldwith no block, even with a top-level field of that name); flat read through the class and a superclass (entity.local_identifier,entity.type.node,base.name,statement.variable.name,value.external), inget,queryandresolvePath; a class not in the chain is not read (statement.local_identifier); ahasanyelementelement is not aliased; a top-level field named like a class (the kind cellterm) is read literally;setwrites the literal path;compileQueryflat vs nested vs not-a-present-class vsbase.id.testSqliteDbFlatLayout: nine class-prefixed queries added to the database-vs-evaluator agreement list, and a search test (demoA.valuefinds the flat demoA documents only, inexact).Not covered by the decision (reported, not built)
term.valueon the flat kind-cell schema. On the nested schematerm.valueis the term kind block'svaluecell. On the flat kind-cell schema (did-schema testBatchPassWiring: divergence rows for withMintSource and earliestByContent #469) that cell is the top-level fieldterm, and there is no top-levelvalue. The decision maps<class>.<field>to top-level<field>, i.e.term.value->value, which does not exist; and because the document has a top-level field namedterm,term.<x>is read literally inside the cell. Soget('term.value')still fails on a flat term statement. Mapping<kind>.valueto the kind cell would be a rename, not the decided read; it needs a decision (or the callers move todid2.schema.cache/valueCellIn).term,mass, ...;methodon an interaction) is read literally, never through the alias. This follows from "read-only, exactly as base.id" (the base.id alias applies only when there is nobase), but it is a choice; flagged.<class>.<field>reads the top-level<field>whatever class declares it (demoA.namereads base'sname): the read uses the document's chain, not the schema's per-class field lists.sqlitedb.searchValues/searchJson/jsonByIdpath lists read the paths literally (not get or query); not changed.Proposed (not decided)
did2.document.classPrefixedRest(Hidden).Runs (head ff38bb8)
did-schema
main(nested):testClassPrefixedFlatReadstests and the newtestSqliteDbFlatLayouttest pass);did.unittest709 of 709. Corpus jobs were skipped by the plan job.main; logs: "did-schema has no branch 'claude/class-prefixed-reads' -- FALLING BACK to main"): did2.build tests 47156257026, 439 run, 439 passed, 0 failed; Quick migrator tests 47156257024, 2926 run, 2877 passed, 0 failed, 49 incomplete. Fixture corpus and Codespell passed.Flat kind-cell schema (did-schema mirror branch
claude/class-prefixed-reads=claude/flat-readershead 8a944406; logs: "did-schema HAS branch 'claude/class-prefixed-reads' -- using it"). This branch is fromV2(a783e0e), not from #597, so the baseline is V2's own flat run (47128920249: 141 of 438):testBuildMatrix/testJsonRoundTripOfScalarAndNDimensionalMatrices,testBuildMatrix/testJsonRoundTripPreservesOrientation,testBuildNumericShape/testTheNewShapeSurvivesJson. (Flat-layout readers in +convert and +validate (ids, blocks, gap paths, kind cells) #597 alone: 130.)mainhas 175), and V2's code since Build #486 leftovers and V1-V4: carry-186 kind, mean+F1 sources, vmspike input sample interval #585 cites reasons that snapshot lacks (e.g. carry-195; 9 sites). No file this PR touches is in+convert. A flat quick count needs the mirror moved to a did-schema head whose register carries those rows.https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Generated by Claude Code