Skip to content

Conversation

@pasevin
Copy link
Collaborator

@pasevin pasevin commented Nov 27, 2025

Problem

The update-export-versions.cjs script was silently swallowing errors when snapshot updates failed. This caused:

  1. versions.ts to be updated to new version (e.g., 0.17.0)
  2. Snapshot update to fail (silently caught)
  3. versions.ts committed WITHOUT matching snapshots (which still have old version 0.16.0)
  4. Coverage tests fail because snapshots don't match actual output

This is why PR #244 (Version Packages) keeps failing - the snapshots have 0.16.0 while versions.ts has 0.17.0.

Solution

The script now exits with code 1 if snapshot update fails, preventing the mismatched state from being committed.

Root Cause Analysis

// BEFORE: Error was caught but not propagated
catch (error) {
  console.error('❌ Failed to update snapshots:', error.message);
  console.log('⚠️  Please run "..." manually');
  // Script continues and exits with code 0!
}

// AFTER: Error causes script to fail
catch (error) {
  console.error('❌ Failed to update snapshots:', error.message);
  console.error('⚠️  Snapshot update failed...');
  process.exit(1);  // Now fails properly
}

Test plan

  • Merge this fix
  • Rerun the update-versions workflow on changeset-release/main
  • Verify it either succeeds with matching snapshots OR fails clearly if there's an issue

@pasevin pasevin requested a review from a team as a code owner November 27, 2025 10:20
The script was silently swallowing errors when snapshot updates failed,
causing versions.ts to be committed without matching snapshots. This led
to CI failures in the coverage workflow.

Changes:
- Exit with code 1 if snapshot update fails
- Only update snapshots when versions actually changed (avoids requiring
  build for check-only workflows)
@pasevin pasevin force-pushed the fix/update-versions-script-error-handling branch from b971888 to 0241e45 Compare November 27, 2025 10:26
@pasevin pasevin merged commit 38935f9 into main Nov 27, 2025
11 checks passed
@pasevin pasevin deleted the fix/update-versions-script-error-handling branch November 27, 2025 10:31
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