Repository navigation
checkRules: one_kind_cell (exactly one kind cell per statement, matching its kind) - #596
Merged
Merged
Conversation
[a quantity cell is named for its kind] (Jess Haley, 2026-12-02, did-schema docs/plans/did_v2_go_forward_class_audit.md): "exactly one kind cell per statement, matching its value-kind superclass (a rule)". Siblings first: the builder learns the rule before did-schema declares it (#469); it checks nothing until a class declares it. The name one_kind_cell is Proposed. A cell is a field named `value` or named for a value kind, at the top level of a flat document or directly in a block of a nested one. At most one, and that one the cell valueCellField names for the document's kind. An absent cell (value in bodies, or in a shared value document) is value_inline_or_body's question, not this rule's. checkRules takes the document as built (before ruleView renamed the cell to `value`) as a fifth argument. testBuildOneKindCell: on the loaded schema and, when it is nested, its flat kind-cell copy; each copied twice (a stand-in field named for another kind, with and without the rule declared on `value`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
| 'this document holds %d: %s.'], expected, named, numel(found), ... | ||
| strjoin(strcat('`', found, '`'), ', '))); | ||
| end | ||
| if numel(found) == 1 && ~strcmp(found{1}, expected) |
The first push failed every build with MATLAB:functionValidation:MismatchBetweenBlockAndLine (run 47131868427). 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 21:58
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. Siblings first for [a quantity cell is named for its kind] (did-schema #414):
did2.buildlearns the named rule "exactly one kind cell per statement, matching its value-kind superclass" before did-schema declares it (did-schema #469, step 8). It checks nothing until a class declares it, so no output changes on did-schemamain.Decision built
did-schema
docs/plans/did_v2_go_forward_class_audit.md, Decided by Jess Haley, 2026-12-02 [a quantity cell is named for its kind]: "... exactly one kind cell per statement, matching its value-kind superclass (a rule) ...". Amended 2026-12-03 by [external is declared on value, not in the kind cell] (the flag is beside the cell, so it is not a cell).Changes
+build/private/checkRules.mone_kind_cell. A cell is a field namedvalueor named for a value kind (a class descending fromvalue), at the top level of a flat document or directly in a block of a nested one. The document holds at most one, and that one is the cellcache.valueCellField(class, kind)names for its value kind (in that kind's block when nested). A cell embedded in another (a dose ingredient'smass) is part of that cell.checkRulestakes a fifth argument, the blocks as built, becauseruleViewrenames the cell tovaluefor the other rules+build/document.mcheckRules+build/Contents.mtests/+did2/+unittest/testBuildOneKindCell.m(new)flatLayoutSchema,'KindCells', true). Each is copied twice:voltagegains a stand-in field namedmass(another kind's name), and in one copyvaluealso declares the rule. Checked: its own cell alone builds; value in bodies with no cell builds; own cell plusmassis refused ("exactly one kind cell");massalone with the value in bodies is refused ("must match the value kind"); with the rule undeclared both build; a term assertion and aclock_alignment(kindpolynomialin its own chain) build. Denominator printedNo existing test is edited.
Needs a decision
one_kind_cellis Proposed (not decided). did-schema testBatchPassWiring: divergence rows for withMintSource and earliestByContent #469 must declare it under the name this PR checks; a different name is refused bydid2.build(did2:build:unknownRule).externaltrue) or in a shared value document (value_id) has no cell, since the builder omits absent fields. As built, the rule refuses a second cell or a cell of the wrong kind, and leaves "is the value anywhere" tovalue_inline_or_body. If "exactly one" should also mean "the cell key is always present" (blank when the value is elsewhere), that is a change to the builder's output and tovalue_inline_or_body.value(every value kind, and every statement through its kind). Declaring it onstatementinstead would leave shared value documents unchecked.Runs
MATLAB:functionValidation:MismatchBetweenBlockAndLine(the fifth argument was not in theargumentsblock; run 47131868427). Fixed in 787f5fc.main(5c06a136): did2.build tests 445 of 445 passed (run 47132709399, job 144346454344),testBuildOneKindCellmeasured 2 schemas (nested, cellvalue; the flat kind-cell copy, cellvoltage), 7 of 7 passed. Quick migrator tests passed (47132709425). Test code passed (47132709451; its corpus jobs were skipped by the plan step). Fixture corpus and Codespell passed.claude/flat-kind-cells, 8a944406), by dispatch:testBuildOneKindCellmeasured 1 schema (flat, cellvoltage), 7 of 7 passed (run 47134085281). The run fails overall with 141 of 445, the same 141 that V2 (062e9f5) fails against testBatchPassWiring: divergence rows for withMintSource and earliestByContent #469 (run 47128920249, 438 run): tests that readdoc.base.idor class blocks directly. They are listed in Flat-layout readers in +convert and +validate (ids, blocks, gap paths, kind cells) #597.https://claude.ai/code/session_01FxKLA8Tbf9cpvDe7fuVeKf
Generated by Claude Code