Skip to content

feat(models): add generic artifact generation to enable caching #1023

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

AndriiSiuta
Copy link
Collaborator

Closes #1021

@AndriiSiuta AndriiSiuta requested a review from BioPhoton July 7, 2025 09:23
@AndriiSiuta AndriiSiuta requested a review from matejchalk as a code owner July 7, 2025 09:23
@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🧩 models 🧩 coverage-plugin labels Jul 7, 2025
Copy link
Collaborator

@BioPhoton BioPhoton left a comment

Choose a reason for hiding this comment

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

I found couple of improvements and many unrelated changes. Please review your PRs changes with focus.

@AndriiSiuta AndriiSiuta changed the title Add generic artifact generation to enable caching to model feat(model): add generic artifact generation to enable caching Jul 7, 2025
@AndriiSiuta AndriiSiuta changed the title feat(model): add generic artifact generation to enable caching feat(models): add generic artifact generation to enable caching Jul 7, 2025
Copy link

github-actions bot commented Jul 7, 2025

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit c27a5c4 with previous commit 562c83b.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 46 🟡 53 ↑ +6.8
Documentation 🔴 23 🔴 23 ↑ +0.1
Code coverage 🟢 90 🟢 90 ↓ −0.1
Security 🟡 61 🟡 61
Updates 🟡 77 🟡 77
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟡 61 🟡 61
Type Safety 🟢 100 🟢 100
Bug prevention 🟢 100 🟢 100
Miscellaneous 🟢 100 🟢 100
Code style 🟢 100 🟢 100
👍 2 groups improved, 👎 1 group regressed, 👍 7 audits improved, 👎 2 audits regressed, 11 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 46 🟡 53 ↑ +6.8
JSDoc coverage Documentation coverage 🔴 23 🔴 23 ↑ +0.1
Code coverage Code coverage metrics 🟢 90 🟢 90 ↓ −0.1

18 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Speed Index 🟥 6.5 s 🟨 5.3 s ↓ −18 %
Lighthouse Largest Contentful Paint 🟨 4.0 s 🟨 3.5 s ↓ −10.8 %
Lighthouse Total Blocking Time 🟥 3,840 ms 🟥 2,110 ms ↓ −45 %
Lighthouse Time to Interactive 🟥 12.7 s 🟥 12.3 s ↓ −3.7 %
Lighthouse First Contentful Paint 🟥 3.2 s 🟥 3.2 s ↓ −1.4 %
JSDoc coverage Variables coverage 🟥 218 undocumented variables 🟥 219 undocumented variables ↑ +0.5 %
JSDoc coverage Types coverage 🟥 223 undocumented types 🟥 225 undocumented types ↑ +0.9 %
Code coverage Branch coverage 🟨 85.7 % 🟨 85.7 % ↓ −0.1 %
Code coverage Line coverage 🟨 86.5 % 🟨 86.6 % ↑ +0.1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 1,900 KiB 🟩 Total size was 1,918 KiB ↑ +0.9 %
Lighthouse Minimizes main-thread work 🟥 16.4 s 🟥 11.5 s ↓ −29.7 %
Lighthouse JavaScript execution time 🟥 6.5 s 🟥 5.1 s ↓ −22.2 %
Lighthouse Max Potential First Input Delay 🟥 2,140 ms 🟥 1,350 ms ↓ −37 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −3.7 %
Lighthouse Uses efficient cache policy on static assets 🟨 30 resources found 🟨 30 resources found ↑ +0.1 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 68 KiB 🟥 Potential savings of 69 KiB ↑ +82.4 %
Lighthouse Server Backend Latencies 🟩 160 ms 🟩 240 ms ↑ +47.1 %
Lighthouse Network Round Trip Times 🟩 10 ms 🟩 60 ms ↑ +290.6 %
Lighthouse Initial server response time was short 🟩 Root document took 450 ms 🟩 Root document took 450 ms ↓ −1.9 %
Lighthouse Avoids an excessive DOM size 🟥 2,248 elements 🟥 2,240 elements ↓ −0.4 %

585 other audits are unchanged.

vmasek
vmasek previously approved these changes Jul 7, 2025
Comment on lines 6 to 20
export const artifactGenerationCommand = z.object({
command: z.string({ description: 'Generate artefact files' }).min(1),
args: z
.array(z.string(), {
description: 'Arguments to be passed to the artefact generation command.',
})
.optional(),
});

export type ArtefactGenerationCommand = z.infer<
typeof artifactGenerationCommand
>;

export const pluginArtefactOptionsSchema = z.object({
generateArtefacts: artifactGenerationCommand.optional(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we're standardizing the configuration, maybe a good time to agree on what's a more user-friendly way to configure commands.

Currently, the user has to do something like { command: 'yarn', args: ['test', '--coverage'] }. But why not let them simply provide 'yarn test --coverage'? It's both less verbose and more intuitive, I think 🤔

We could also theoretically support a union of both object and string, but I think that would be unnecessarily complicated.

@BioPhoton @vmasek What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I remember thinking the same some time ago and I was up for supporting both especially so we don't introduce a breaking change (and maybe deprecating the object with args), but really I see no issue to having both

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fully agree

Copy link
Collaborator

Choose a reason for hiding this comment

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

@AndriiSiuta Could you please add support for string commands? As I understand it, the consensus is both of these should be valid:

  • {
      generateArtifactsCommand: 'yarn test --coverage',
      artifactsPath: 'coverage/lcov.info',
    }
  • {
      generateArtifactsCommand: {
        command: 'yarn',
        args: ['test', '--coverage'],
      },
      artifactsPath: 'coverage/lcov.info',
    }

The schema validation can be implemented with a z.union([...]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧩 models 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generic artifact generation to enable caching to model
4 participants