fix: preserve cron semantics during node-cron adaptation

Preserve supported expression fields instead of stringifying them, and probe individual fields only when whole-expression validation fails. Convert unsupported syntax and weekday ranges ending in 7 while preserving legacy date/weekday rules and valid OR branches.

Add execution regressions for issue #3099 and 64 calendar boundary cases in UTC and Asia/Shanghai. Ensure timezone child tests actually run under the Node test runner.

Validation: 745 tests passed, 8 skipped; final targeted regressions passed; backend compilation passed. Differential calendar checks matched 142,360 execution timestamps.

Fixes #3099
This commit is contained in:
whyour
2026-10-17 20:00:33 +08:00
parent 286088a32c
commit cb5dfec2b5
6 changed files with 1508 additions and 10 deletions
+4 -1
View File
@@ -7,10 +7,13 @@ const { isValidCronSchedule } = require('../../back/shared/cronSchedule');
if (!process.env.QL_MACRO_TEST_TZ) {
for (const tz of ['UTC', 'Asia/Shanghai']) {
test(`macro execution in ${tz}`, () => {
const env = { ...process.env, TZ: tz, QL_MACRO_TEST_TZ: tz };
delete env.NODE_TEST_CONTEXT;
const result = require('node:child_process').spawnSync(process.execPath,
['-r', 'ts-node/register/transpile-only', '--test', __filename],
{ env: { ...process.env, TZ: tz, QL_MACRO_TEST_TZ: tz }, encoding: 'utf8' });
{ env, encoding: 'utf8' });
assert.equal(result.status, 0, result.stdout + result.stderr);
assert.match(result.stdout, /@annually fires at the expected local times/);
});
}
}