Description
assetsStore.updateAssetTags dispatches removeAssetTags and addAssetTags as two separate network calls, then rolls the in-memory cache back if either rejects. When the remove succeeds server-side but the subsequent add fails, the rollback restores the cache to the original tags — but the server has already dropped the removed tag. The cache and backend diverge until the next refetch.
This is a strict subset of the optimistic-update gap; #8179 covered adding rollback logic in general, which has now landed (see #11672). The remaining gap is the partial-success case where rollback itself isn't sufficient because the server is no longer in the original state.
Repro
In src/stores/assetsStore.ts, updateAssetTags:
- User changes an asset's category from
loras → checkpoints.
removeAssetTags(['loras']) succeeds (HTTP 200).
addAssetTags(['checkpoints']) fails (HTTP 5xx / network drop).
- Cache rolls back to
['models', 'loras']. Server now has ['models'].
- Until the next refetch, the UI shows a tag the asset no longer has on the server.
Documented in the existing test rolls back the cache when removeAssetTags succeeds but addAssetTags rejects (src/stores/assetsStore.test.ts).
Possible fixes
- Compensating action: on add-failure after a successful remove, re-issue
addAssetTags with the originally-removed tags to restore the server state (best-effort).
- Force a refetch on partial failure so the cache reconciles with whatever the server actually has.
- Move to a single transactional endpoint that accepts the full new tag set and applies the diff atomically server-side.
Context
┆Issue is synchronized with this Notion page by Unito
Description
assetsStore.updateAssetTagsdispatchesremoveAssetTagsandaddAssetTagsas two separate network calls, then rolls the in-memory cache back if either rejects. When the remove succeeds server-side but the subsequent add fails, the rollback restores the cache to the original tags — but the server has already dropped the removed tag. The cache and backend diverge until the next refetch.This is a strict subset of the optimistic-update gap; #8179 covered adding rollback logic in general, which has now landed (see #11672). The remaining gap is the partial-success case where rollback itself isn't sufficient because the server is no longer in the original state.
Repro
In
src/stores/assetsStore.ts,updateAssetTags:loras→checkpoints.removeAssetTags(['loras'])succeeds (HTTP 200).addAssetTags(['checkpoints'])fails (HTTP 5xx / network drop).['models', 'loras']. Server now has['models'].Documented in the existing test
rolls back the cache when removeAssetTags succeeds but addAssetTags rejects(src/stores/assetsStore.test.ts).Possible fixes
addAssetTagswith the originally-removed tags to restore the server state (best-effort).Context
┆Issue is synchronized with this Notion page by Unito