Files
webstudio/packages
Oleg Isonen fc6b5f2fde fix: Retry bulk style deletions after conflicts (#6255)
Closes #6254

## Summary

- Mark `styles.deleteDeclarations` as safe to retry after a confirmed
version conflict.
- Recompute the deletion against refreshed style namespaces before the
retry.
- Add a regression covering 185 CSS custom-property declarations and the
complete conflict/refresh/retry path.
- Regenerate the public runtime operation contract.

## Root cause and behavior

`delete-styles` already accepts and plans a 185-declaration payload. The
failure occurs when the remote build changes between the session
snapshot and the commit: the session refreshes, but the operation
contract currently has `retryOnConflict: false`, so the atomic deletion
returns uncommitted and the project version does not advance.

Style declaration deletion is retry-safe because the operation is
recomputed from the refreshed snapshot and removes only exact
declaration keys that still exist.

The released CLI already writes structured success and failure JSON to
stdout; stderr contains lifecycle diagnostics. No stderr parsing change
is needed in Webstudio. The issue's stderr acceptance criterion was
LLM-authored without captured failure diagnostics in CLI 0.293.0.

## Tradeoffs and compatibility

- Retries only confirmed version conflicts.
- Ambiguous commit results are still not replayed.
- No schema, migration, or user-facing API shape changes.

## Checklist

- [x] Reproduce the 185-declaration CSS-variable deletion through the
CLI/MCP dry-run path.
- [x] Reproduce the unchanged-version failure with a conflicting commit.
- [x] Verify the regression fails before the contract change and passes
afterward.
- [x] Enable conflict retry for `styles.deleteDeclarations`.
- [x] Regenerate runtime operation contracts.
- [x] Review documentation impact; no documentation update is required
for this reliability fix.
- [x] Verify fixture impact; no fixture inputs or outputs are affected.

## Verification

- `pnpm --filter @webstudio-is/project-build test` — 2,132 tests passed.
- `pnpm --filter @webstudio-is/project-build typecheck` — passed.
- Targeted oxlint on changed source/tests — passed.
- `pnpm check:generated-api` — passed; generated files are clean.
- Agent evaluations were not run because they require separate explicit
approval.
2026-08-27 23:50:15 +02:00
..