Skip to content

Accept relative durations for datetime flags#23

Merged
itssimon merged 2 commits intomainfrom
dev-106-allow-human-relative-dates-eg-7-days-ago-as-values-for-since
Apr 16, 2026
Merged

Accept relative durations for datetime flags#23
itssimon merged 2 commits intomainfrom
dev-106-allow-human-relative-dates-eg-7-days-ago-as-values-for-since

Conversation

@itssimon
Copy link
Copy Markdown
Member

@itssimon itssimon commented Apr 16, 2026

Summary by cubic

Allow relative durations (e.g. 30m, 24h, 7d, 2w) for --since, --until, and --requests-since in the CLI. Implements DEV-106.

  • New Features

    • Supported on request-logs, metrics, and consumers; inputs like <digits><m|h|d|w> resolve to now - duration in UTC (RFC 3339). Parsing is done in the CLI; API behavior is unchanged.
    • Updated flag help and skills/apitally-cli/references/commands.md.
  • Bug Fixes

    • Apply relative duration parsing to consumers --requests-since and pass it correctly to the API.

Written for commit 213f325. 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

❌ Patch coverage is 88.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.08%. Comparing base (0d8b815) to head (76d525f).

Files with missing lines Patch % Lines
src/utils.rs 85.71% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
- Coverage   91.17%   91.08%   -0.10%     
==========================================
  Files          12       12              
  Lines        1984     2031      +47     
==========================================
+ Hits         1809     1850      +41     
- Misses        175      181       +6     

☔ 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 8 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:72">
P1: According to linked Linear issue DEV-106, `--since`/`--until` should accept human relative dates like `"7 days ago"`, but this parser only accepts compact forms like `7d` and leaves human-form input unchanged.</violation>
</file>

Linked issue analysis

Linked issue: DEV-106: Allow human relative dates (e.g. "7 days ago") as values for --since and --until

Status Acceptance criteria Notes
Accept compact relative durations (e.g., 30m, 24h, 7d, 2w) for --since and --until Added resolve_relative_datetime supporting m/h/d/w
Apply relative duration support to request-logs command (--since/--until) request_logs maps since/until through resolve_relative_datetime
Apply relative duration support to metrics command (--since/--until) metrics maps since/until through resolve_relative_datetime
Apply relative duration support to consumers command (--requests-since) consumers maps requests_since via resolve_relative_datetime
Parsing/resolution implemented in the CLI (client-side), not the API resolve_relative_datetime added in CLI utils and used before API calls
Preserve ISO 8601 input unchanged when not a relative duration Function returns original string when pattern not matched
Accept natural-language phrases like "7 days ago" (spaces/words) Only compact formats accepted; phrases not parsed
Update CLI help/docs to mention relative duration support Docs and arg help updated to show relative duration examples
Add unit tests for relative duration parsing Includes test_resolve_relative_datetime with checks

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
@itssimon itssimon merged commit 8910c7d into main Apr 16, 2026
1 check passed
@itssimon itssimon deleted the dev-106-allow-human-relative-dates-eg-7-days-ago-as-values-for-since branch April 16, 2026 08:43
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