Skip to content

fix(core): release sync gate after Sync API failures#107

Merged
cs-raj merged 2 commits intomasterfrom
fix/DX-6146
Apr 16, 2026
Merged

fix(core): release sync gate after Sync API failures#107
cs-raj merged 2 commits intomasterfrom
fix/DX-6146

Conversation

@cs-raj
Copy link
Copy Markdown
Contributor

@cs-raj cs-raj commented Apr 16, 2026

fix(core): Sync resumes after Sync API timeout / failed get (DX-6146)

Summary

Fixes a condition where DataSync could stop processing new webhooks after a Sync API failure such as Request timeout: the internal sync gate (flag.SQ) was only cleared in some error paths, so later poke() / check() calls did not start sync() again.

Problem

  • Users saw Request timeout (or similar) during sync.
  • Subsequent notifications were accepted, but no new sync ran until process restart.
  • Root cause: flag.SQ stayed true when get() rejected in a way that did not match the previous netConnectivityIssues(error)-only cleanup.

Solution

  • fire(): On any rejection from the Sync API get(), set flag.SQ = false so the next notify can run sync() again (no longer conditional on netConnectivityIssues only). Removed the redundant flag.SQ clear tied solely to error 141 in that block (failure path now always releases the gate).
  • sync(): If getToken() throws after check() set SQ but before fire(), clear flag.SQ and rethrow.
  • unlock(): return check() so callers get the promise from check().
  • api.ts: Socket timeout rejects with code: 'ETIMEDOUT' in addition to the Request timeout message.
  • inet.ts: Expand netConnectivityIssues() (e.g. Request timeout substring, additional error.code values) for nested handlers that still key off it.

Tests

  • test/core/sync-resume.ts: Timeout on first get, second poke() triggers another get.
  • Updates to test/core/sync.ts, test/core/index.ts, test/api.ts, test/core/inet.ts as needed.
  • jest.setup.js + setupFilesAfterEnv to stabilize marked in Jest.

Version / deps

  • Version 2.4.0-beta.3; minor dev/deps bumps (marked, @types/lodash, etc.).

@cs-raj cs-raj requested a review from a team as a code owner April 16, 2026 10:13
@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

Comment thread src/api.ts Outdated
@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@cs-raj cs-raj merged commit 8fc47e3 into master Apr 16, 2026
9 checks passed
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.

3 participants