Skip to content

Fix auto-upgrade telemetry reporting order#7670

Open
alfonso-noriega wants to merge 1 commit into
mainfrom
fix-auto-upgrade-telemetry-order
Open

Fix auto-upgrade telemetry reporting order#7670
alfonso-noriega wants to merge 1 commit into
mainfrom
fix-auto-upgrade-telemetry-order

Conversation

@alfonso-noriega
Copy link
Copy Markdown
Contributor

@alfonso-noriega alfonso-noriega commented May 29, 2026

WHY are these changes introduced?

Auto-upgrade result telemetry (env_auto_upgrade_success and skip reasons) was being added during the postrun auto-upgrade flow after the command analytics event had already been reported. That made the explicit auto-upgrade fields unreliable on the command event.

WHAT is this pull request doing?

  • Runs the postrun auto-upgrade flow before reporting the command analytics event, so auto-upgrade metadata is present in the payload.
  • Records the command end time before postrun auto-upgrade work starts, so reporting later does not inflate command duration metrics.
  • Adds coverage for the postrun ordering and recorded end-time behavior.

How to test your changes?

  • pnpm vitest run packages/cli-kit/src/public/node/hooks/postrun.test.ts packages/cli-kit/src/public/node/analytics.test.ts
  • pnpm nx build cli-kit

Post-release steps

None.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type and added a changeset with pnpm changeset add

@alfonso-noriega alfonso-noriega marked this pull request as ready for review May 29, 2026 14:32
@alfonso-noriega alfonso-noriega requested a review from a team as a code owner May 29, 2026 14:32
Copy link
Copy Markdown
Contributor Author

alfonso-noriega commented May 29, 2026

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

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 29, 2026
@alfonso-noriega alfonso-noriega force-pushed the fix-auto-upgrade-telemetry-order branch from 3e51c10 to 39cee41 Compare May 29, 2026 14:35
@github-actions
Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/metadata.d.ts
@@ -38,6 +38,7 @@ type CmdFieldsFromMonorail = PickByPrefix<MonorailEventPublic, 'cmd_all_'> & Pic
 declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
     commandStartOptions: {
         startTime: number;
+        endTime?: number;
         startCommand: string;
         startTopic?: string;
         startArgs: string[];
@@ -58,6 +59,7 @@ declare const coreData: RuntimeMetadataManager<CmdFieldsFromMonorail, {
 export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>, getAllSensitiveMetadata: () => Partial<{
     commandStartOptions: {
         startTime: number;
+        endTime?: number;
         startCommand: string;
         startTopic?: string;
         startArgs: string[];
@@ -77,6 +79,7 @@ export declare const getAllPublicMetadata: () => Partial<CmdFieldsFromMonorail>,
 }, "store_", never>>, addPublicMetadata: (getData: ProvideMetadata<CmdFieldsFromMonorail>, onError?: MetadataErrorHandling) => Promise<void>, addSensitiveMetadata: (getData: ProvideMetadata<{
     commandStartOptions: {
         startTime: number;
+        endTime?: number;
         startCommand: string;
         startTopic?: string;
         startArgs: string[];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant