Activity: bindings for Kotlin #283
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. Needs #279 (and #278 for the outline records).
Goal
The activity command crosses into Kotlin: the report of #279, the range syntax and the configuration records of #278. Conversion only, no logic (
crates/streamd-ffi).Plan
project.activity(stream, key, range: String, excludeMixed: Boolean?, now, offset: UInt, limit: UInt) -> ActivityReport.rangeis the text syntax, so noRangeSpecrecord crosses back. NullexcludeMixedmeans the command's own setting. The report carries both Days tables, and a host toggles without calling again.records.rs):ActivityReport { range: ActivityRange { from, to, label, unit, canStepBack, canStepForward, previous: String?, next: String? }, shape: ActivityShape, series: List<ActivitySeries { name, color: String }>, days: List<ActivityDay { date, counts: List<UInt>, kind: DayKind (None, Single, Mixed, Future, Untracked), drawn: List<UInt> /* series indices to draw, 1 = single colour, 2 = halves, 3+ = wedges */, level: UByte }>, stats: ActivityStats, shards: ActivityShardPage { total, items: List<ActivityShard> }, shared: List<EntrySource> }.previous/nextare the stepped ranges as text, so the app needs no date arithmetic for the arrows.activityRange(text, today) -> ActivityRange(the parse and the resolved dates, for the sheet's field, throwingStreamdException.InvalidRangewith the wording of the core), andactivityQuickPicks(today) -> List<QuickPick { label, range }>.outline.rs:CommandSettings.Activitywith its series, both ways, plus the round trip test with an activity command added to the starter configuration.error.rs: the newCoreErrorvariants.tests/kotlin/StoreTest.kt: the sample month of #279 through aMemoryStore-like map store.Tests
Rust tests of the conversions (dates, the level, the drawn indices, paging), the outline round trip, the Kotlin test (
nix build .#checks.x86_64-linux.ffi-kotlin).Docs
R35 (what is bound), AGENTS.md (
records.rs,outline.rs).activitycommand type in .streamd.toml #278streamd <key> [RANGE]prints the chart and the Days table #280Implemented in #307.
Time: about 60 minutes (including the app build with its screenshot tests and
nix flake check).Tokens: about 260k for the session, most of it reading the facade, the bindings and the app.
Findings
can_step_back/can_step_forwardbut no stepped ranges. Rather than step the range inside the bindings (logic there), the facade got anActivityRange(days, label, the range as written, andprevious/next), used by the report and by a newresolve_activity_range(text, today). The bindings only turn the specs into text.activitytakes astoreas its first argument, like the other calls that read files: the summaries of the page of shards are read from it.excludeMixedonly overrides the flag of the report. The stats always carry both ways to count a mixed day, each with its percentages (fromStats::percent), so the app needs no arithmetic.DayKindis built from the core's status and classification.countsis empty on a day that is not tracked, as in the core.InvalidRangealready crossed.whens (CommandKind,CommandSettings). The app therefore got the minimum to compile: activity commands are listed in the configuration, their form shows the description only, and the "new command" menu leaves them out until #286.@Run @190000 Home again). The app already hides those withisMoment; #284 should do the same in its shard list.# @Run @Climbingplaces only one value. A shard that is "shared" between series needs overlapping queries, not two tags of the same dimension. The tests use that.FileTargetinrecords.rshad a line of code pasted into it.