Activity: the activity command type in .streamd.toml #278
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #277 (read it first: the decisions and the spec
plan/README.mdare there). Needs nothing.Goal
type = "activity"becomes a command type of.streamd.toml(R28), read, validated, completed, outlined and changed like the others. Nothing is computed yet:streamd <key>of an activity command may fail withnot implemented yetuntil #279/#280.Plan
config/project/file.rs): anActivityCommandFileread as the table itstypenames, rejecting unknown fields.seriesis an array of tables{ name, color?, query }.queryis one table or a list of them throughone_or_many, exactly thePlacementthatexpectof a reminder takes. The key isquery, notexpect.commands/activity/config.rsin the core):ActivityCommand { description, intensity: Intensity, mixed: MixedMode, exclude_mixed, start: Option<NaiveDate>, series: Vec<Series> },Series { name, color: Rgb, query: Vec<query::Condition> }. ACommandDefinition::Activityarm. A series withoutcolortakes the next colour of a fixed default palette by its position in the config (#D97A2B,#2F5BEAfirst, they pass colour-blind separation; at least four more after them).validate.rs, a new rule in R28's list), every issue with its TOML path:coloris#RRGGBB;queryis defined (message and closest suggestion as rule 2); every value is reachable (rule 4), aliases resolve as in R29;intensity/mixedlist their variants on a wrong value.propagate = falserule: a shard is counted by its outermost match (decided in #277), so a sub-heading never counts twice.schema.rs,complete.rs): the fields with their documentation;queryoffers dimensions and values likeexpect;intensityandmixedoffer their variants. Add the value fields toindex.rstoo (rename of a tag/value reaches intoquery, as it does forexpect).rename_dimensioncovers the dimension names in aquery.outline.rs,change.rs):CommandSettingsgets the activity variant;apply_changewrites it, keeping comments, rewritingseriesas an array of tables when it changed. Round-trip test with a configuration holding the example above.frontend/views.rsgets an arm (a placeholder view sayingnot implemented yetis fine until #281);streamd initis unchanged.Tests
Parsing (one table vs list
query, defaults, unknown field), every validation rule with its path, completion atquery = { |, the outline/change round trip, rename of a value used in aquery.Docs
REQUIREMENTS: new R36: Activity Commands (configuration part; R28 lists the type and its validation rule), README (the example), AGENTS.md (
commands/activity/).Implemented in PR #287 (branch
278_activity-command-config, 4 commits: the feature, the index and renames, the CLI tests, the docs).Findings during the implementation
CommandKind/CommandSettingsinstreamd-ffiwould break about a dozen exhaustivewhens in the Android app (ConfigList.kt,ConfigDraft.kt,ConfigCommandForms.kt,App.kt, …). That is #283/#286 work. So in this story the bindings leave activity commands out ofProject.commands()and the outline (CommandSummary::of,CommandSettings::of→None), and the Kotlin surface is unchanged. #283 should replace these with real records and add thewhenarms in the app.intensity/mixedvalues are rejected by serde while the file is read (unknown variant `many`, expected `count` or `fixed`, with line and column), asroundingalready is, not byvalidate.rs. Every other rule is incheck_activity, with its TOML path.check_placements, asexpectis. It is reused unchanged: dimension defined (closest suggestion), notfile, value placed by some tag or file type, aliases resolved throughcanonical().series[].querytoConfigIndex::readwas enough forrename_tag(values that are a tag's name) andrename_dimensionto reach into queries. No change torename.rswas needed, only tests.locatepoints at the value of a key: an issue at...query[1].sprtpoints at"Swim", not at the keysprt. That is the existing behaviour forexpecttoo, so it was not changed.outline::command_namesnow counts a dimension in a query as named by the command, so a form cannot remove a dimension an activity still queries.#D97A2B,#2F5BEA,#2E9E6B,#C2408F,#8A6BD1,#B8A11F, starting again after the last. Only the first two come from the colour-blind-checked pair of the spec; the other four were picked by hand and could be checked before the app draws them (#284).ActivityView(not implemented yet), andstreamd <key>fails withstreamd <key> is not available: not implemented yet. #280 and #281 replace both.