Repository navigation
feat(scope): cross-session query correlation — PR D - #23
Merged
Merged
Conversation
Closes #16. Adds query.RunAcross(sessions, queryStr, start, end) ([]SessionResult, error) and query.UnionResults, so a query can run against every loaded session at once (e.g. every qualification match log from an event) instead of looping `query` manually per session. - RunAcross parses the query once (so a typo doesn't repeat N times) then executes the pipeline per session, capturing each session's own execution error (e.g. a field missing from that particular log) in its SessionResult rather than aborting the batch. - UnionResults flattens successful table/stats or ranges results into one session_id-tagged table; errored sessions are reported separately, not silently dropped. daemon: new POST /query-multi (registry.All()/Labels() added for the "run against every active session" and label-enrichment paths). New CLI verb `query-multi --sessions id1,id2,... | --all true [--union true]`. Booleans are spelled out (--all true) rather than bare (--all) since parseFlags always consumes the next token as a flag's value — this needed a flagBool helper rather than extending parseFlags itself. Verified end-to-end against a live daemon with two generated .wpilog fixtures (scaled 1x/2x): comparison mode returned correctly-scaled per-session stats with labels; union mode correctly found a brownout interval in only the session that actually had one, with the other contributing zero rows (not an error). Docs: query-multi added to `help` and skills/scope/SKILL.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Fourth (final) of the themed PRs building Tier-2 query features on the merged MVP (#19) + prior PRs (#20, #21, #22). Theme: correlating across multiple sessions, the most architecturally distinct piece — it fans out beyond a single EventTable.
Closes #16.
What it adds
query.RunAcross(sessions map[string]session.DataSession, queryStr string, start, end int64) ([]SessionResult, error):SessionResult, not raised — one bad log in a folder of match logs shouldn't blank out the rest.query.UnionResults(results) (rows, errored, error):session_id.errored— never silently dropped.Wiring
Registry.All()/Registry.Labels()(daemon/registry.go) — fan out to every active session, and annotate results with human-readable labels.POST /query-multi(daemon/handlers.go) — comparison mode (default, one entry per session) orunion=true(flattened table).query-multi "<query>" (--sessions id1,id2,... | --all true) [--union true].Note on
--all/--union: spelled out (--all true), not bare--all.parseFlags(cli/commands.go) always consumes the token after--flagas that flag's value, so a bare boolean flag would eat the next flag as its value. Added aflagBoolhelper rather than changingparseFlagsitself, to avoid touching behavior every other command relies on.Verified live, not just unit tests
Generated two
.wpilogfixtures (BatteryVoltage, one scaled 2x the other), ran a real daemon + CLI round trip:avg/mincame back exactly double session 1's — confirms per-session isolation, not cross-contamination.where BatteryVoltage < 7 | ranges: only the session with an actual brownout produced a row (correctly tagged with itssession_id); the other session correctly contributed zero rows rather than an error.Test plan
go build ./...,go vet ./..., gofmt clean,go test ./... -raceall passquerypackage: RunAcross per-session isolation (good session succeeds, bad session's own error surfaces), parse-error fail-fast, UnionResults tagging + error separationdaemonpackage: HandleQueryMulti missing-query/no-sessions/all-with-nothing-active/unknown-id error paths, comparison mode with labels, union modeThis is the last of the 4 planned PRs — closes out issues #12–#18.
🤖 Generated with Claude Code