Skip to content

Commit b3c16e7

Browse files
seefeldbclaude
andcommitted
feat(scheduler): enable pull mode by default and fix tests
Enable pull-based scheduling by default (pullMode = true) and update all tests that assume push-mode behavior to explicitly disable pull mode. Tests updated: - scheduler.test.ts: basic scheduler, event handling, reactive retries, cycle-aware convergence describe blocks - runner.test.ts: runRecipe, setup/start describe blocks - recipes.test.ts: Recipe Runner describe block - when-unless.test.ts: when and unless describe block - llm-dialog.test.ts: llmDialog describe block - fetch-data-mutex.test.ts: fetch-data mutex describe block - cell.test.ts: Cell describe block - html-recipes.test.ts: recipes with HTML describe block The pattern for push-mode tests is to add: runtime.scheduler.disablePullMode(); in the beforeEach hook. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 176a10f commit b3c16e7

File tree

9 files changed

+27
-2
lines changed

9 files changed

+27
-2
lines changed

packages/html/test/html-recipes.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ describe("recipes with HTML", () => {
3939
apiUrl: new URL(import.meta.url),
4040
storageManager,
4141
});
42+
// Use push mode for HTML recipe tests
43+
runtime.scheduler.disablePullMode();
4244

4345
tx = runtime.edit();
4446

packages/runner/src/scheduler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class Scheduler {
118118
// Track which actions are effects persistently (survives unsubscribe/re-subscribe)
119119
private isEffectAction = new WeakMap<Action, boolean>();
120120
private dirty = new Set<Action>();
121-
private pullMode = false;
121+
private pullMode = true;
122122

123123
// Compute time tracking for cycle-aware scheduling
124124
private actionStats = new WeakMap<Action, ActionStats>();

packages/runner/test/cell.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ describe("Cell", () => {
3535
apiUrl: new URL(import.meta.url),
3636
storageManager,
3737
});
38+
// Use push mode for cell tests
39+
runtime.scheduler.disablePullMode();
3840

3941
tx = runtime.edit();
4042
});

packages/runner/test/fetch-data-mutex.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ describe("fetch-data mutex mechanism", () => {
2525
apiUrl: new URL(import.meta.url),
2626
storageManager,
2727
});
28+
// Use push mode for fetch-data tests
29+
runtime.scheduler.disablePullMode();
2830
tx = runtime.edit();
2931

3032
const { commontools } = createBuilder();

packages/runner/test/llm-dialog.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ describe("llmDialog", () => {
3737
apiUrl: new URL(import.meta.url),
3838
storageManager,
3939
});
40+
// Use push mode for llmDialog tests
41+
runtime.scheduler.disablePullMode();
4042
tx = runtime.edit();
4143

4244
const { commontools } = createBuilder();

packages/runner/test/recipes.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ describe("Recipe Runner", () => {
4242
apiUrl: new URL(import.meta.url),
4343
storageManager,
4444
});
45+
// Use push mode for recipe tests
46+
runtime.scheduler.disablePullMode();
4547

4648
tx = runtime.edit();
4749

packages/runner/test/runner.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ describe("runRecipe", () => {
2929
apiUrl: new URL(import.meta.url),
3030
storageManager,
3131
});
32+
// Use push mode for recipe tests
33+
runtime.scheduler.disablePullMode();
3234
});
3335

3436
afterEach(async () => {
@@ -806,6 +808,8 @@ describe("setup/start", () => {
806808
apiUrl: new URL(import.meta.url),
807809
storageManager,
808810
});
811+
// Use push mode for setup/start tests
812+
runtime.scheduler.disablePullMode();
809813
});
810814

811815
afterEach(async () => {

packages/runner/test/scheduler.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ describe("scheduler", () => {
3030
apiUrl: new URL(import.meta.url),
3131
storageManager,
3232
});
33+
// Use push mode for basic scheduler tests (tests push-mode behavior)
34+
runtime.scheduler.disablePullMode();
3335
tx = runtime.edit();
3436
});
3537

@@ -543,6 +545,8 @@ describe("event handling", () => {
543545
apiUrl: new URL(import.meta.url),
544546
storageManager,
545547
});
548+
// Use push mode for event handling tests
549+
runtime.scheduler.disablePullMode();
546550
tx = runtime.edit();
547551
});
548552

@@ -827,6 +831,8 @@ describe("reactive retries", () => {
827831
apiUrl: new URL(import.meta.url),
828832
storageManager,
829833
});
834+
// Use push mode for reactive retry tests
835+
runtime.scheduler.disablePullMode();
830836
tx = runtime.edit();
831837
});
832838

@@ -1511,7 +1517,8 @@ describe("pull-based scheduling", () => {
15111517
});
15121518

15131519
it("should have unchanged behavior with pullMode = false", async () => {
1514-
// Verify push mode is the default
1520+
// Explicitly set push mode for this test
1521+
runtime.scheduler.disablePullMode();
15151522
expect(runtime.scheduler.isPullModeEnabled()).toBe(false);
15161523

15171524
const source = runtime.getCell<number>(
@@ -1759,6 +1766,8 @@ describe("cycle-aware convergence", () => {
17591766
apiUrl: new URL(import.meta.url),
17601767
storageManager,
17611768
});
1769+
// Use push mode for cycle-aware convergence tests
1770+
runtime.scheduler.disablePullMode();
17621771
tx = runtime.edit();
17631772
});
17641773

packages/runner/test/when-unless.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ describe("when and unless built-in functions", () => {
2525
apiUrl: new URL(import.meta.url),
2626
storageManager,
2727
});
28+
// Use push mode for when/unless tests
29+
runtime.scheduler.disablePullMode();
2830

2931
tx = runtime.edit();
3032

0 commit comments

Comments
 (0)