Skip to content

fix: single-file static resources include all resources in delta#1219

Merged
scolladon merged 4 commits intomainfrom
fix/static-resource-single-file-delta
Feb 20, 2026
Merged

fix: single-file static resources include all resources in delta#1219
scolladon merged 4 commits intomainfrom
fix/static-resource-single-file-delta

Conversation

@scolladon
Copy link
Copy Markdown
Owner

@scolladon scolladon commented Feb 20, 2026

Explain your changes

When a single static resource file is modified (e.g., staticresources/myFile.xlsx), the delta package incorrectly includes ALL static resources instead of just the modified one.

Root cause: MetadataElement.componentBasePath had inconsistent semantics — for folder resources it returned the component boundary (staticresources/MyLib), but for single-file resources it returned the type directory (staticresources). This caused InResourceHandler._collectResourceCopies() to scan too broadly and match every static resource.

Fix: Rename componentBasePath to componentPath with a fix that always returns the correct component boundary path. For single-file resources (pathAfterType.length == 1), it returns typeDirectoryPath/componentName instead of the raw anchor-based slice. For folder resources the behavior is unchanged.

Files changed:

  • src/utils/metadataElement.ts — rename getter, add branching logic for single-file case
  • src/service/inResourceHandler.ts — use renamed componentPath
  • __tests__/unit/lib/utils/metadataElement.test.ts — update assertions, add single-file coverage
  • __tests__/unit/lib/service/inResourceHandler.test.ts — fix meta path assertion, add isolation and deletion tests

Does this close any currently open issues?

  • Jest tests added to cover the fix.
  • NUT tests added to cover the fix.
  • E2E tests added to cover the fix.

Any particular element that can be tested locally

sf sgd source delta --to <commit-with-single-file-staticresource> --from <parent-commit> --output-dir ./dist

Verify that only the modified static resource appears in the output, not all static resources.

…ent boundary

componentBasePath had inconsistent semantics: for folder resources it
returned the component boundary (staticresources/MyLib), but for
single-file resources it returned the type directory (staticresources).

Rename to componentPath and fix the getter to always return the correct
component boundary by using typeDirectoryPath/componentName when
pathAfterType has only one segment.
…esource delta

Single-file static resources now produce a delta with only the modified
resource instead of all resources. Updates _getMetadataName() to use
the fixed componentPath property.

Adds tests verifying single-file resources are isolated in the delta,
readDirs scans the correct directory, and deletion checks the component
path.
@scolladon scolladon force-pushed the fix/static-resource-single-file-delta branch from 4b20ddb to 4a280b5 Compare February 20, 2026 15:31
slice, join, lastIndexOf are available on readonly string[] — the casts
to string[] were noise.
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d5cda86) to head (b4005bf).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1219   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           58        58           
  Lines         1542      1544    +2     
  Branches       194       195    +1     
=========================================
+ Hits          1542      1544    +2     

☔ 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.

@github-actions
Copy link
Copy Markdown

Published under dev-1219 npm channel.

$ sf plugins install sf-git-merge-driver@dev-1219

@scolladon scolladon merged commit 50c9dcf into main Feb 20, 2026
51 of 66 checks passed
@scolladon scolladon deleted the fix/static-resource-single-file-delta branch February 20, 2026 17:02
@github-actions
Copy link
Copy Markdown

Shipped in release v6.32.2.
Version v6.32.2 will be assigned to the latest npm channel soon
Install it using either v6.32.2 or the latest-rc npm channel

$ sf plugins install sfdx-git-delta@latest-rc
# Or
$ sf plugins install sfdx-git-delta@v6.32.2

💡 Enjoying sfdx-git-delta?
Your contribution helps us provide fast support 🚀 and high quality features 🔥
Become a sponsor 💙
Happy incremental deployment!

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.

1 participant