Add context around file adds/moves in BaselineCheckoutFailedError bails#1391
Add context around file adds/moves in BaselineCheckoutFailedError bails#1391codykaup wants to merge 8 commits into
BaselineCheckoutFailedError bails#1391Conversation
|
📦 Package Size: 7124 KB |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1391 +/- ##
==========================================
+ Coverage 81.86% 82.00% +0.14%
==========================================
Files 230 231 +1
Lines 4357 4391 +34
Branches 1251 1261 +10
==========================================
+ Hits 3567 3601 +34
Misses 678 678
Partials 112 112 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
34d2c4f to
2695c43
Compare
BaselineCheckoutFailedError bailsBaselineCheckoutFailedError bails
justin-thurman
left a comment
There was a problem hiding this comment.
I haven't reviewed this in exhaustive detail yet, but I wanted to surface a few thoughts. I think the --no-relative one is blocking though. I'll circle back and review more thoroughly after you respond and/or make changes.
| const pathspecArgument = pathspec ? ` -- "${pathspec}"` : ''; | ||
| const output = await execGitCommand( | ||
| deps, | ||
| `git diff --name-status --find-renames=20% ${baseCommit} ${headCommit}${pathspecArgument}` |
There was a problem hiding this comment.
getChangedFiles uses --no-relative in its git diff command. I think we need that here or running from a subdirectory would have bizarre behavior. Probably use --no-pager too, for consistency.
| category: 'classifyBaselineCheckoutFailure', | ||
| message: 'Error classifying baseline checkout failure', | ||
| data: { | ||
| error: err, |
There was a problem hiding this comment.
Any concern about serialization of the error here? Would String(err) or message + stack be better?
| // Determine how the file changed between the baseline and HEAD (such as if it was added, moved, | ||
| // renamed, etc). | ||
| const basename = path.basename(fileName); | ||
| const changes = await getChangedFilesWithStatus( |
There was a problem hiding this comment.
I think this will fail if we have a shallow clone because the git diff call inside getChangedFilesWithStatus will fail. We already have a commitExists function. Should we use that at the start of classifyBaselineCheckoutFailureTags to see if the commit doesn't exist, and if it doesn't, throw a new bail reason?
I know there's been talk around shallow clones lately, so they might be handled elsewhere, making this a moot point. But I can't recall for sure, so figured I'd raise it.
This PR adds additional tags to our Sentry exceptions to add more context to our
BaselineCheckoutFailedErrorerror in TurboSnap. To do that, we try to determine if a field was added or moved since the baseline because checking out either will fail earlier in the TurboSnap diff process. Ideally, we would use this information to follow the file around instead of bailing but we'll start with data collection first.I was using my sample monorepo project to test out each scenario. I'll attempt to describe how I QAed each below. It uses
NxwithYarn.Note
This addition does NOT get sent to the backend. It's merely adding Sentry details.
To force these exceptions to go to Sentry, I patched the CLI to enable it:
baselineManifestAddedI added a new package to my monorepo and commited it. Then ran a build with TurboSnap enabled (
--only-changed). Doing this, yielded the expected bail:Then in Sentry:

baselineManifestMovedFollowing baselineManifestAdded, I moved the
lambdapackage tolambda2then ran another build. Doing this, yielded the expected bail:Then in Sentry:

unknownBaselineCheckoutFailureFor this one, I forced the error by patching the CLI:
Then I built the CLI, added a new package in my monorepo, then ran another TurboSnap build. Then I got the following bail reason:
Then in Sentry:

📦 Published PR as canary version:
17.5.0--canary.1391.27305254386.0✨ Test out this PR locally via:
npm install chromatic@17.5.0--canary.1391.27305254386.0 # or yarn add chromatic@17.5.0--canary.1391.27305254386.0