Repository navigation
fix: attribute unitless node totals to the node - #17
Merged
Merged
Conversation
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.
Summary
Fixes
CONFIRMED-FINDINGS.mditem 1: a node scalartotalwithoutgraph.defaultUnitonly produced the graph-level "unitless amounts cannot be mixed" message, which blamed links for missing units.src/units.ts: tracks unitless links and unitless node totals separately. When named units are present, each scalar-total node gets its owninvalid-unitissue with thatnodeKeyand guidance to setgraph.defaultUnitor usetotalswith named units. The existing graph-level message is kept only for links with undefined input/output units.totalandtotalsare both present (leavingincompatible-totalsas the actionable issue), and guards non-string keys so unit resolution does not add aTypeErrorpath.tests/units.test.ts: covers node-scoped attribution, retained link guidance, both issues together,validateGraphparity, fully unitless graphs, multiple/destination nodes, duplicate keys,total+totals, and malformed keys.CHANGELOG.md: one[Unreleased] / Fixedentry.Verification
npm run format— passednpm run typecheck— passednpm run lint— passednpm test— 159 tests passednpm run build— passedReview
Adversarial review approved both commits. The reviewer independently checked a 35-combination matrix against
devand confirmed only the intended issue changes; malformed-key handling stays non-throwing throughvalidateGraph.Notes
Browser tests were not run to avoid the shared Playwright port. Validation-only change; no rendered-output change.