feat(ql3): observe system crond runs idempotently

This commit is contained in:
whyour
2026-08-18 06:33:23 +08:00
parent 6831ea3de5
commit 0ad96d38a6
16 changed files with 858 additions and 73 deletions
@@ -45,7 +45,7 @@ function successfulCommand() {
return `${JSON.stringify(process.execPath)} -e "process.exit(0)"`;
}
test('admits the three reviewed origins through the default environment boundary', () => {
test('admits the reviewed schedule and system-crond origins through the environment boundary', () => {
const source = `
const bridge = require('./back/runtime/compatibility/legacyExecutionBridge');
const fact = (origin) => ({
@@ -56,11 +56,11 @@ test('admits the three reviewed origins through the default environment boundary
triggerType: origin,
acceptedAtMs: 1,
});
const result = ['subscription', 'system', 'script', 'boot'].map((origin) =>
const result = ['subscription', 'system', 'script', 'scheduled_system', 'boot'].map((origin) =>
Boolean(bridge.observeLegacyExecution(origin, () => fact(origin))),
);
process.stdout.write(JSON.stringify(result));
process.exit(result.join(',') === 'true,true,true,false' ? 0 : 1);
process.exit(result.join(',') === 'true,true,true,true,false' ? 0 : 1);
`;
const child = spawnSync(
process.execPath,
@@ -69,7 +69,7 @@ test('admits the three reviewed origins through the default environment boundary
cwd: path.resolve(__dirname, '../..'),
env: {
...process.env,
QL3_SHADOW_ORIGINS: 'subscription,system,script',
QL3_SHADOW_ORIGINS: 'subscription,system,script,scheduled_system',
},
encoding: 'utf8',
timeout: 10_000,
@@ -77,7 +77,7 @@ test('admits the three reviewed origins through the default environment boundary
);
assert.equal(child.status, 0, child.stderr);
assert.equal(child.stdout, '[true,true,true,false]');
assert.equal(child.stdout, '[true,true,true,true,false]');
});
test('observes subscription, system and script children without replacing legacy execution', async () => {