Skip to content

feat: add SF_SOURCE_TRACKING_ASSUME_SYNCED env var to skip local status scan#865

Open
WillieRuemmele wants to merge 5 commits into
mainfrom
wr/source-tracking-assume-synced
Open

feat: add SF_SOURCE_TRACKING_ASSUME_SYNCED env var to skip local status scan#865
WillieRuemmele wants to merge 5 commits into
mainfrom
wr/source-tracking-assume-synced

Conversation

@WillieRuemmele

@WillieRuemmele WillieRuemmele commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds SF_SOURCE_TRACKING_ASSUME_SYNCED environment variable that bypasses the expensive git.statusMatrix() call in ShadowRepo.getStatus()
  • When set, local source tracking assumes files already match the shadow repo (returns empty status), eliminating the 13–60 minute resync penalty caused by timestamp drift after org transplant (e.g., OrgFarm → developer machine)
  • Remote tracking (SourceMember reconciliation) is unaffected and still runs normally

Context

nCino's OrgFarm workflow pre-deploys source into pooled scratch orgs and seeds the shadow repo. When developers harvest an org, all file timestamps change, causing isomorphic-git to re-hash every file on the next tracking operation. For nForce (~70K files) this takes 13+ minutes; for LLC_BI (~250K files) it can exceed 30 minutes.

This env var lets nCino (and similar workflows) assert "I know local and shadow are in sync" and skip the full filesystem scan. The flag emits a warning log and telemetry event on first use for observability.

@W-23389121@

Test plan

  • Unit test verifies getStatus() returns [] without calling statusMatrix when env var is set
  • All 37 existing unit tests pass
  • Validated against DreamhouseLWC test project: tracking reset drops from 102ms to 1ms
  • nCino validates with LLC_BI-scale project (250K+ files)

…us scan

When set to true, getStatus() returns an empty array without calling
git.statusMatrix(). This eliminates the 13-30+ minute hang on first
CLI operation after transplanting source tracking between environments.

Designed for OrgFarm/CI scenarios where the shadow repo is already
seeded and local files are known to match. Remote SourceMember tracking
is unaffected and continues to detect org-side drift normally.
- Unit tests for noCache caching, downstream methods,
  commitChanges interaction, and recovery after unsetting
- NUT covering full lifecycle: baseline, env var suppresses
  changes, explicit deploy works, recovery after unset
- Fix: env var set after status populated now resets to empty
The xNuts-pdr CI job links source-tracking into
plugin-deploy-retrieve. Bumping SDR to 12.37.1 causes
duplicate type declarations with incompatible private fields.
Keeping @salesforce/core bump to 8.32.2 which is compatible.
The xNuts-pdr CI links source-tracking into PDR. When our
library resolves a different @salesforce/core than PDR,
TypeScript sees duplicate private fields on Org/SfProject.
Reverting to ^8.31.2 to match the version PDR expects.
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.

1 participant