Skip to content

[codex] Add agentic session analysis CLI#16

Merged
Friss merged 1 commit into
mainfrom
friss/agentic-cli-session-analysis
May 6, 2026
Merged

[codex] Add agentic session analysis CLI#16
Friss merged 1 commit into
mainfrom
friss/agentic-cli-session-analysis

Conversation

@Friss
Copy link
Copy Markdown
Owner

@Friss Friss commented May 6, 2026

Summary

  • add structured i3rs CLI commands for summary, channels, laps, extraction, stats, lap comparison, histograms, math, and JSON run specs
  • add core analysis primitives for windowing, stats, resampling, histograms, and lap-aligned comparisons
  • map Warning Source fallback labels and preserve native samples for enum/state channels in CLI extraction and app graph rendering
  • update install-skill to write both .agents and .claude skill paths and document the agent workflow

Notes

  • the large local S1 validation fixture is intentionally not included
  • tests that need that local fixture are marked ignored until a smaller checked-in fixture exists

Validation

  • cargo test -q

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request transforms the i3rs-cli into a robust telemetry analysis tool by adding subcommands for summaries, channel metadata, lap detection, and data extraction in JSON and CSV formats. It also introduces a shared analysis module in i3rs-core and enhances the GUI to preserve native samples for discrete channels. The reviewer identified several areas for improvement, primarily focusing on reducing code duplication across the new CLI commands and GUI downsampling logic, refactoring large functions to use serde for deserialization, and simplifying complex function signatures.

I am having trouble creating individual review comments. Click here to see my feedback.

crates/i3rs-cli/src/main.rs (1850-2026)

high

The handle_run function is very large and contains a lot of repetitive code for parsing operation parameters from the JSON spec. Each match arm manually extracts values from the serde_json::Value. This can be simplified significantly by using serde to deserialize each operation in the spec into a struct that mirrors the clap argument structs for each command. This would make the code more maintainable, less error-prone, and easier to extend.

crates/i3rs-app/src/panels/graph.rs (1403-1405)

medium

The logic to determine if native samples should be preserved is duplicated in a few places (here, and also at lines 1610-1612 and 1863-1864). To improve maintainability and reduce code duplication, consider extracting this logic into a helper function.

crates/i3rs-app/src/panels/graph.rs (168-181)

medium

This function accepts 12 arguments, which makes it difficult to read, use, and maintain. The #[allow(clippy::too_many_arguments)] annotation indicates this is a known issue. Consider grouping related parameters into a struct. For example, you could create a Transform struct for x_scale, x_offset, y_scale, y_offset and a Range struct for x_min, x_max.

crates/i3rs-app/src/panels/graph.rs (1906-2002)

medium

The downsampling logic for ChannelId::Physical and ChannelId::Math is very similar. The code blocks for handling should_background_downsample are nearly identical. This duplication can be avoided by refactoring the common logic into a helper function that takes the necessary parameters and returns the downsampled points. This would make the draw_channels function more concise and easier to maintain.

crates/i3rs-cli/src/main.rs (924-993)

medium

The logic in extract_csv_or_ndjson is very similar to the logic in extract_json. Both functions iterate over segments and channels, and have the same conditional logic for should_emit_native_samples. This duplication could be reduced by refactoring the core data extraction logic into a helper function or an iterator that both extract_json and extract_csv_or_ndjson can consume to format their respective outputs. This pattern of duplication also appears in stats_* and compare_laps_* functions.

crates/i3rs-cli/src/main.rs (2052-2071)

medium

The is_known_subcommand function uses a hardcoded list of subcommands. This is brittle and requires manual updates if subcommands are added, removed, or renamed. You can get the list of subcommands dynamically from clap using Cli::command().get_subcommands() to make this more robust.

@Friss Friss marked this pull request as ready for review May 6, 2026 15:23
@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

.find(|(_, lap)| lap.number == number || (lap.number + 1) == number);

P1 Badge Match numeric lap selectors to exact lap numbers

Update find_lap to stop treating lap.number + 1 as a numeric match, because this makes numeric selectors resolve to the wrong lap when an Out Lap is present. In datasets where laps are numbered as documented (0 = Out Lap, 1.. = timed laps), a selector like --lap 1 will match lap 0 first via (lap.number + 1) == number, so commands such as extract, stats, and math can analyze the wrong segment unless the user uses the full lap name.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Friss Friss force-pushed the friss/agentic-cli-session-analysis branch 2 times, most recently from 8bca333 to 3257ab9 Compare May 6, 2026 15:35
@Friss Friss force-pushed the friss/agentic-cli-session-analysis branch from 3257ab9 to 414df0d Compare May 6, 2026 15:42
@Friss Friss merged commit faf1f52 into main May 6, 2026
8 checks passed
@Friss Friss deleted the friss/agentic-cli-session-analysis branch May 6, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant