Infer tendency type from keys when type is omitted#174
Open
DaanVanVugt wants to merge 2 commits into
Open
Conversation
When a tendency entry has no explicit `type`, infer it from its keys
instead of always defaulting to linear: `to` -> linear, `time` ->
piecewise, `value` -> constant. Anything else falls back to linear, so
a linear tendency does not require `to` (a from-only/rate-only/bare
segment is still linear and takes its endpoints from its neighbours).
A segment whose distinguishing key is absent must name its type
explicitly: the periodic shapes, smooth, and a value-less constant (a
bare {duration} is read as a linear ramp).
Documents the behaviour (yaml_format + tendencies) and tests the
inference, the linear-without-`to` forms, the value-less ambiguity, and
that an explicit type takes precedence.
SBlokhuizen
reviewed
Jun 25, 2026
SBlokhuizen
left a comment
Collaborator
There was a problem hiding this comment.
Looks good! I just have 2 minor comments about the documentation.
Contributor
Author
|
later prs introduce new tendencies, we should remember to include new auto-identification for these |
Point the type-inference refs at the per-tendency sections (added labels for constant/linear/smooth/periodic) instead of the page-top anchor, and drop the duplicated inference description in yaml_format in favour of the Available Tendencies page.
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.
When a tendency entry has no explicit
type, infer it from its keysinstead of always defaulting to linear:
to-> linear,time->piecewise,
value-> constant. Anything else falls back to linear, so a linear tendency does not requireto(a from-only/rate-only/bare segment is still linear and takes its endpoints from its neighbours).A segment whose distinguishing key is absent must name its type explicitly: the periodic shapes, smooth, and a value-less constant (a bare {duration} is read as a linear ramp).
Documents the behaviour (yaml_format + tendencies) and tests the inference, the linear-without-
toforms, the value-less ambiguity, and that an explicit type takes precedence.