advanceDateCursor
function advanceDateCursor(args: { anyFailed: boolean; inclusive?: boolean; maxIso: string | undefined; previous: Cursor | undefined;}): Cursor | undefined;The date cursor to return from a run whose sub-sources (feeds, sections, tickers, channels, meeting types) may have individually failed.
Two safety rules, both protecting the invariant that a date cursor never moves past unfetched work:
-
Hold on failure. When any sub-source failed, return the previous cursor unchanged. Advancing on the healthy sub-sources’ max date would permanently skip the failed sub-source’s items older than that date — per-sub-source try/catch “resilience” silently trading availability for data loss. Held back, the next run re-fetches the window and the platform’s
(feed, id)dedup absorbs the re-emitted documents. -
Clamp to now. A future-dated item (a scheduled meeting, a post-dated article) must not drag the cursor past the present, which would make everything published between now and that future date invisible.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
args | { anyFailed: boolean; inclusive?: boolean; maxIso: string | undefined; previous: Cursor | undefined; } | The decision’s inputs. |
args.anyFailed | boolean | Whether any sub-source failed this run. |
args.inclusive? | boolean | See dateCursor. |
args.maxIso | string | undefined | The maximum ISO date across this run’s items, if any. |
args.previous | Cursor | undefined | The incoming ctx.cursor, returned unchanged when holding. |
Returns
Section titled “Returns”Cursor | undefined
The cursor to return from sync — a new cursor when it is safe
to advance, otherwise exactly what was passed in.