| 156 | const ce = new ComputeEngine(); |
| 157 | const driver = new RubiDriver(ce, [], { timeLimitMs: 10_000 }); |
| 158 | const d = driver as any; |
| 159 | d.memo.set('x§stale', ce.One); // residue from a prior top-level call |
| 160 | expect(d.activeCalls).toBe(0); // genuine top-level entry |
| 161 | driver.int(ce.symbol('x'), 'x'); |
| 162 | expect(d.memo.has('x§stale')).toBe(false); |
| 163 | expect(d.activeCalls).toBe(0); // balanced on the way out |
| 164 | }); |
| 165 | }); |
| 166 | |
| 167 | // ── Finding 3: the native-rational fallback's catch must swallow ONLY a |
| 168 | // cancellation that belongs to Rubi's own bounded work window (its own |
| 169 | // `rubi:native-fallback` sub-budget, or an unattributed numeric deadline). A |
| 170 | // CancellationError attributed to an ENCLOSING caller span (e.g. a user |
| 171 | // `withTimeLimit({label:'caller'})`) must propagate — Rubi must not eat the |
| 172 | // caller's deadline and continue past it. Simulated deterministically by |