Fix cron cwd for super_admin and harden IM channel job isolation.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-10 10:00:59 +08:00
parent b35bfde557
commit b1bb0067a0
16 changed files with 714 additions and 49 deletions

View file

@ -139,3 +139,24 @@ test('one-shot at fires once then waits as complete even if nextRunAt is null',
assert.equal(second.action, 'wait')
assert.equal(second.reason, 'complete')
})
test('one-shot misfire beyond grace skips and clears nextRunAt', () => {
const at = shanghai(2026, 8, 23, 22, 57)
const job = {
id: 'at-miss',
enabled: true,
schedule: { kind: 'at', at: new Date(at).toISOString(), timezone: TZ },
nextRunAt: at,
createdAt: at - 60_000,
}
const decision = decideDispatch({
job,
runs: [],
now: at + 5 * 60_000,
misfirePolicy: 'skip',
graceMs: 60_000,
})
assert.equal(decision.action, 'skip')
assert.equal(decision.reason, 'misfire')
assert.equal(decision.nextRunAt, null)
})