fix(record): keep mixed-unit sequences as text and refuse repeats into a unique member - #610
Merged
Merged
Conversation
Mixed quantity and plain-number sequences now record as text instead of losing a shared unit, and repeated values are rejected against existing unique members while remaining valid for nonunique ones. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ragment Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Element repeats are detected with runtime Set membership — an Integer and the equal Real are one value to a unique member — and a repeat in any run marks the member even when the shape merge settles over runs that did not repeat. Co-Authored-By: jason.han <hanhuijun@gmail.com>
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.
What and why
Two gaps in how a sequence-valued tool output fits a record definition, found after #580 landed:
classifySequencesettled a quantity element and a plain Integer element to oneRealmember throughnumericPair, so(300 [K], 301)recorded as(300, 301)with notempsUnitcompanion — the measured element lost its unit. A sequence carries one shared unit, so a mixed quantity/plain sequence has no faithful typed list literal: it now falls back to the String text spelling, as a sequence of mixed enumeration types already does.unique(the default) passedcheckExistingfor a sequence with repeated values, and the generated record then failed validation against that member.record.FeaturegainsUnique(read throughsemantics.IsUnique, which follows an inheritednonunique),classifySequencenotes a repeated element literal, andcheckExistingrefusesf.multi && f.repeated && decl.Uniquewith the usualintoremedy. Generated definitions areordered nonuniqueand keep admitting repeats.How it was verified
internal/exec/analysis/record/sequence_compat_test.go: quantity+Integer sequence records asScalarValues::Stringwith no unit companion; unique[0..*]existing member + repeated sequence → refusal naminginto;[0..*] ordered nonunique+ repeated → accepted and parses; unique member + non-repeating sequence → accepted.internal/frontend/repl/record_sequence_compat_test.go:recordAttributesreportsUniqueforReal[0..*], not fornonunique, and followsnonuniquethrough:>>.gofmt -l .,go build ./...,go vet,go test -count=1 ./internal/exec/analysis/record ./internal/frontend/repl ./cmd/sysml,scripts/changelog.py check.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelog