-
Notifications
You must be signed in to change notification settings - Fork 7
Salesforce sync redesign #1714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mwvolo
wants to merge
34
commits into
main
Choose a base branch
from
salesforce-sync-redesign
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Salesforce sync redesign #1714
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
9cb2327
deps: promote restforce/activeforce as direct deps, remove openstax_s…
mwvolo efba7d8
deps: use openstax_active_force, not the unrelated activeforce gem
mwvolo 4f43b45
salesforce: remove stale openstax_salesforce references (replaced in …
mwvolo 2066d8b
salesforce: add Salesforce module + Configuration
mwvolo 055f781
salesforce: add Client (Restforce wrapper)
mwvolo 7d3f34d
salesforce: add Records::Base with ActiveForce client lazy-init
mwvolo 44fa7ec
salesforce: add Records (Lead, Contact, School)
mwvolo 73c274b
salesforce: add initializer + OpenStax inflection acronym
mwvolo 1f5ba8a
salesforce: repoint OpenStax::Salesforce::Remote::* to Salesforce::Re…
mwvolo ad5fe4d
salesforce: append new SecurityLog event types for sync redesign
mwvolo 6c3c767
salesforce: add Audit wrapper with stable event taxonomy
mwvolo 9e6579a
salesforce: add Settings fields + wrappers for sync, reconcile, alerts
mwvolo 16fbbd7
salesforce: add Metrics (counters + Sentry check-in + tagged alerts)
mwvolo 4956a43
salesforce: add Verify (lead/contact ownership + replacement checks)
mwvolo 5028307
salesforce: add Lookup waterfall (stored_id -> uuid -> email)
mwvolo d02df5a
salesforce: add ResolveFacultyStatus (signup + contact paths)
mwvolo 10dd0f0
salesforce: extract BuildLead (pure User -> Lead mapping)
mwvolo 83a32d7
salesforce: add UpsertLead orchestrator with persist retry
mwvolo b0b98e4
salesforce: Newflow::CreateOrUpdateSalesforceLead becomes a shim
mwvolo 92732a4
salesforce: add SyncContacts (cursor-driven, verify-before-swap)
mwvolo fe7b82e
salesforce: UpdateUserContactInfo becomes a shim
mwvolo 16161d9
salesforce: extract SyncSchools, keep UpdateSchoolSalesforceInfo shim
mwvolo 5d2b00e
salesforce: add salesforce_drift_findings table + index on users.sale…
mwvolo 6b16e2a
salesforce: SalesforceDriftFinding model + factory + spec
mwvolo 7c76385
salesforce: add Reconcile (3 passes + SF-orphan sweep + finalize)
mwvolo b3cba30
salesforce: schedule Reconcile daily, delete dead UpdateUserLeadInfo
mwvolo b7251bb
salesforce: /admin/salesforce_drift_findings (list + mark resolved)
mwvolo 96c16cd
salesforce: Salesforce timeline section on admin user edit page
mwvolo 7ef3cec
salesforce: spec helpers absorb gem helpers + add records-stub
mwvolo 6aed4ec
salesforce: fix CI regressions surfaced after Phase 8
mwvolo eb43c84
salesforce: ensure_school_or_fallback creates a stub local School whe…
mwvolo c086b37
salesforce: drop VCR cassettes for Salesforce-touching specs in favor…
mwvolo c2eb648
salesforce: bump SF API version to v66.0 (Spring '26), drop dead VCR …
mwvolo 6b72179
js: remove setTimeout race from NewflowUi.enableOnChecked
mwvolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/controllers/admin/salesforce_drift_findings_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| module Admin | ||
| class SalesforceDriftFindingsController < BaseController | ||
| def index | ||
| scope = SalesforceDriftFinding.open.includes(:user).order(last_seen_at: :desc) | ||
| scope = scope.where(category: params[:category]) if params[:category].present? | ||
| scope = scope.where(user_id: params[:user_id]) if params[:user_id].present? | ||
| @findings = scope.limit(500) | ||
| @categories = SalesforceDriftFinding.open.distinct.pluck(:category).sort | ||
| end | ||
|
|
||
| def update | ||
| finding = SalesforceDriftFinding.find(params[:id]) | ||
| finding.resolve! | ||
| redirect_to admin_salesforce_drift_findings_path, notice: 'Finding marked resolved.' | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| class SalesforceDriftFinding < ApplicationRecord | ||
| belongs_to :user, optional: true | ||
|
|
||
| validates :category, presence: true | ||
| validates :first_seen_at, presence: true | ||
| validates :last_seen_at, presence: true | ||
|
|
||
| scope :open, -> { where(resolved_at: nil) } | ||
| scope :resolved, -> { where.not(resolved_at: nil) } | ||
| scope :for_category, ->(c) { where(category: c) } | ||
|
|
||
| # Upsert an open finding: if a matching open finding already exists, bump | ||
| # its last_seen_at (and details, when provided); otherwise create one. | ||
| def self.upsert_finding!(category:, user: nil, record_type: nil, record_id: nil, details: {}) | ||
| existing = open.find_by( | ||
| user_id: user&.id, | ||
| category: category, | ||
| salesforce_record_type: record_type, | ||
| salesforce_record_id: record_id | ||
| ) | ||
|
|
||
| if existing | ||
| attrs = { last_seen_at: Time.current } | ||
| attrs[:details] = details if details.present? | ||
| existing.update!(attrs) | ||
| existing | ||
| else | ||
| create!( | ||
| user: user, | ||
| category: category, | ||
| salesforce_record_type: record_type, | ||
| salesforce_record_id: record_id, | ||
| details: details, | ||
| first_seen_at: Time.current, | ||
| last_seen_at: Time.current | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| def resolve! | ||
| update!(resolved_at: Time.current) | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.