Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Aug 7, 2025

This updates the manifest validation to merge new reports after the initial validation. We run the validation logic in a loop to address any newly found issues, but previously, newly found errors or warnings were never actually surfaced: Only the reports found in the initial validation were used.

After this change, each report has an ID based on the name of the report, and for validators with multiple potential errors (e.g., unused exports/endowments), a different ID is used as well. This ensures we can merge reports without duplicating them (causing two shasum warnings for example).

Closes #3505.

jest.mock('fs');
jest.mock('../fs', () => ({
...jest.requireActual('../fs'),
useFileSystemCache:
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 just disables the file system cache. We mock network requests anyway, and doing this makes testing a bit easier.

Copy link
Member

Choose a reason for hiding this comment

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

What does this make easier?

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't figure out how to test the new invalid platform version warning showing up without changing this. It would always cache the correct version.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand how this changes that, the mock returns the platform version from getPlatformVersion anyways 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

The test replaces the fetch mock.

fetchMock.mockResponseOnce(MOCK_GITHUB_RESPONSE).mockResponseOnce(
  JSON.stringify({
    dependencies: {
      '@metamask/snaps-sdk': '1.0.0',
    },
  }),
);

Copy link
Member

Choose a reason for hiding this comment

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

Maybe try if clearing it out in resetFileSystem fixes it? Otherwise fine to merge as-is

Copy link
Member Author

Choose a reason for hiding this comment

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

The cache seems to be written to the real file system, or at least I can't find where it is in the virtual file system 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I would expect something like this:
await fs.rm('./node_modules/.cache/snaps', { recursive: true, force: true });

Does that not work?

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't, I'm not seeing the node_modules/.cache folder anywhere in the VFS

Copy link
Member

Choose a reason for hiding this comment

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

Strange 🤔

@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.28%. Comparing base (29b393e) to head (bdad04f).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3567   +/-   ##
=======================================
  Coverage   98.28%   98.28%           
=======================================
  Files         417      417           
  Lines       11764    11769    +5     
  Branches     1829     1830    +1     
=======================================
+ Hits        11562    11567    +5     
  Misses        202      202           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Mrtenz Mrtenz marked this pull request as ready for review August 7, 2025 13:53
@Mrtenz Mrtenz requested a review from a team as a code owner August 7, 2025 13:53
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@Mrtenz Mrtenz requested a review from FrederikBolding August 8, 2025 08:26
@Mrtenz Mrtenz enabled auto-merge August 8, 2025 08:32
@Mrtenz Mrtenz added this pull request to the merge queue Aug 8, 2025
Merged via the queue into main with commit 7d8c1e6 Aug 8, 2025
121 checks passed
@Mrtenz Mrtenz deleted the mrtenz/merge-validation-reports branch August 8, 2025 08:39
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.

Fix manifest issues during validation

3 participants