Chromatic always does full snapshots on new branches
Open
Nobody has claimed this yet.
tech debt
upstream 🐟
- Dominant language
- TypeScript
- Stars
- 39
- Forks
- 14
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 13
Description
🧹 Tech Debt
In the following scenario:
- main is up to date.
- the latest commit on main is an
applying package updates [skip ci]type of commit- this commit does not have a storybook calculated for it
- this commit modifies package.json and package-lock.json
- create a branch with a new commit that does not modify package.json
- push the branch and the CI runs on the push, builds, and publishes to chromatic and you see the following example build log
Chromatic CLI v11.2.0
...
Retrieving git information
Found 12 changed files:
angular-workspace/projects/ni/nimble-angular/CHANGELOG.json
angular-workspace/projects/ni/nimble-angular/CHANGELOG.md
angular-workspace/projects/ni/nimble-angular/package.json
angular-workspace/tsconfig.json
change/@ni-nimble-components-26aadfad-c24c-4ad0-ae8e-e75769665e95.json
change/@ni-nimble-components-f36f5e68-2f6a-4e85-bb86-9fcf7ad37a8d.json
package-lock.json
packages/nimble-blazor/package.json
packages/nimble-components/CHANGELOG.json
packages/nimble-components/CHANGELOG.md
packages/nimble-components/package.json
packages/nimble-components/tsconfig.json
...
Could not retrieve dependency changes from lockfiles; checking package.json
⚠ TurboSnap disabled due to file change
Publishing your built Storybook
→ Calculating file hashes
Found a dependency change in angular-workspace/projects/ni/nimble-angular/package.json
A full build is required because this file cannot be linked to any specific stories.
...
We found 90 components with 290 stories.
So note that even though my change has no package.json changes, the latest commit from main does and causes all snapshots to be retaken. This only impacts the first commit to a branch.
Solutions
- We could try and figure out how to get a story published for the
applying package updates [skip ci]commits. We would have to actually run the CI and publish a storybook. It will still need to capture all snapshots unnecessarily because there is a package.json change which is a fake signal (the change is just bumping the versions of packages in the monorepo, no actual dependencies are changing)- I don't really think this is worth doing. I think it'll bee a bit of a wash. We will run an extra full storybook build for every commit to main but have one fewer in branches that are made.
- We could ask storybook for a way to have turbosnap ignore changes from certain commits (i.e. ones with the
[skip ci]tag). Files that change in those commits don't effect storybook results (at least for us).- I think this would be the preferred direction. We don't want snapshots to be made for these commits even if special files like package.json are modified.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the CI configuration and the package.json and package-lock.json changes used by Chromatic and TurboSnap. Reproduce the first-commit-on-a-new-branch scenario and determine how the applying package updates [skip ci] commit affects dependency detection. Done means that a branch change without package changes does not trigger full snapshots because of that prior commit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ci-cd, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100