Skip to content

fix: prevent cross-process stale writes to maxRevision.json - #877

Open
WillieRuemmele wants to merge 1 commit into
mainfrom
wr/fix-concurrent-tracking-writes
Open

fix: prevent cross-process stale writes to maxRevision.json#877
WillieRuemmele wants to merge 1 commit into
mainfrom
wr/fix-concurrent-tracking-writes

Conversation

@WillieRuemmele

Copy link
Copy Markdown
Member

Summary

  • Before writing maxRevision.json, merge in-memory state with the current on-disk state
  • For each member present in both, take the higher lastRetrievedFromServer (never regress)
  • Also take the max serverMaxRevisionCounter

This prevents a long-lived process (e.g. VS Code Salesforce Extension) from overwriting correctly-synced values with its stale in-memory cache. The extension holds a cached RemoteSourceTrackingService singleton that was initialized on workspace open — when its background source-tracking check triggers a write, it would dump stale data back to disk, clobbering the CLI's correct writes.

Fixes forcedotcom/cli#3612

Test plan

  • Existing unit tests pass (111/111)
  • New unit tests cover: stale process can't regress values, null/undefined can't overwrite valid numbers, serverMaxRevisionCounter takes the max
  • Manual validation: open VS Code with SF extension, run sf project reset tracking + sf project deploy start from external terminal, confirm lastRetrievedFromServer is no longer nullified

Before writing the tracking file, merge in-memory state with the
current on-disk state. For each member present in both, take the
higher lastRetrievedFromServer value (never regress). Also take the
max serverMaxRevisionCounter.

This prevents a long-lived process (e.g. VS Code Salesforce Extension)
from overwriting correctly-synced values with its stale in-memory cache.

Fixes forcedotcom/cli#3612
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.

retrieve preview shows hundreds of unrelated false-positive diffs after editing AuraDefinition CSS via Setup UI / Developer Console

1 participant