MWPW-206375: fix cascading publish/revert for new cards (PR #1039 regression) - #1207
MWPW-206375: fix cascading publish/revert for new cards (PR #1039 regression)#1207seanchoi0 wants to merge 7 commits into
Conversation
New cards (never published) had no CF version history, causing
recordSnapshot to fail and revert to show "No snapshot found".
- recordSnapshot: record versionId: null for cards with no prior version
- revertSnapshot: skip restoreVersion when versionId is null; unpublish instead
- hasValidPreRecordedSnapshot: accept null versionId ('versionId' in entry)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
SNOW Change Request Transaction ID [IO]: 0000019c1ef37582-20e0d556 |
5770f73 to
0ce8490
Compare
|
SNOW Change Request Transaction ID [STUDIO]: 0000019c1eec85a3-20bbe383 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1207 +/- ##
==========================================
- Coverage 90.71% 90.71% -0.01%
==========================================
Files 318 318
Lines 101712 101754 +42
==========================================
+ Hits 92271 92309 +38
- Misses 9441 9445 +4
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
PR #1039 introduced a regression in the hasValidPreRecordedSnapshot branch: createSnapshot was called without includeCards/includeVariations and expandedPaths was not captured, so only top-level fragments were published and revert only covered top-level items. - Pass includeCards/includeVariations to createSnapshot in both branches - Capture expandedPaths for cascaded publish paths - mergeCascadedEntries(): merge pre-recorded (green) entries with newly snapshotted cascaded fragments so revert covers all published items Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…CascadedEntries - formatSnapshotError(prefix, failures): eliminates duplicated CREATE_SNAPSHOT and SAVE_SNAPSHOT error string construction across both snapshot branches - mergeCascadedEntries: add early exit when primaryEntries is empty Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Axelcureno
left a comment
There was a problem hiding this comment.
One blocker: recordSnapshot can now emit versionId: null with wasPublished: true (your own test, snapshot.test.js:1025). Your comment says revert will "unpublish them instead", but wasPublished: true blocks that unpublish too, so revert does nothing, reports no failure, and Studio toasts success. Route it to the existing skipped channel?
Minor: worker.test.js:490 would pass pre-fix; it doesn't assert the merge.
Merge dedupe is load-bearing: deserializeEntries uses Object.fromEntries, so cascaded would otherwise win.
…ished versionId: null + wasPublished: true means the fragment was live before bulk publish but has no non-translation version to restore to. Silently returning success was misleading; route to the skipped channel instead. Also strengthens the pending-resume worker test to verify publishComplete is stripped from final snapshots. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Axelcureno
left a comment
There was a problem hiding this comment.
Blocker's addressed. Deleted the guard locally and the new test fails, so it's a genuine regression test; both merge tests fail pre-fix. 156 passing.
Two non-blocking follow-ups:
skippednever reaches the UI.revert-action.jsdrops it fromsnapshotsand returnsREVERTED, andbulk-publish-store.js:76only readsstatus, so Studio says "Reverted" while the card stays live.deserializeEntriestakescreatedAtfromparsed[0], so merged snapshots use the earlier timestamp. Check Modifications may flag every cascaded card.
Approving.
Resolves https://jira.corp.adobe.com/browse/MWPW-206375
Problems
Two regressions introduced by PR #1039, plus one additional edge case uncovered during review:
1. New cards — "No snapshot found" on revert / "Publish failed" on save
`recordSnapshot()` returned a failure for any fragment with no version history (new cards that were never published). This caused:
2. Cascading publish broken — cards & variations not published or reverted
In the `hasValidPreRecordedSnapshot` branch added by PR #1039:
3. Silent no-op revert for published fragments with no prior non-translation version
A fragment can be live (
wasPublished: true) but haveversionId: nullif all its CF versions were created by the translation system. In this case `revertSnapshot()` would skip both `restoreVersion` and `unpublishFragment` and return `null` (success), silently doing nothing.Fixes
Fix 1 — `snapshot.js`
`recordSnapshot()`: Record new cards with `versionId: null` instead of failing. Reverting will unpublish them (restoring pre-publish state) rather than trying to restore a non-existent version.
`revertSnapshot()`: Skip `restoreVersion` when `versionId` is `null`; still call `unpublishFragment` since `wasPublished: false`. For the edge case where `versionId: null` and `wasPublished: true` — return `{ skipped }` instead of silently succeeding.
`hasValidPreRecordedSnapshot()` (`bulk-publish-worker.js`): Accept `null` versionId by checking `'versionId' in parsed` instead of `parsed.versionId &&`.
Fix 2 — `bulk-publish-worker.js`
Both `hasValidPreRecordedSnapshot` and fallback branches:
Behavior