@rotorsoft/act 1.23.4 → 1.23.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  sleep,
21
21
  store,
22
22
  validate
23
- } from "./chunk-ZG7IC6N6.js";
23
+ } from "./chunk-C7H3GARW.js";
24
24
  import {
25
25
  ActorSchema,
26
26
  CausationEventSchema,
@@ -1958,7 +1958,14 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1958
1958
  {
1959
1959
  stream,
1960
1960
  stream_exact: true,
1961
- ...cached ? { after: cached.event_id } : { with_snaps: true, ...asOf }
1961
+ // The snapshot resume floor is a current-state optimization: it only
1962
+ // holds when the load has no window of its own. `time_travel` already
1963
+ // captures that (any `asOf` bound set), so request `with_snaps` only for
1964
+ // a non-time-travel cold load — a bounded load full-scans real events
1965
+ // under its `asOf` filter. This is the single floor-eligibility decision
1966
+ // for the whole system; the stores apply the floor whenever asked and
1967
+ // never re-derive it (RFC 1274). The warm path resumes from `after`.
1968
+ ...cached ? { after: cached.event_id } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
1962
1969
  }
1963
1970
  );
1964
1971
  const head_is_tombstone = event?.name === TOMBSTONE_EVENT;
@@ -2300,7 +2307,7 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
2300
2307
  }
2301
2308
 
2302
2309
  // src/internal/drain-cycle.ts
2303
- async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, is_deferred, lane) {
2310
+ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_batch, lagging, leading, eventLimit, leaseMillis, lane) {
2304
2311
  const leased = await ops.claim(
2305
2312
  lagging,
2306
2313
  leading,
@@ -2309,18 +2316,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2309
2316
  lane
2310
2317
  );
2311
2318
  if (!leased.length) return void 0;
2312
- const active = is_deferred ? leased.filter((l) => !is_deferred(l.stream)) : leased;
2313
- if (!active.length) {
2314
- return {
2315
- leased,
2316
- fetched: [],
2317
- handled: [],
2318
- acked: [],
2319
- blocked: [],
2320
- closeable: []
2321
- };
2322
- }
2323
- const fetched = await ops.fetch(active, eventLimit);
2319
+ const fetched = await ops.fetch(leased, eventLimit);
2324
2320
  const fetch_map = /* @__PURE__ */ new Map();
2325
2321
  const fetch_window_at = fetched.reduce(
2326
2322
  (max, { at, events }) => Math.max(max, events.at(-1)?.id || at),
@@ -2339,7 +2335,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2339
2335
  fetch_map.set(stream, { fetch: f, payloads });
2340
2336
  }
2341
2337
  const handled = await Promise.all(
2342
- active.map((lease) => {
2338
+ leased.map((lease) => {
2343
2339
  const entry = fetch_map.get(lease.stream);
2344
2340
  const at = entry.fetch.events.at(-1)?.id || fetch_window_at;
2345
2341
  const { payloads } = entry;
@@ -2352,7 +2348,7 @@ async function run_drain_cycle(ops, registry, batch_handlers, handle, handle_bat
2352
2348
  );
2353
2349
  const acked = await ops.ack(
2354
2350
  handled.flatMap(
2355
- (h) => h.defer !== void 0 ? { ...h.lease, due: h.defer } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : []
2351
+ (h) => h.defer !== void 0 ? { ...h.lease, due: h.defer, retry: -1 } : h.handled > 0 || !h.error ? { ...h.lease, at: h.acked_at } : h.next_attempt_at !== void 0 ? { ...h.lease, due: h.next_attempt_at } : []
2356
2352
  )
2357
2353
  );
2358
2354
  const blocked = await ops.block(
@@ -2475,7 +2471,6 @@ var DrainController = class {
2475
2471
  leading,
2476
2472
  eventLimit,
2477
2473
  leaseMillis,
2478
- this._defer.size > 0 ? this._defer.is_deferred : void 0,
2479
2474
  this._deps.lane
2480
2475
  );
2481
2476
  this._deps.breaker.passed();