Skip to content

fix(bulk-operations): publish only to scoped targets - #354

Open
naman-contentstack wants to merge 1 commit into
developmentfrom
fix/DX-9484
Open

fix(bulk-operations): publish only to scoped targets#354
naman-contentstack wants to merge 1 commit into
developmentfrom
fix/DX-9484

Conversation

@naman-contentstack

@naman-contentstack naman-contentstack commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What

cm:stacks:bulk-assets published assets to environments and locales they were
never scoped to.

The bulk-publish API is a flat cross product — { items, environments, locales }
expands server-side into one record per (item × locale × environment). Per-item
targets were computed and then collapsed into batch-level arrays, so every item in
a batch inherited the union of that batch.

Fix

Batches are keyed on (locale, environment set), so the arrays sent equal the
batch's real scope.

Site Before After
--backup-dir assets envs/locales unioned across the whole backup, so a dev-only asset published to every environment in it each asset publishes to the targets it actually had
revert / retry every item took the first log entry's environments, unpublishing from environments it never reached each item keeps its own log entry's environments
payload builder fell back to items[0].publish_details for the whole batch union across all items

Multi-environment assets are unaffected: grouping is on the whole environment set,
so an asset in dev+prod still goes out in one request carrying both.

Entries keep entry.locale as the resolution hint while publish_details carries
the requested locale, so fallback-locale publishing still works.

Testing

  • 857 unit tests passing, 0 failing
  • new backup-dir-asset-fetcher.test.ts — the module had zero coverage; includes
    the regression case (a dev-only asset stays dev-only)
  • batch-helper.test.ts previously asserted mixed-locale flattening as correct;
    that expectation is inverted

Per-item environments/locales were collapsed into batch-level arrays,
so every item inherited the batch union: backup-dir assets published
to every environment found in the backup, and revert unpublished using
the first log entry's environments. Batches are now keyed on
(locale, environment set).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@naman-contentstack
naman-contentstack requested a review from a team as a code owner August 19, 2026 07:51
@snyk-io

snyk-io Bot commented Aug 19, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@naman-contentstack naman-contentstack self-assigned this Aug 19, 2026
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