From daa9e5f44b937fdf408f0f23ce19c90d0d5bc3e0 Mon Sep 17 00:00:00 2001 From: sadsac <444361557@qq.com> Date: Mon, 30 Nov 2026 00:34:50 +0800 Subject: [PATCH 1/2] fix(node-sdk): sync plugin state through its writable handle --- shared/plugins/sdk/node/src/state.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/plugins/sdk/node/src/state.mjs b/shared/plugins/sdk/node/src/state.mjs index f648bb3d..afd7f518 100644 --- a/shared/plugins/sdk/node/src/state.mjs +++ b/shared/plugins/sdk/node/src/state.mjs @@ -87,9 +87,9 @@ class StateStore { const body = JSON.stringify({ litheStateStore: STORE_FORMAT, value }); const temporary = `${path}.${process.pid}.${randomBytes(4).toString('hex')}.tmp`; try { - writeFileSync(temporary, body, { encoding: 'utf8', mode: 0o600 }); - const handle = openSync(temporary, 'r'); + const handle = openSync(temporary, 'w', 0o600); try { + writeFileSync(handle, body, 'utf8'); fsyncSync(handle); } finally { closeSync(handle); From 6e56919167aacacf50546b69792a361ec67381d6 Mon Sep 17 00:00:00 2001 From: sadsac <444361557@qq.com> Date: Mon, 30 Nov 2026 09:19:20 +0800 Subject: [PATCH 2/2] ci(node-sdk): run state store regression tests on Windows --- .../workflows/plugins-node-state-windows.yml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/plugins-node-state-windows.yml diff --git a/.github/workflows/plugins-node-state-windows.yml b/.github/workflows/plugins-node-state-windows.yml new file mode 100644 index 00000000..4333041b --- /dev/null +++ b/.github/workflows/plugins-node-state-windows.yml @@ -0,0 +1,33 @@ +name: Node SDK state on Windows + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'shared/plugins/sdk/node/**' + - '.github/workflows/plugins-node-state-windows.yml' + push: + branches: [main] + paths: + - 'shared/plugins/sdk/node/**' + - '.github/workflows/plugins-node-state-windows.yml' + +permissions: + contents: read + +concurrency: + group: plugins-node-state-windows-${{ github.ref }} + cancel-in-progress: true + +jobs: + state: + name: Windows state store + if: github.event_name != 'pull_request' || !github.event.pull_request.draft + runs-on: windows-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v6 + with: + node-version: 20 + - run: node --test shared/plugins/sdk/node/test/support.test.mjs