fix: enhance error tracking and handling for Salesforce API interactions#1875
Open
paustint wants to merge 3 commits into
Open
fix: enhance error tracking and handling for Salesforce API interactions#1875paustint wants to merge 3 commits into
paustint wants to merge 3 commits into
Conversation
paustint
force-pushed
the
fix/error-tracker-fixes
branch
from
July 22, 2026 15:47
980d8aa to
a458d8b
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves resilience and signal quality for Salesforce API interactions across the UI, shared utilities, and the API server by adding clearer user-facing errors, more targeted retries, and better error-tracker fingerprinting/ignores.
Changes:
- Improve handling of common Salesforce failure modes (expired query locators, invalid sessions, Bulk API v1 auth failures) and adjust retry behavior for idempotent pagination/network errors.
- Reduce error-tracker noise and improve fingerprinting by passing real
Errorinstances and ignoring known non-actionable client/runtime errors. - Harden export and load flows (Excel cell truncation for .xlsx, CSV batch sizing to avoid Bulk API v1 request-size rejections), with added unit coverage for new batching logic and Bulk API v1 auth refresh.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| libs/ui/src/lib/file-download-modal/RecordDownloadModal.tsx | Shows more specific download error messaging (esp. .xlsx limits) and routes error text through getErrorMessage(). |
| libs/ui/src/lib/data-table/SalesforceRecordDataTable.tsx | Detects expired Salesforce query locators and guides the user to re-run the query instead of retrying load-more. |
| libs/shared/ui-utils/src/lib/shared-ui-utils.ts | Truncates oversized Excel cell values to ensure .xlsx generation succeeds under Excel’s per-cell limit. |
| libs/shared/ui-utils/src/lib/shared-ui-data-utils.ts | Hardens Tooling composite batching by throwing a clear error on empty/invalid responses. |
| libs/shared/ui-utils/src/lib/errorTracker.ts | Expands ignore lists to reduce known non-actionable error noise. |
| libs/shared/ui-db/src/lib/ui-db.ts | Wraps dexie-observable localStorage writes and adds a reopen-and-retry helper for DatabaseClosedError. |
| libs/shared/ui-db/src/lib/api-request-history.db.ts | Uses the reopen-and-retry helper to make history persistence more robust across Dexie connection closures. |
| libs/shared/data/src/lib/client-data-data-helper.ts | Retries idempotent pagination on network-level failures and improves “empty-body” and network error messaging. |
| libs/shared/constants/src/lib/shared-constants.ts | Adds a constant for Bulk API v1 invalid-session messaging. |
| libs/salesforce-api/src/lib/callout-adapter.ts | Treats Bulk API v1 “InvalidSessionId” (HTTP 400 XML) as an auth failure eligible for refresh-token retry. |
| libs/salesforce-api/src/lib/tests/callout-adapter.spec.ts | Adds unit coverage for Bulk API v1 InvalidSessionId refresh behavior. |
| libs/features/salesforce-api/src/SalesforceApi.tsx | Improves tracker event naming for API history persistence failures. |
| libs/features/manage-permissions/src/utils/permission-manager-table-utils.tsx | Adds optional chaining to avoid crashes when profile fields are missing. |
| libs/features/manage-permissions/src/usePermissionRecords.tsx | Corrects logging/tracking identifiers for clearer attribution. |
| libs/features/load-records/src/utils/load-records-process.ts | Adds size-capped Bulk API CSV batch generation to avoid Salesforce’s per-batch request-size limit. |
| libs/features/load-records/src/utils/tests/load-records-process.spec.ts | Adds unit coverage for size-capped CSV batch generation behavior. |
| libs/features/load-records/src/components/load-results/LoadRecordsBulkApiResults.tsx | Avoids reporting user-abort batch errors to the error tracker while keeping UI behavior intact. |
| libs/features/automation-control/src/useAutomationControlData.ts | Improves error tracker fingerprinting by passing an Error rather than a plain object for fetch failures. |
| apps/api/src/app/utils/response.handlers.ts | Treats “Invalid session id” as an auth/session failure in server error handling logic. |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
libs/shared/ui-utils/src/lib/errorTracker.ts:26
- This ignored substring is lowercase, but
shouldIgnore()uses a case-sensitivecandidate.includes(needle)check. Salesforce errors often surface asINVALID_QUERY_LOCATOR(upper snake case), so this may not actually suppress the intended noise.
// dexie-observable's unload-time localStorage write for users at storage quota — guarded in ui-db,
// but old bundles remain in the field.
'Dexie.Observable/deadnode',
// Expired/evicted Salesforce query cursor — the user must re-run their query; nothing to fix client-side.
'invalid query locator',
];
Improve error handling and tracking. based no errors in our error tracker
…bulk API data preparation
paustint
force-pushed
the
fix/error-tracker-fixes
branch
from
July 24, 2026 13:43
a458d8b to
58c6c2e
Compare
…uring field mapping save
|
|
||
| const SOAP_API_AUTH_ERROR_REGEX = /<faultcode>[a-zA-Z]+:INVALID_SESSION_ID<\/faultcode>/; | ||
| // Bulk API v1 reports session-auth failures as HTTP 400 with an XML body instead of a 401 | ||
| const BULK_XML_AUTH_ERROR_REGEX = /<exceptionCode>InvalidSessionId<\/exceptionCode>/; |
| const { endpoints, retry, retryDelay, methods, statusCodes } = RETRY_CONFIG; | ||
| // Network-level failures (no response at all — connection drop, proxy kill) are retryable for the | ||
| // same idempotent GET endpoints as 429/5xx responses; canceled requests are never retried. | ||
| const isRetryableNetworkError = !error.response && error.code !== 'ERR_CANCELED'; |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Improve error handling and tracking. based no errors in our error tracker