mirror of
https://github.com/Ryder-Sun/Meldwork.git
synced 2026-11-07 06:56:03 -10:00
Cover late failed Agent capability probes
Verify an older failed probe cannot erase a newer successful cache. Verified CLI discovery tests and git diff --check.
This commit is contained in:
1 parent
a535e5942a
commit
cacd255182
1 file changed
+21
@@ -256,6 +256,27 @@ test('a late successful probe cannot restore a cache after a newer spawn failure
|
||||
assert.equal(timeout.compatibilityState, 'unknown')
|
||||
})
|
||||
|
||||
test('a late spawn failure cannot erase a newer successful probe cache', async () => {
|
||||
let release
|
||||
const pending = new Promise(resolve => { release = resolve })
|
||||
const options = { env: {}, version: '2.115.0',
|
||||
statFn: () => ({ dev: 1, ino: 1, size: 100, mtimeMs: 1, ctimeMs: 1 }) }
|
||||
const executable = '/test/parallel-probe-failure'
|
||||
const oldProbe = probeAgentCapabilities('workbuddy', executable, { ...options,
|
||||
execFileFn: async () => { await pending; throw Object.assign(new Error('permission denied'), { code: 'EACCES' }) },
|
||||
})
|
||||
const newer = await probeAgentCapabilities('workbuddy', executable, { ...options,
|
||||
execFileFn: async () => ({ stdout: '--print --output-format --permission-mode --max-turns --resume json plan acceptEdits' }),
|
||||
})
|
||||
assert.equal(newer.compatibilityState, 'compatible')
|
||||
release()
|
||||
assert.equal((await oldProbe).compatibilityState, 'unknown')
|
||||
const timeout = await probeAgentCapabilities('workbuddy', executable, { ...options,
|
||||
execFileFn: async () => { throw Object.assign(new Error('timeout'), { code: 'ETIMEDOUT' }) },
|
||||
})
|
||||
assert.equal(timeout.compatibilityState, 'compatible')
|
||||
})
|
||||
|
||||
test('capability probe cache expires when the system clock moves backwards', async t => {
|
||||
let now = 10_000
|
||||
t.mock.method(Date, 'now', () => now)
|
||||
|
||||
Reference in new issue
Block a user