You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sync): freeze SKIPPED/REJECTED suggestions in syncSuggestions (SITES-44646) (#2758)
## Summary
- **Root cause**: `syncSuggestions` had no guard for terminal-status
suggestions in its matched-suggestions loop. When a merge function
produced any difference in data (updated backlink counts, new metrics,
etc.), SKIPPED and REJECTED suggestions were still added to `toUpdate`
and saved via `saveMany` — bumping `updatedAt` on every scan.
- **PR #2593 was a partial fix**: its `deepEqual` guard prevents
spurious bumps only when data is *identical*. Any data delta still
triggered a save.
- **This fix**: return early for `SKIPPED` and `REJECTED` suggestions
before merge functions run. Their `updatedAt` must reflect the moment
the operator acted, not subsequent audit runs.
- **`FIXED` is intentionally excluded**: some audits (e.g.
`permissions/suggestion-data-mapper.js`) implement regression detection
by transitioning `FIXED → NEW` via a custom `mergeStatusFunction`. That
path must remain reachable.
## Changes
- [`src/utils/data-access.js`](src/utils/data-access.js): added
`FROZEN_STATUSES` early-return guard in the `matchedSuggestions.forEach`
loop of `syncSuggestions`
- [`test/utils/data-access.test.js`](test/utils/data-access.test.js):
corrected 3 existing REJECTED tests that were asserting the buggy
behavior (saveMany called on data change), added tests for SKIPPED
freeze and FIXED regression path
## Test plan
- [ ] `npx mocha test/utils/data-access.test.js` — 138 passing, 0
failing
- [ ] SKIPPED suggestion with changed data → not saved, `updatedAt`
unchanged
- [ ] REJECTED suggestion with changed data → not saved, `updatedAt`
unchanged
- [ ] FIXED suggestion with custom mergeStatusFunction → still
transitions to NEW (regression detection intact)
- [ ] NEW/PENDING_VALIDATION/OUTDATED suggestions still update normally
Fixes: [SITES-44646](https://jira.corp.adobe.com/browse/SITES-44646)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments