From a299d6c750441565ae9499499433320c130bab9d Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 12:37:14 -0400 Subject: [PATCH 01/15] tests: attempt to fix flaky behavior in file state store --- packages/oauth/src/state-stores/file-state-store.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/file-state-store.ts b/packages/oauth/src/state-stores/file-state-store.ts index 7f4b260f7..7501db098 100644 --- a/packages/oauth/src/state-stores/file-state-store.ts +++ b/packages/oauth/src/state-stores/file-state-store.ts @@ -76,7 +76,7 @@ export class FileStateStore implements StateStore { private writeToFile(filename: string, data: StateObj): void { fs.mkdirSync(this.baseDir, { recursive: true }); const fullpath = path.resolve(`${this.baseDir}/${filename}`); - fs.writeFileSync(fullpath, JSON.stringify(data)); + fs.writeFileSync(fullpath, JSON.stringify(data), { flush: true }); } private readFile(filename: string): StateObj | undefined { From 5c88b25233e9c7e6491eb3e10c037f9070ff3fd1 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 14:39:21 -0400 Subject: [PATCH 02/15] tests: fix flaky tests caused by rapid file reading and writing --- .../src/state-stores/file-state-store.spec.ts | 34 +++++++++++++++++++ .../src/state-stores/file-state-store.ts | 12 ++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index 7f7edc4ef..3dd42fd73 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -1,6 +1,10 @@ +import fs from 'node:fs'; import os from 'node:os'; +import { assert, expect } from 'chai'; +import sinon from 'sinon'; import { FileStateStore } from './file-state-store'; +import type { StateStore } from './interface'; import { StateStoreChaiTestRunner } from './spec-utils'; const testRunner = new StateStoreChaiTestRunner({ @@ -9,3 +13,33 @@ const testRunner = new StateStoreChaiTestRunner({ }), }); testRunner.enableTests('FileStateStore'); + +describe('FileStateStore specifics', () => { + const stateStore: StateStore = new FileStateStore({ + baseDir: os.tmpdir(), + }); + const installUrlOptions = { scopes: ['channels:read'] }; + + it('should close all files after writing them', async () => { + const writeFileSyncStub = sinon.stub(fs, 'writeFileSync').throws(new Error('mock_write_error')); + + try { + await stateStore.generateStateParam(installUrlOptions, new Date()); + assert.fail('Exception should be thrown'); + // biome-ignore lint/suspicious/noExplicitAny: errors can be anything + } catch (e: any) { + assert.equal(e.message, 'mock_write_error'); + } + + assert(writeFileSyncStub.calledOnce, 'writeFileSync should be called once'); + const fd = writeFileSyncStub.getCall(0).args[0] as number; + + expect( + () => fs.fstatSync(fd), + 'The file must be closed, we expect fstatSync to throw an error when the file is closed', + ).to.throw('EBADF: bad file descriptor, fstat'); + + // Restore original function + writeFileSyncStub.restore(); + }); +}); diff --git a/packages/oauth/src/state-stores/file-state-store.ts b/packages/oauth/src/state-stores/file-state-store.ts index 7501db098..76ae21dc7 100644 --- a/packages/oauth/src/state-stores/file-state-store.ts +++ b/packages/oauth/src/state-stores/file-state-store.ts @@ -76,7 +76,17 @@ export class FileStateStore implements StateStore { private writeToFile(filename: string, data: StateObj): void { fs.mkdirSync(this.baseDir, { recursive: true }); const fullpath = path.resolve(`${this.baseDir}/${filename}`); - fs.writeFileSync(fullpath, JSON.stringify(data), { flush: true }); + // NOTE: Replace the following lines with `fs.writeFileSync(fd, JSON.stringify(data), { flush: true });` + // once `flush` is supported by the oldest Node.js version in this project. + // Reference: https://nodejs.org/api/fs.html#fswritefilesyncfile-data-options + // Current implementation achieves the same effect. + const fd = fs.openSync(fullpath, 'w'); + try { + fs.writeFileSync(fd, JSON.stringify(data)); + fs.fsyncSync(fd); + } finally { + fs.closeSync(fd); + } } private readFile(filename: string): StateObj | undefined { From 1142d77809c2eadddfd63f1c6d866a475d9e3b48 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 15:07:59 -0400 Subject: [PATCH 03/15] fix linting issue --- packages/oauth/src/state-stores/file-state-store.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/oauth/src/state-stores/file-state-store.ts b/packages/oauth/src/state-stores/file-state-store.ts index 76ae21dc7..bcb2a2a96 100644 --- a/packages/oauth/src/state-stores/file-state-store.ts +++ b/packages/oauth/src/state-stores/file-state-store.ts @@ -76,9 +76,9 @@ export class FileStateStore implements StateStore { private writeToFile(filename: string, data: StateObj): void { fs.mkdirSync(this.baseDir, { recursive: true }); const fullpath = path.resolve(`${this.baseDir}/${filename}`); - // NOTE: Replace the following lines with `fs.writeFileSync(fd, JSON.stringify(data), { flush: true });` - // once `flush` is supported by the oldest Node.js version in this project. - // Reference: https://nodejs.org/api/fs.html#fswritefilesyncfile-data-options + // NOTE: Replace the following lines with `fs.writeFileSync(fd, JSON.stringify(data), { flush: true });` + // once `flush` is supported by the oldest Node.js version in this project. + // Reference: https://nodejs.org/api/fs.html#fswritefilesyncfile-data-options // Current implementation achieves the same effect. const fd = fs.openSync(fullpath, 'w'); try { From eff35a102b561830c8c063d93133e3b71bf10388 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 15:12:26 -0400 Subject: [PATCH 04/15] trigger tests --- packages/oauth/src/state-stores/file-state-store.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index 3dd42fd73..6f4e26a30 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -39,7 +39,7 @@ describe('FileStateStore specifics', () => { 'The file must be closed, we expect fstatSync to throw an error when the file is closed', ).to.throw('EBADF: bad file descriptor, fstat'); - // Restore original function + // writeFileSyncStub.restore(); }); }); From cd34e8ad745d4433911dd5ebd0473800d2f2ae48 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 15:12:40 -0400 Subject: [PATCH 05/15] trigger tests --- packages/oauth/src/state-stores/file-state-store.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index 6f4e26a30..3dd42fd73 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -39,7 +39,7 @@ describe('FileStateStore specifics', () => { 'The file must be closed, we expect fstatSync to throw an error when the file is closed', ).to.throw('EBADF: bad file descriptor, fstat'); - // + // Restore original function writeFileSyncStub.restore(); }); }); From 2961e5f9dedfbc88e139111e41559880deed2f8f Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 15:58:16 -0400 Subject: [PATCH 06/15] try something else --- packages/oauth/src/state-stores/file-state-store.ts | 12 +----------- packages/oauth/src/state-stores/spec-utils.ts | 6 +++++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/packages/oauth/src/state-stores/file-state-store.ts b/packages/oauth/src/state-stores/file-state-store.ts index bcb2a2a96..7f4b260f7 100644 --- a/packages/oauth/src/state-stores/file-state-store.ts +++ b/packages/oauth/src/state-stores/file-state-store.ts @@ -76,17 +76,7 @@ export class FileStateStore implements StateStore { private writeToFile(filename: string, data: StateObj): void { fs.mkdirSync(this.baseDir, { recursive: true }); const fullpath = path.resolve(`${this.baseDir}/${filename}`); - // NOTE: Replace the following lines with `fs.writeFileSync(fd, JSON.stringify(data), { flush: true });` - // once `flush` is supported by the oldest Node.js version in this project. - // Reference: https://nodejs.org/api/fs.html#fswritefilesyncfile-data-options - // Current implementation achieves the same effect. - const fd = fs.openSync(fullpath, 'w'); - try { - fs.writeFileSync(fd, JSON.stringify(data)); - fs.fsyncSync(fd); - } finally { - fs.closeSync(fd); - } + fs.writeFileSync(fullpath, JSON.stringify(data)); } private readFile(filename: string): StateObj | undefined { diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index cc77bd412..c72073532 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -58,6 +58,10 @@ export class StateStoreChaiTestRunner { await stateStore.generateStateParam(installUrlOptions, new Date()); } const state = await stateStore.generateStateParam(installUrlOptions, new Date()); + + // NOTE: wait 1 second to make sure IO operations completed + await new Promise((resolve, _) => setTimeout(resolve, 1000)); + const result = await stateStore.verifyStateParam(new Date(), state); assert.exists(result); let expectedlyReturnedResult: InstallURLOptions = { scopes: [] }; @@ -68,7 +72,7 @@ export class StateStoreChaiTestRunner { } catch (e: any) { assert.equal(e.code, 'slack_oauth_invalid_state', `${state} ${JSON.stringify(expectedlyReturnedResult)}`); } - }).timeout(4000); // https://github.com/slackapi/node-slack-sdk/issues/2159#issuecomment-2749367820 + }).timeout(10000); // https://github.com/slackapi/node-slack-sdk/issues/2159#issuecomment-2749367820 } }); } From 3a9024985e0598f5f5854961d1ba0f88301fa462 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 16:00:30 -0400 Subject: [PATCH 07/15] fix lint --- packages/oauth/src/state-stores/spec-utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index c72073532..ae0bac95b 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -58,10 +58,10 @@ export class StateStoreChaiTestRunner { await stateStore.generateStateParam(installUrlOptions, new Date()); } const state = await stateStore.generateStateParam(installUrlOptions, new Date()); - + // NOTE: wait 1 second to make sure IO operations completed await new Promise((resolve, _) => setTimeout(resolve, 1000)); - + const result = await stateStore.verifyStateParam(new Date(), state); assert.exists(result); let expectedlyReturnedResult: InstallURLOptions = { scopes: [] }; From 88518c28a529ad9b5f0594ab95018ceaff9c3708 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 16:02:48 -0400 Subject: [PATCH 08/15] comment out unit test --- .../src/state-stores/file-state-store.spec.ts | 58 +++++++++---------- packages/oauth/src/state-stores/spec-utils.ts | 2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index 3dd42fd73..680393dff 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -14,32 +14,32 @@ const testRunner = new StateStoreChaiTestRunner({ }); testRunner.enableTests('FileStateStore'); -describe('FileStateStore specifics', () => { - const stateStore: StateStore = new FileStateStore({ - baseDir: os.tmpdir(), - }); - const installUrlOptions = { scopes: ['channels:read'] }; - - it('should close all files after writing them', async () => { - const writeFileSyncStub = sinon.stub(fs, 'writeFileSync').throws(new Error('mock_write_error')); - - try { - await stateStore.generateStateParam(installUrlOptions, new Date()); - assert.fail('Exception should be thrown'); - // biome-ignore lint/suspicious/noExplicitAny: errors can be anything - } catch (e: any) { - assert.equal(e.message, 'mock_write_error'); - } - - assert(writeFileSyncStub.calledOnce, 'writeFileSync should be called once'); - const fd = writeFileSyncStub.getCall(0).args[0] as number; - - expect( - () => fs.fstatSync(fd), - 'The file must be closed, we expect fstatSync to throw an error when the file is closed', - ).to.throw('EBADF: bad file descriptor, fstat'); - - // Restore original function - writeFileSyncStub.restore(); - }); -}); +// describe('FileStateStore specifics', () => { +// const stateStore: StateStore = new FileStateStore({ +// baseDir: os.tmpdir(), +// }); +// const installUrlOptions = { scopes: ['channels:read'] }; + +// it('should close all files after writing them', async () => { +// const writeFileSyncStub = sinon.stub(fs, 'writeFileSync').throws(new Error('mock_write_error')); + +// try { +// await stateStore.generateStateParam(installUrlOptions, new Date()); +// assert.fail('Exception should be thrown'); +// // biome-ignore lint/suspicious/noExplicitAny: errors can be anything +// } catch (e: any) { +// assert.equal(e.message, 'mock_write_error'); +// } + +// assert(writeFileSyncStub.calledOnce, 'writeFileSync should be called once'); +// const fd = writeFileSyncStub.getCall(0).args[0] as number; + +// expect( +// () => fs.fstatSync(fd), +// 'The file must be closed, we expect fstatSync to throw an error when the file is closed', +// ).to.throw('EBADF: bad file descriptor, fstat'); + +// // Restore original function +// writeFileSyncStub.restore(); +// }); +// }); diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index ae0bac95b..585f21e5b 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -72,7 +72,7 @@ export class StateStoreChaiTestRunner { } catch (e: any) { assert.equal(e.code, 'slack_oauth_invalid_state', `${state} ${JSON.stringify(expectedlyReturnedResult)}`); } - }).timeout(10000); // https://github.com/slackapi/node-slack-sdk/issues/2159#issuecomment-2749367820 + }).timeout(5000); // https://github.com/slackapi/node-slack-sdk/issues/2159#issuecomment-2749367820 } }); } From 51ee243d8a88a8fe11d359c1881857d62188f82a Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 16:05:03 -0400 Subject: [PATCH 09/15] comment some suff --- packages/oauth/src/state-stores/file-state-store.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index 680393dff..b841c88c5 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -1,7 +1,7 @@ -import fs from 'node:fs'; +// import fs from 'node:fs'; import os from 'node:os'; -import { assert, expect } from 'chai'; -import sinon from 'sinon'; +// import { assert, expect } from 'chai'; +// import sinon from 'sinon'; import { FileStateStore } from './file-state-store'; import type { StateStore } from './interface'; From 02c4a732ace5249a5bd90eab34d5e866239b631a Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 16:06:58 -0400 Subject: [PATCH 10/15] Update file-state-store.spec.ts --- packages/oauth/src/state-stores/file-state-store.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index b841c88c5..d3162cae8 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -4,7 +4,7 @@ import os from 'node:os'; // import sinon from 'sinon'; import { FileStateStore } from './file-state-store'; -import type { StateStore } from './interface'; +// import type { StateStore } from './interface'; import { StateStoreChaiTestRunner } from './spec-utils'; const testRunner = new StateStoreChaiTestRunner({ From 9174abba92d385dc9983074a024162afca355592 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 16:14:36 -0400 Subject: [PATCH 11/15] Update spec-utils.ts --- packages/oauth/src/state-stores/spec-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index 585f21e5b..f2bde9039 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -53,7 +53,7 @@ export class StateStoreChaiTestRunner { it('should detect multiple consumption', async () => { const { stateStore } = this; const installUrlOptions = { scopes: ['channels:read'] }; - for (let i = 0; i < 200; i++) { + for (let i = 0; i < 100; i++) { // generate other states await stateStore.generateStateParam(installUrlOptions, new Date()); } From 8a1df4409d316c9ce2b4c7075f32dab6293f26ca Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 2 Apr 2025 16:22:39 -0400 Subject: [PATCH 12/15] tighten up the PR --- .../src/state-stores/file-state-store.spec.ts | 34 ------------------- packages/oauth/src/state-stores/spec-utils.ts | 4 +-- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index d3162cae8..7f7edc4ef 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -1,10 +1,6 @@ -// import fs from 'node:fs'; import os from 'node:os'; -// import { assert, expect } from 'chai'; -// import sinon from 'sinon'; import { FileStateStore } from './file-state-store'; -// import type { StateStore } from './interface'; import { StateStoreChaiTestRunner } from './spec-utils'; const testRunner = new StateStoreChaiTestRunner({ @@ -13,33 +9,3 @@ const testRunner = new StateStoreChaiTestRunner({ }), }); testRunner.enableTests('FileStateStore'); - -// describe('FileStateStore specifics', () => { -// const stateStore: StateStore = new FileStateStore({ -// baseDir: os.tmpdir(), -// }); -// const installUrlOptions = { scopes: ['channels:read'] }; - -// it('should close all files after writing them', async () => { -// const writeFileSyncStub = sinon.stub(fs, 'writeFileSync').throws(new Error('mock_write_error')); - -// try { -// await stateStore.generateStateParam(installUrlOptions, new Date()); -// assert.fail('Exception should be thrown'); -// // biome-ignore lint/suspicious/noExplicitAny: errors can be anything -// } catch (e: any) { -// assert.equal(e.message, 'mock_write_error'); -// } - -// assert(writeFileSyncStub.calledOnce, 'writeFileSync should be called once'); -// const fd = writeFileSyncStub.getCall(0).args[0] as number; - -// expect( -// () => fs.fstatSync(fd), -// 'The file must be closed, we expect fstatSync to throw an error when the file is closed', -// ).to.throw('EBADF: bad file descriptor, fstat'); - -// // Restore original function -// writeFileSyncStub.restore(); -// }); -// }); diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index f2bde9039..1ec56adda 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -59,8 +59,8 @@ export class StateStoreChaiTestRunner { } const state = await stateStore.generateStateParam(installUrlOptions, new Date()); - // NOTE: wait 1 second to make sure IO operations completed - await new Promise((resolve, _) => setTimeout(resolve, 1000)); + // NOTE: wait 0.5 second to ensure IO operations completed + await new Promise((resolve, _) => setTimeout(resolve, 500)); const result = await stateStore.verifyStateParam(new Date(), state); assert.exists(result); From ffb250f069b3f03d4e19d6a20746ce7abb184e0c Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Mon, 7 Apr 2025 11:00:48 -0400 Subject: [PATCH 13/15] Update packages/oauth/src/state-stores/spec-utils.ts Co-authored-by: Eden Zimbelman --- packages/oauth/src/state-stores/spec-utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index 1ec56adda..5c42fef7b 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -55,7 +55,9 @@ export class StateStoreChaiTestRunner { const installUrlOptions = { scopes: ['channels:read'] }; for (let i = 0; i < 100; i++) { // generate other states - await stateStore.generateStateParam(installUrlOptions, new Date()); + const date = new Date(); + await stateStore.generateStateParam(installUrlOptions, date); + console.log('\tgenerateStateParam:', i, 100, date); } const state = await stateStore.generateStateParam(installUrlOptions, new Date()); From b562ce075b064faec7136fa279cd6712c313afae Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Mon, 7 Apr 2025 11:00:59 -0400 Subject: [PATCH 14/15] Update packages/oauth/src/state-stores/spec-utils.ts Co-authored-by: Eden Zimbelman --- packages/oauth/src/state-stores/spec-utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index 5c42fef7b..b65928a76 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -63,6 +63,7 @@ export class StateStoreChaiTestRunner { // NOTE: wait 0.5 second to ensure IO operations completed await new Promise((resolve, _) => setTimeout(resolve, 500)); + console.log('\tsetTimeout: complete'); const result = await stateStore.verifyStateParam(new Date(), state); assert.exists(result); From 18262120da8f2dc5427ffd58d87b33001bc56626 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Thu, 5 Jun 2025 16:42:35 -0400 Subject: [PATCH 15/15] Update packages/oauth/src/state-stores/spec-utils.ts Co-authored-by: Michael Brooks --- packages/oauth/src/state-stores/spec-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index b65928a76..9c029781b 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -61,7 +61,7 @@ export class StateStoreChaiTestRunner { } const state = await stateStore.generateStateParam(installUrlOptions, new Date()); - // NOTE: wait 0.5 second to ensure IO operations completed + // Wait 0.5 second to ensure I/O is complete and avoid flaky test results from rapid I/O await new Promise((resolve, _) => setTimeout(resolve, 500)); console.log('\tsetTimeout: complete');