Skip to content

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

Merged
douglowder merged 6 commits into
mainfrom
doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists
Jul 17, 2026
Merged

[eas-cli] Support drill-down from event lists in observe:session#3987
douglowder merged 6 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.20635% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.66%. Comparing base (ac761ed) to head (d140563).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/observe/session.ts 98.53% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3987      +/-   ##
==========================================
+ Coverage   60.57%   60.66%   +0.10%     
==========================================
  Files         955      955              
  Lines       42073    42174     +101     
  Branches     8834     8867      +33     
==========================================
+ Hits        25480    25580     +100     
- Misses      16499    16500       +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 5 times, most recently from a1b6e80 to 360878d Compare July 14, 2026 20:03
@douglowder
douglowder requested review from jonsamp and kadikraman July 14, 2026 20:05
@douglowder
douglowder marked this pull request as ready for review July 14, 2026 20:05

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

Comment thread packages/eas-cli/src/observe/fetchSessions.ts Outdated
const { startTime, endTime } = resolveTimeRange(timeRangeFlags);

const eventNameChoice: EventNameChoice = eventNameFlag
? { name: eventNameFlag, isMetric: isKnownMetricName(eventNameFlag) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're likely going to have custom metrics down the line so you could track timings of custom values here in which case this would break since it assumes built-in metrics or nothing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we can be explicit here and ask for a metric or an event name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the right way to handle this is to extend the isKnownMetricName method to include custom metrics, once they are supported.

Comment thread packages/eas-cli/src/commands/observe/session.ts Outdated
douglowder and others added 6 commits July 15, 2026 13:44
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>
…ve commands

Observe commands read flags['non-interactive'] and flags.json directly,
so --json didn't imply non-interactive. Resolve both through
resolveNonInteractiveAndJsonFlags and use the results, matching the rest
of the CLI. --json now correctly implies non-interactive across observe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The nav aliases were renamed to nav_cold_ttr/nav_warm_ttr but the
isKnownMetricName test still asserted the old cold_ttr/warm_ttr names.
Update the test to the current alias names.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The customEventList query document omitted orderBy, so session log
candidates were sorted client-side by timestamp. Thread orderBy through
customEventListAsync and fetchObserveCustomEventsAsync, request TIMESTAMP
ASC/DESC in fetchSessionLogCandidatesAsync, and drop the client-side sort.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds orderBy to the AppObserveCustomEventList operation type; also picks
up unrelated schema additions present on the server since the last
regeneration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@douglowder
douglowder force-pushed the doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists branch from 7f9f4a4 to d140563 Compare July 15, 2026 20:45
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding the changelog entry!

@douglowder
douglowder requested a review from kadikraman July 15, 2026 20:46
@douglowder
douglowder merged commit f81efba into main Jul 17, 2026
11 checks passed
@douglowder
douglowder deleted the doug/eng-23604-eas-cli-observesession-supports-drill-down-from-event-lists branch July 17, 2026 12:39
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.

2 participants