Skip to content

Accept comma-separated strings#24

Merged
itssimon merged 2 commits intomainfrom
dev-109-accept-comma-separated-strings-for-fields-and-metrics
Apr 16, 2026
Merged

Accept comma-separated strings#24
itssimon merged 2 commits intomainfrom
dev-109-accept-comma-separated-strings-for-fields-and-metrics

Conversation

@itssimon
Copy link
Copy Markdown
Member

@itssimon itssimon commented Apr 16, 2026

Summary by cubic

Accept comma-separated strings for --metrics, --group-by, and --fields in the CLI in addition to JSON arrays. Addresses DEV-109 to make these flags easier to type while keeping JSON support.

  • New Features
    • Added parse_string_list to accept JSON arrays or comma-separated strings, trimming whitespace and ignoring empty entries; validates and errors on invalid bracketed input.
    • Integrated parsing for --metrics and --group-by in metrics, and --fields in request logs; updated help text.
    • Added tests for JSON input, CSV input, single values, whitespace, empty entries, and invalid bracketed input.

Written for commit 70ec6d2. Summary will update on new commits.

@itssimon itssimon self-assigned this Apr 16, 2026
@sentry
Copy link
Copy Markdown

sentry bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.20%. Comparing base (8910c7d) to head (70ec6d2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #24      +/-   ##
==========================================
+ Coverage   91.08%   91.20%   +0.11%     
==========================================
  Files          12       12              
  Lines        2031     2057      +26     
==========================================
+ Hits         1850     1876      +26     
  Misses        181      181              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic analysis

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/utils.rs">

<violation number="1" location="src/utils.rs:101">
P2: Trim leading whitespace before detecting JSON arrays; otherwise valid JSON-array input can be misparsed as CSV.

According to linked Linear issue DEV-109, JSON-array input should remain accepted while adding comma-separated support.</violation>
</file>

Linked issue analysis

Linked issue: DEV-109: Accept comma-separated strings for --fields and --metrics

Status Acceptance criteria Notes
Accept comma-separated strings for --metrics (also accept JSON arrays) Replaced serde_json::from_str with parse_string_list(metrics)
Accept comma-separated strings for --fields (also accept JSON arrays) Used parse_string_list for fields in request_logs.rs
Accept comma-separated strings for --group-by (also accept JSON arrays) group_by set via parse_string_list in src/metrics.rs
Add parse_string_list utility that parses either a JSON array or a CSV string Added parse_string_list implementation in utils.rs
Add unit tests covering parse_string_list for JSON, CSV, trimming, and errors Added test_parse_string_list with multiple assertions
Update CLI/help text to mention comma-separated lists for metrics/fields/group-by Help comments in main.rs updated to mention comma-separated lists
⚠️ Apply change to any argument that currently accepts a JSON array of strings (global requirement) Only metrics, group_by, and fields updated; other args not inspected
Preserve error handling for invalid JSON with input_err messages map_err still wraps errors with input_err and original message

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread src/utils.rs
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@itssimon itssimon merged commit dc25c5c into main Apr 16, 2026
6 checks passed
@itssimon itssimon deleted the dev-109-accept-comma-separated-strings-for-fields-and-metrics branch April 16, 2026 11:50
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