[eas-cli] Accept navigation metric aliases as positional args to observe:metrics#3973
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3973 +/- ##
==========================================
+ Coverage 59.33% 59.33% +0.01%
==========================================
Files 936 936
Lines 41172 41177 +5
Branches 8671 8675 +4
==========================================
+ Hits 24424 24429 +5
Misses 16654 16654
Partials 94 94 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…rve:metrics The observe:metrics command listed navigation metrics in the interactive metric picker (via METRIC_SHORT_NAMES) but its positional-arg validator was restricted to Object.keys(METRIC_ALIASES), so `eas observe:metrics nav_tti` and the other nav aliases were rejected by oclif before the resolver ever saw them. Widen the arg's `options` to include NAVIGATION_METRIC_ALIASES, extend resolveMetricName to resolve navigation short aliases (cold_ttr, warm_ttr, nav_tti) to their expo.navigation.* full names, and include both alias sets in the non-interactive-mode "available metrics" error message. resolveNavigationMetricName remains for observe:routes, which should not accept app-startup metric names. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6c61818 to
a109535
Compare
|
✅ Thank you for adding the changelog entry! |
| export const METRIC_ALIASES: Record<string, string> = { | ||
| tti: 'expo.app_startup.tti', | ||
| ttr: 'expo.app_startup.ttr', | ||
| cold_launch: 'expo.app_startup.cold_launch_time', | ||
| warm_launch: 'expo.app_startup.warm_launch_time', | ||
| bundle_load: 'expo.app_startup.bundle_load_time', | ||
| update_download: 'expo.updates.download_time', | ||
| }; | ||
|
|
||
| export const NAVIGATION_METRIC_ALIASES: Record<string, string> = { | ||
| cold_ttr: 'expo.navigation.cold_ttr', | ||
| warm_ttr: 'expo.navigation.warm_ttr', | ||
| nav_cold_ttr: 'expo.navigation.cold_ttr', | ||
| nav_warm_ttr: 'expo.navigation.warm_ttr', | ||
| nav_tti: 'expo.navigation.tti', | ||
| }; |
There was a problem hiding this comment.
Can we combine them into single METRIC_ALIASES?
Something like:
export const METRIC_ALIASES: Record<string, string> = {
...NAVIGATION_METRIC_ALIASES,
tti: 'expo.app_startup.tti',
ttr: 'expo.app_startup.ttr',
cold_launch: 'expo.app_startup.cold_launch_time',
warm_launch: 'expo.app_startup.warm_launch_time',
bundle_load: 'expo.app_startup.bundle_load_time',
update_download: 'expo.updates.download_time',
}Then you could remove
if (NAVIGATION_METRIC_ALIASES[input]) {
return NAVIGATION_METRIC_ALIASES[input];
}and
KNOWN_FULL_NAVIGATION_NAMES.has(input) ||| expect(() => resolveMetricName('bogus')).toThrow(/nav_tti/); | ||
| expect(() => resolveMetricName('bogus')).toThrow(/cold_launch/); |
There was a problem hiding this comment.
Can you modify this tests to be a bit more accurate?
Maybe even something like:
expect(() => resolveMetricName('bogus')).toMatchSnapshot();This would make it easy to update, yet verify that all the metrics are there
| description: 'Metric to query (e.g. tti, cold_launch, nav_tti)', | ||
| required: false, | ||
| options: Object.keys(METRIC_ALIASES), | ||
| options: [...Object.keys(METRIC_ALIASES), ...Object.keys(NAVIGATION_METRIC_ALIASES)], |
There was a problem hiding this comment.
This could be reverted if the metrics are spread in METRIC_ALIASES
| nav_cold_ttr: 'expo.navigation.cold_ttr', | ||
| nav_warm_ttr: 'expo.navigation.warm_ttr', |
There was a problem hiding this comment.
Should we display a warning if someone uses the old aliases? I'm not sure if we advertised this as stable or unstable (we can just remove the alias without a breaking change)

Why
When running
observe:metricsin non-interactive mode, navigation metric names could not be passed into the command; only app startup metrics were accepted.How
Test Plan