From 050b15801a401605e618922c82df2ea44c4e5dae Mon Sep 17 00:00:00 2001 From: haelyra <49814733+haelyra@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:30:19 -0500 Subject: [PATCH] test: assert artifact read flags outside verifier error handling --- tests/lib/work-item-verification.test.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/lib/work-item-verification.test.js b/tests/lib/work-item-verification.test.js index 361424cd8..d62e5949a 100644 --- a/tests/lib/work-item-verification.test.js +++ b/tests/lib/work-item-verification.test.js @@ -237,9 +237,10 @@ async function run() { const canonicalArtifact = path.join(fs.realpathSync(root), 'matrix.md'); const open = fs.openSync; const readFlags = fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0) | (fs.constants.O_NONBLOCK || 0); + let observedArtifactFlags; fs.openSync = function (filename, flags, mode) { if (filename === canonicalArtifact) { - assert.strictEqual(flags, readFlags, 'artifact reads must retain nonblocking/no-follow flags'); + observedArtifactFlags = flags; fs.unlinkSync(artifact); makeFifo(); return open(filename, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0) | (fs.constants.O_NONBLOCK || 0)); } @@ -254,8 +255,10 @@ async function run() { assert.strictEqual(flags, 'r', 'unexpected file-open mode during verification'); return open(filename, 'r'); }; - try { assert.strictEqual(store.verifyWorkItem('docs-task').attempt.outcome, 'unknown'); } - finally { fs.openSync = open; } + try { + assert.strictEqual(store.verifyWorkItem('docs-task').attempt.outcome, 'unknown'); + assert.strictEqual(observedArtifactFlags, readFlags, 'artifact reads must retain nonblocking/no-follow flags'); + } finally { fs.openSync = open; } }); await test('the validator comes from ECC, never a module supplied by the artifact repository', ({ root, store, register, claim, artifact }) => {