Skip to content

feat(issue): replace individual archive flags with unified --until#898

Merged
BYK merged 4 commits intomainfrom
feat/issue-archive-until
May 1, 2026
Merged

feat(issue): replace individual archive flags with unified --until#898
BYK merged 4 commits intomainfrom
feat/issue-archive-until

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Apr 30, 2026

Summary

Replaces the 6 individual archive condition flags with a single --until flag that accepts a compact, intuitive grammar.

Before (6 flags)

sentry issue archive CLI-12Z --until-escalating
sentry issue archive CLI-12Z --duration 60
sentry issue archive CLI-12Z --count 100 --window 60
sentry issue archive CLI-12Z --users 10 --user-window 120

After (1 flag)

sentry issue archive CLI-12Z --until auto
sentry issue archive CLI-12Z --until 1h
sentry issue archive CLI-12Z --until 100x/1h
sentry issue archive CLI-12Z --until 10u/2h

Grammar

Input Meaning API mapping
auto / escalating Archive until spike archived_until_escalating
30m, 1h, 7d Duration ignoreDuration (in minutes)
2026-05-15 Absolute date computed ignoreDuration
10x / 10events Event count ignoreCount
10u / 10users User count ignoreUserCount
10x/5m Count within window ignoreCount + ignoreWindow
10users/2hours Verbose form same
(no flag) Archive forever archived_forever

Both terse (x, u, m, h, d) and verbose (events, users, minutes, hours, days) suffixes are supported.

Implementation

  • parseUntilSpec() exported for testability — parses raw string into discriminated union UntilSpec
  • specToApiOptions() converts to API parameters (substatus + statusDetails)
  • Reuses parseRelativeParts and UNIT_SECONDS from src/lib/time-range.ts (newly exported)
  • All helpers extracted to stay under Biome's cognitive complexity cap of 15

Tests

31 tests: 25 unit tests for parseUntilSpec covering all forms + edge cases (zero counts, negative counts, past dates, invalid formats, wrong slash order), plus 6 integration tests for the command func.

Replace --until-escalating, --duration, --count, --window, --users,
--user-window with a single --until flag that accepts a compact grammar:

  --until auto              Sentry's smart escalation detection
  --until 30m / 1h / 7d     Duration (reuses parsePeriod units)
  --until 2026-05-15        Absolute date (computed as delta)
  --until 10x               Event count threshold
  --until 10u               User count threshold
  --until 10x/5m            Count within time window
  --until 10events/2hours   Verbose form

Supports both terse (x/u/m/h/d) and verbose (events/users/minutes/hours)
suffixes. 'auto' and 'escalating' are both accepted as keywords.

Exports UNIT_SECONDS and parseRelativeParts from time-range.ts for reuse.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-898/

Built to branch gh-pages at 2026-04-30 23:58 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

Codecov Results 📊

6492 passed | Total: 6492 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +19
Passed Tests 📈 +19
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 89.55%. Project has 13304 uncovered lines.
✅ Project coverage is 75.98%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/commands/issue/archive.ts 89.45% ⚠️ 23 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    75.95%    75.98%    +0.03%
==========================================
  Files          295       295         —
  Lines        55246     55390      +144
  Branches         0         0         —
==========================================
+ Hits         41958     42086      +128
- Misses       13288     13304       +16
- Partials         0         0         —

Generated by Codecov Action

Comment thread src/commands/issue/archive.ts Outdated
BYK added 2 commits April 30, 2026 23:36
- Expand fullDescription with mode explanations, time format reference,
  compound condition syntax, and 9 commented examples
- Fix stale --duration 60 example in issue route map → --until auto
- Add full 'Archive and ignore issues' section to docs fragment with
  syntax reference table
- Skill reference auto-regenerated with all new examples
Bugbot correctly identified that the default branch masked TypeScript's
exhaustive discriminated-union checking. A new UntilSpec variant would
silently fall through to archived_forever instead of causing a compile
error. Now uses const _exhaustive: never = spec for compile-time safety.
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fc37c05. Configure here.

Comment thread src/commands/issue/archive.ts Outdated
Empty string from shell variable expansion (--until "$EMPTY_VAR") now
correctly hits the parser and errors instead of silently archiving forever.
@BYK BYK merged commit a026037 into main May 1, 2026
26 checks passed
@BYK BYK deleted the feat/issue-archive-until branch May 1, 2026 03:05
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