Skip to content

[eas-cli] Support drill-down from event lists in observe:session#3987

Draft
douglowder wants to merge 2 commits into
mainfrom
doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists
Draft

[eas-cli] Support drill-down from event lists in observe:session#3987
douglowder wants to merge 2 commits into
mainfrom
doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists

Conversation

@douglowder

@douglowder douglowder commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Why

When session ID is omitted and the observe:session command is running interactively, walk the user through picking an event whose session they want to inspect. Non-interactive without a session ID still errors as before.

The goal is to support a flow similar to that already available on our website, where a user can select an event from a displayed list, and navigate to the session timeline that contains that event.

How

Add new flags --event-name and --sort-order. If these are not provided, user will be prompted first to select from a list of event names (including custom events, if applicable), then select a sort order. The command also now takes the same time period flags as the other commands (--days, --start, --end).

Once the user has made the above selections, the user can choose from the list of events shown (up to 25), and the session for that event will be shown.

Test Plan

  • Tested manually with an SDK 57 project
  • New unit tests added

@linear-code

linear-code Bot commented Jul 7, 2026

Copy link
Copy Markdown

ENG-23604

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.02913% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 59.53%. Comparing base (f89e9dd) to head (759faab).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/observe/session.ts 98.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3987      +/-   ##
==========================================
+ Coverage   59.43%   59.53%   +0.10%     
==========================================
  Files         937      937              
  Lines       41286    41385      +99     
  Branches     8698     8732      +34     
==========================================
+ Hits        24536    24634      +98     
- Misses      16656    16657       +1     
  Partials       94       94              

☔ View full report in Codecov by Harness.
📢 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.

@douglowder douglowder force-pushed the doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists branch from 8c2e4bc to 554d347 Compare July 8, 2026 20:00
douglowder and others added 2 commits July 10, 2026 13:03
Make the sessionId positional arg optional. When it's omitted and the
command is running interactively, walk the user through picking an event
whose session they want to inspect. Non-interactive without a session ID
still errors as before.

New flags on observe:session:
- --event-name: metric alias/full-name or custom log event name. When it
  names a known metric (via isKnownMetricName from metricNames.ts) the
  picker queries fetchObserveEventsAsync; otherwise it queries
  fetchObserveCustomEventsAsync.
- --sort: reuses EventsOrderPreset (fastest/slowest/newest/oldest) from
  observe/fetchEvents.ts. If omitted in interactive mode the user is
  prompted; the choice list adapts to the event kind
  (fastest/slowest are metric-only).
- --days/--start/--end via ObserveTimeRangeFlags for the candidate window
  (default 60 days).

Interactive picker flow when no session ID is given:
1. Event-name prompt (skipped if --event-name is passed). Options merge
   METRIC_SHORT_NAMES with ObserveQuery.customEventNamesAsync results,
   labelled per kind and with per-name counts for log events.
2. Sort-order prompt (skipped if --sort is passed). Log events see only
   newest/oldest.
3. Candidate-event prompt over the first 25 events fetched with that
   sort/window. Candidates without a sessionId are filtered out. On
   selection, the sessionId feeds the existing single-session timeline.

Combining picker flags with a positional sessionId is now an explicit
error since they describe how to find a session, not how to display one.
The existing single-session path is unchanged.

Also adds isKnownMetricName to observe/metricNames.ts — a non-throwing
predicate over METRIC_ALIASES, NAVIGATION_METRIC_ALIASES, and their full
name sets, used by the picker to route to metric- vs log-event fetchers
without a try/catch around resolveMetricName.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@douglowder douglowder force-pushed the doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists branch from 554d347 to 432128c Compare July 10, 2026 20:03
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

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