Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Jan 14, 2026

This is a follow up to #3793, which introduces custom manifests (e.g., one for production, one for development), allowing a custom manifest to extend another manifest. Right now, the entire production manifest would need to be copied to the development manifest. After this change it's possible to do the following:

// snap.manifest.dev.json
{
  "extends": "./snap.manifest.json",
  "initialConnections": {
    "http://example.com": {}
  }
}

With a base manifest like:

// snap.manifest.json
{
  "proposedName": "My Snap",
  "other": "properties"
}

After which the manifests would be merged like this:

{
  "proposedName": "My Snap",
  "other": "properties",
  "initialConnections": {
    "http://example.com": {}
  }
}

Right now this is mainly useful for local development, but may be used for bundling production Snaps in the future.


Note

Introduces extendable Snap manifests and updates tooling to load, merge, validate, and watch them.

  • Adds extends support with deep-merge via new loadManifest, returning mergedManifest and involved files
  • Refactors validators to operate on mergedManifest and write fixes to the base manifest; adds types (ExtendableManifest, ExtendableSnapFiles)
  • Updates Webpack: SnapsWatchPlugin now takes manifestPath and watches files from loadManifest
  • Dev server now serves JSON from mergedManifest and computes allowed paths from it
  • Example snap.manifest.dev.json now extends base manifest; tests/snapshots adjusted accordingly

Written by Cursor Bugbot for commit 1a67620. This will update automatically on new commits. Configure here.

/**
* A utility type that makes all properties of a type optional, recursively.
*/
type DeepPartial<Type> = {
Copy link
Member

Choose a reason for hiding this comment

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

Do we not have this somewhere already?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just one that works on objects in snaps-cli's test utils. I couldn't find a general one.

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.34%. Comparing base (15a9666) to head (1a67620).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3802   +/-   ##
=======================================
  Coverage   98.33%   98.34%           
=======================================
  Files         422      422           
  Lines       12073    12125   +52     
  Branches     1875     1884    +9     
=======================================
+ Hits        11872    11924   +52     
  Misses        201      201           

☔ 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 January 16, 2026 13:33
@Mrtenz Mrtenz requested a review from a team as a code owner January 16, 2026 13:33
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.


return {
baseManifest,
extendedManifest: baseManifest,
Copy link

Choose a reason for hiding this comment

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

Incorrect assignment causes unnecessary manifest self-merge

Medium Severity

When a manifest has no extends field, extendedManifest is incorrectly set to baseManifest instead of undefined. This causes runFixes to call mergeManifests with the manifest against itself (since extendedManifest?.result returns a truthy value). The mergeManifests function's early-return check if (!extendedManifest) then fails, triggering an unnecessary deepmerge operation and creating a new object instead of preserving the original reference.

Fix in Cursor Fix in Web

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.

3 participants