Skip to content

Conversation

@jamesmengo
Copy link
Contributor

@jamesmengo jamesmengo commented Jan 16, 2025

WHY are these changes introduced?

This will be used to access data + render an overlay when asset upload errors occur during the theme dev command

These errors can come from two places. The theme uploader, where we do the initial theme upload when we start the command (in the background) as well as changes made to your theme files while the development server is running.

Original attempt for context - link

WHAT is this pull request doing?

Introduces a new uploadErrors Map to track and persist file-specific upload errors in the theme file system. This enables:

  • Storage of upload errors at the file system level
  • Clearing of errors when files upload successfully
  • O(1) lookup to determine whether we have errors / should render an overlay

How to test your changes?

  1. No visual changes.
  2. You can run the tests in the test suite
  3. Run theme dev in the javascript debug terminal - place some breakpoints in theme-uploader and theme-fs

Measuring impact

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

jamesmengo commented Jan 16, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Jan 16, 2025

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75.23% 8871/11792
🟡 Branches 70.42% 4325/6142
🟡 Functions 75.03% 2323/3096
🟡 Lines
75.79% (+0.01% 🔼)
8387/11066
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app-event-watcher.ts
93.83% (-1.23% 🔻)
86.49% (-2.7% 🔻)
90.48% 98.61%

Test suite run success

2000 tests passing in 904 suites.

Report generated by 🧪jest coverage report action from 7e34195

@jamesmengo jamesmengo force-pushed the jm/store_asset_upload_failures branch from 550b4c6 to 6edd52f Compare January 16, 2025 20:25
@jamesmengo jamesmengo changed the title [Themes] Store theme asset upload errors in the themeFileSystem [Themes] Store and track theme asset upload errors Jan 16, 2025
@jamesmengo jamesmengo changed the title [Themes] Store and track theme asset upload errors [Themes] Store and track theme asset upload errors during theme dev Jan 16, 2025
@jamesmengo jamesmengo requested review from a team, frandiox, graygilmore and karreiro January 16, 2025 20:34
@jamesmengo jamesmengo marked this pull request as ready for review January 16, 2025 20:35
@jamesmengo jamesmengo requested a review from a team as a code owner January 16, 2025 20:35
@github-actions

This comment has been minimized.


export function mountThemeFileSystem(root: string, options?: ThemeFileSystemOptions): ThemeFileSystem {
const files = new Map<string, ThemeAsset>()
const uploadErrors = new Map<string, string[]>()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to add a changelog!

@jamesmengo jamesmengo force-pushed the jm/store_asset_upload_failures branch from 6edd52f to dd17d8a Compare January 16, 2025 23:31
Comment on lines 2 to 3
'@shopify/cli-kit': minor
'@shopify/theme': minor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch

Copy link
Contributor Author

@jamesmengo jamesmengo Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was waffling on this as well - I feel like it should it be a minor since this isn't a bugfix?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this repo went patch for all changes since it doesn't really follow semver but I can't find any documentation on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging off the current contents of .changeset it doesn't seems like to be a convention.

I see other similar changes with patch let's go with that for this PR.

I'll follow up with the foundations team to confirm

@jamesmengo jamesmengo added this pull request to the merge queue Jan 16, 2025
@jamesmengo jamesmengo removed this pull request from the merge queue due to a manual request Jan 16, 2025
@jamesmengo jamesmengo force-pushed the jm/store_asset_upload_failures branch from dd17d8a to 7e34195 Compare January 16, 2025 23:58
@github-actions
Copy link
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/themes/types.d.ts
@@ -92,6 +92,10 @@ export interface ThemeFileSystem extends VirtualFileSystem {
     applyIgnoreFilters: <T extends {
         key: string;
     }>(files: T[]) => T[];
+    /**
+     * Stores upload errors returned when uploading files via the Asset API
+     */
+    uploadErrors: Map<Key, string[]>;
 }
 /**
  * Represents a theme on the file system.

@jamesmengo jamesmengo added this pull request to the merge queue Jan 17, 2025
Merged via the queue into main with commit c1fce92 Jan 17, 2025
1 check passed
@jamesmengo jamesmengo deleted the jm/store_asset_upload_failures branch January 17, 2025 00:58
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