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

[code-infra] Fix deploy #212

Merged
merged 10 commits into from
Oct 16, 2024
Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Oct 12, 2024

A quick fix for something that I noticed we regressed on from mui/material-ui#44075.

The problems:

  1. Broken deploy https://app.netlify.com/sites/mui-dashboard/overview
SCR-20241012-nvuu
  1. Broken app https://mui-dashboard.netlify.app/size-comparison?circleCIBuildNumber=759483&baseRef=master&baseCommit=a25a365a4c66738f358ecd745bf3727c0ca9d5b6&prNumber=44075
SCR-20241012-nwce

I have tried to do the least amount of work possible. My thought is that we are likely to use more Netlify and Toolpad Studio in tandem as we move forward, so we likely want both to work. We also need to have a fallback for Toolpad as bundle size tracker feels like a critical tool, so if Toolpad Studio go away, we would need this, and last, I wasn't clear on how far we migrated the tool to Toolpad, I was wonder if we were missing anything.

So far, the only miss I see to fully migrate from this custom <MaterialUI.Table> to Toolpad Studio is search support, it's painful without it.

After: https://deploy-preview-212--mui-dashboard.netlify.app/size-comparison?circleCIBuildNumber=759483&baseRef=master&baseCommit=a25a365a4c66738f358ecd745bf3727c0ca9d5b6&prNumber=44075

@oliviertassinari oliviertassinari added the core Infrastructure work going on behind the scenes label Oct 12, 2024
@oliviertassinari oliviertassinari added the regression A bug, but worse label Oct 12, 2024
@oliviertassinari oliviertassinari force-pushed the fix-contributor-dashboard-legacy branch 5 times, most recently from 12c87cf to 2706b80 Compare October 12, 2024 17:56
@oliviertassinari oliviertassinari added the scope: code-infra Specific to the core-infra product label Oct 12, 2024
@oliviertassinari oliviertassinari changed the title [core] Fix deploy [code-infra] Fix deploy Oct 12, 2024
@oliviertassinari oliviertassinari force-pushed the fix-contributor-dashboard-legacy branch 5 times, most recently from 2b38670 to c1f8eef Compare October 12, 2024 19:12
Comment on lines 1 to 7
.cache
/.git
/contributor-dashboard-legacy/
/tools-public/toolpad/.generated/
/tools-public/toolpad/**/*.yml
build
node_modules
pnpm-lock.yaml
Copy link
Member Author

Choose a reason for hiding this comment

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

Get to lint this a bit more.

{
files: ['contributor-dashboard-legacy/**'],
rules: {
'import/no-unresolved': 'off', // TODO, to fix at one point
Copy link
Member Author

Choose a reason for hiding this comment

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

This is because we are not using the pnpm workspace for contributor-dashboard-legacy.

One thing that I didn't try is to simply add contributor-dashboard-legacy in the pnpm workspace. Maybe one day in the future.

/.eslintcache
/coverage

# production
/build

src
Copy link
Member Author

Choose a reason for hiding this comment

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

That was crazy.

Comment on lines -1 to -2
/tools-public/toolpad/**/*.yml
/tools-public/toolpad/.generated/
Copy link
Member Author

Choose a reason for hiding this comment

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

Match mui-private

* @param {*} event
* @param {*} context
*/
exports.handler = async function circleCIArtefact(event) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Bypass CORS after CircleCI API change.

Copy link
Member

Choose a reason for hiding this comment

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

Do I understand correctly that to fill the table we're fetching from multiple functions and reconcile them client-side?
It feels somewhat wasteful to me, especially since some of the functions seem to do cache control and others don't. Isn't it more logical to fetch and reconcile data in a single netlify function, add cache control and serve it in a format that can easily be fed into a table?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree

Copy link
Member

Choose a reason for hiding this comment

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

🤔 Actually, we're already calculating the diff in the dangerfile. Would probably make more sense to just calculate the diff in CI, store it on file and push it to S3 and make it public. Then danger can just read the file and the UI/toolpad can fetch from S3. We wouldn't have to fetch and calculate in 3 places and we wouldn't have the problem with disappearing expired build artifacts neither.

Not for this PR though.

Comment on lines -33 to +34
"prettier": "^2.0.5",
"pretty-quick": "^3.1.3",
"prettier": "^3.3.3",
"pretty-quick": "^4.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

Sync with monorepo standard

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Oct 12, 2024
@Janpot
Copy link
Member

Janpot commented Oct 14, 2024

I have tried to do the least amount of work possible. My thought is that we are likely to use more Netlify and Toolpad Studio in tandem as we move forward, so we likely want both to work. We also need to have a fallback for Toolpad as bundle size tracker feels like a critical tool, so if Toolpad Studio go away, we would need this, and last, I wasn't clear on how far we migrated the tool to Toolpad, I was wonder if we were missing anything.

So far, the only miss I see to fully migrate from this custom <MaterialUI.Table> to Toolpad Studio is search support, it's painful without it.

I'd imagine over time we steer away from Studio for this use case. I feel like the only reason it's implemented in Toolpad is to serve as dog-fooding. But the people maintaining it are not really the target audience. I'd rather imagine us to migrate the existing code to the X data grid instead to reduce code size and improve UX.

I'm not sure i understand the search support comment. Couldn't you filter the datagrid? The old netlify version doesn't have search support, right?

@@ -62,7 +63,11 @@ const Ribbon = styled.a`

/* Set the text properties */
color: #fff;
font: 700 1em "Helvetica Neue", Helvetica, Arial, sans-serif;
font:
Copy link
Member

@Janpot Janpot Oct 14, 2024

Choose a reason for hiding this comment

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

interesting, tabs vs spacing everywhere. I would imagine prettier complaining about this

Copy link
Member Author

@oliviertassinari oliviertassinari Oct 14, 2024

Choose a reason for hiding this comment

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

Prettier made this change. I didn't know it had support for styled components, but looking at issues like prettier/prettier#2291, it looks like so.

Copy link
Member

Choose a reason for hiding this comment

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

Didn't mean this line specifically, not sure why I put the comment here. I'm just surprised to see tabs everywhere. Doesn't prettier indent with spaces by default?

Copy link
Member Author

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

I'd imagine over time we steer away from Studio for this use case. I feel like the only reason it's implemented in Toolpad is to serve as dog-fooding. But the people maintaining it are not really the target audience. I'd rather imagine us to migrate the existing code to the X data grid instead to reduce code size and improve UX.

@Janpot Ok, could be, I don't have specific views on this.

I'm not sure i understand the search support comment. Couldn't you filter the datagrid? The old netlify version doesn't have search support, right?

Sorted by UX experience:

@@ -62,7 +63,11 @@ const Ribbon = styled.a`

/* Set the text properties */
color: #fff;
font: 700 1em "Helvetica Neue", Helvetica, Arial, sans-serif;
font:
Copy link
Member Author

@oliviertassinari oliviertassinari Oct 14, 2024

Choose a reason for hiding this comment

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

Prettier made this change. I didn't know it had support for styled components, but looking at issues like prettier/prettier#2291, it looks like so.

Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

Bit hard to review with all the formatting changes, but I think I saw most of it. Few suggestions, no blockers.

@oliviertassinari oliviertassinari enabled auto-merge (squash) October 16, 2024 10:06
@oliviertassinari oliviertassinari merged commit 6188e51 into master Oct 16, 2024
5 checks passed
@oliviertassinari oliviertassinari deleted the fix-contributor-dashboard-legacy branch October 16, 2024 10:09
);
downloadURL.searchParams.set("url", artifact!.url);
downloadURL.searchParams.set("url", sizeSnapshotArtifact!.url);
Copy link
Member

Choose a reason for hiding this comment

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

Unless we want to shave off every byte possible from the bundle, I'd throw a nice error instead of the cryptic "Cannot read properties of undefined (reading 'url')".

Copy link
Member Author

@oliviertassinari oliviertassinari Oct 16, 2024

Choose a reason for hiding this comment

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

Agree, bundle size is a negligible concern for internal tools, developer speed is more important.

Now contributor-dashboard-legacy was written quick and dirty by Sebastian, optimizing for speed, like I did with https://mui.com/store/, and now, Vadym is cleaning that up progressively. I think we should be super lazy for internal tools, and only fix the stuff that we felt as painful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work core Infrastructure work going on behind the scenes regression A bug, but worse scope: code-infra Specific to the core-infra product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants