Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9433: mod commit message modal #9520

Merged
merged 13 commits into from
Nov 15, 2024
Merged

#9433: mod commit message modal #9520

merged 13 commits into from
Nov 15, 2024

Conversation

twschiller
Copy link
Contributor

@twschiller twschiller commented Nov 13, 2024

What does this PR do?

  • Part of Mod Commit Messages #9433
  • Shows mod commit message modal on save:
    • If you haven't changed the version yet, it automatically bumps patch number
    • Otherwise, modal uses the version you changed in the mod metadata form
    • Message is now required on the front-end in the Page Editor, but not the backend
  • Refactoring
    • Extract semVerHelpers to own file. If needed, I can move that to a separate PR and stack
  • Playwright Updates
    • Had to update all the snapshots to account for version updates

Discussion

  • Providing a message is required in the front-end, but not the backend
  • @fungairino @mnholtz is an increase in the number of versions saved a problem (e.g., for test cleanup)?

Demo

https://www.loom.com/share/9112b6619b5e46d6b9094936928c248c?sid=a64aedf2-c9fe-4bc0-9f01-0b8f3b15aaa3

image

Remaining Work

Future Work

  • Migrate the Version History table to Paginated Table (cleanup in next slice): #9433: use PaginatedTable for Mod Version History #9527
  • See note on testIsSemVerString allowing pre-release and build metadata. 1.2.3-beta.1+321 passes the check. (Would be rejected server-side though)
  • Playwright run mode to update all snapshots. The tests with multiple snapshots are tedious to update

For more information on our expectations for the PR process, see the
code review principles doc

@twschiller twschiller added the blocked For denoting when an issue is blocked by an external dependency (ex. zendesk) label Nov 13, 2024
@twschiller twschiller self-assigned this Nov 13, 2024
@twschiller twschiller added the enhancement New feature or request label Nov 13, 2024
return false;
}

if (!isModEditable(editablePackages, sourceModDefinition)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to SaveModVersionModal

Copy link

github-actions bot commented Nov 13, 2024

Playwright test results

passed  153 passed
flaky  1 flaky
skipped  2 skipped

Details

report  Open report ↗︎
stats  156 tests across 51 suites
duration  11 minutes, 21 seconds
commit  2ee25b7
info  For more information on how to debug and view this report, see our readme

Flaky tests

chrome › tests/pageEditor/copyMod.spec.ts › run a copied mod with a built-in integration

Skipped tests

chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

error,
});
}
dispatch(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are enforcing a save version modal on all mod saves after the initial?

Copy link
Contributor Author

@twschiller twschiller Nov 13, 2024

Choose a reason for hiding this comment

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

Open for discussion, the PRD is still in brainstorming. Just wanted to get a head start on things: https://www.notion.so/pixiebrix/Create-View-mod-commit-messages-in-the-Page-Editor-13c43b21a25380bdaa16e086f6dcf626?pvs=4#13c43b21a253801eab9cd47c56934e97

An alternative would be to show it if the user has changed the version number, or if the server responds that the version needs to be bumped

Copy link
Contributor Author

@twschiller twschiller Nov 14, 2024

Choose a reason for hiding this comment

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

@@ -336,30 +335,3 @@ describe("useSaveMod", () => {
expect(notify.error).not.toHaveBeenCalled();
});
});

describe("isModEditable", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

New modal

@@ -124,59 +117,3 @@ export function validateRegistryId(id: string | undefined): RegistryId {

throw new Error("Invalid registry id");
}

Copy link
Contributor Author

@twschiller twschiller Nov 14, 2024

Choose a reason for hiding this comment

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

Extracted there to their own file to make them easier to find

describe("useSaveMod", () => {
function setupModDefinitionMocks(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to SaveModVersionModal test file

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 94.27083% with 11 lines in your changes missing coverage. Please review.

Project coverage is 75.81%. Comparing base (8318d74) to head (2ee25b7).
Report is 515 commits behind head on main.

Files with missing lines Patch % Lines
...tor/modListingPanel/modals/SaveModVersionModal.tsx 92.39% 7 Missing ⚠️
...owser-extension/src/pageEditor/hooks/useSaveMod.ts 88.00% 3 Missing ⚠️
...ditor/tabs/modVersionHistory/ModVersionHistory.tsx 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9520      +/-   ##
==========================================
+ Coverage   74.24%   75.81%   +1.57%     
==========================================
  Files        1332     1429      +97     
  Lines       40817    43147    +2330     
  Branches     7634     7935     +301     
==========================================
+ Hits        30306    32714    +2408     
+ Misses      10511    10433      -78     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@twschiller twschiller changed the title #9433: [WIP] mod commit message modal #9433: mod commit message modal Nov 14, 2024
@twschiller twschiller marked this pull request as ready for review November 14, 2024 21:22
@extension-e2e-test-unaffiliated/new-mod-00000000-0000-0000-0000-000000000000
name: New Mod
- version: 1.0.4
+ version: 1.0.5
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Additional lines are added to the diff as context around the actual change

@@ -264,14 +265,12 @@ export const appApi = createApi({
}),
updateModDefinition: builder.mutation<
PackageUpsertResponse,
{ packageId: UUID; modDefinition: UnsavedModDefinition }
{ packageId: UUID; modDefinition: UnsavedModDefinition; message?: string }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

RTK Query change

@@ -71,6 +71,31 @@ function useModPackageVersionsQuery(
}, [modId, editablePackage, packageVersionsQuery, editablePackagesQuery]);
}

const PackageVersionRow: React.VFC<{ version: PackageVersionDeprecated }> = ({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is replaced with PaginatedTable in the next PR: #9527

Copy link

When the PR is merged, the first loom link found on this PR will be posted to #sprint-demo on Slack. Do not edit this comment manually.

@twschiller twschiller enabled auto-merge (squash) November 15, 2024 15:41
@twschiller twschiller merged commit 84e7fe3 into main Nov 15, 2024
21 checks passed
@twschiller twschiller deleted the feature/9433-commit-modal branch November 15, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request page editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants