File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import type { JsonObject } from "../effect_program.ts" ;
22import { EffectRuntimeRequestError } from "../effect_runtime_errors.ts" ;
3- import { isBoundedBlockedRetry } from "../quota/blocked_retry .ts" ;
3+ import { isBoundedBlockedRetry } from "../quota/settlement_phase .ts" ;
44import {
55 DELIVERY_BOUNDARIES ,
66 type DeliveryBoundary ,
Load diff This file was deleted.
Original file line number Diff line number Diff line change 11import type { SettlementIdentity } from "../effect_program.ts" ;
2+ import { jsonObject } from "../runtime_decode.ts" ;
3+
4+ /** A typed blocked Turn may close without spend only with a bounded retry. */
5+ export function isBoundedBlockedRetry ( value : unknown , todoId : string | null ) : boolean {
6+ const retry = jsonObject ( value ) ;
7+ if ( ! retry || retry . schema_version !== "quota_blocked_retry_v0" ||
8+ ( retry . source !== "todo" && retry . source !== "turn_settlement" ) ||
9+ typeof todoId !== "string" || retry . todo_id !== todoId ||
10+ typeof retry . observed_at !== "string" || typeof retry . due_at !== "string" ||
11+ retry . resume_when !== `resume_at:${ retry . due_at } ` ) return false ;
12+ const observed = Date . parse ( retry . observed_at ) ;
13+ const due = Date . parse ( retry . due_at ) ;
14+ const delay = ( due - observed ) / 1000 ;
15+ return Number . isFinite ( delay ) && delay >= 60 && delay <= 30 * 60 ;
16+ }
217
318/** Both same-Turn readback and prior-Turn recovery accept the shipped effect identities. */
419export function isCommittedMonitorPollEffect (
Original file line number Diff line number Diff line change @@ -30,12 +30,12 @@ import {
3030 type DeliveryWorkspaceCausality ,
3131} from "./settlement_workspace_causality.ts" ;
3232import {
33+ isBoundedBlockedRetry ,
3334 isCommittedMonitorPollEffect ,
3435 receiptBoundMonitorPhase ,
3536 receiptBoundReplayPhase ,
3637} from "./settlement_phase.ts" ;
3738import { isTurnScopedSettlementOutcome } from "../work_items/delivery_outcome.ts" ;
38- import { isBoundedBlockedRetry } from "./blocked_retry.ts" ;
3939import {
4040 decodeRefreshRetry ,
4141 isMaterialMonitorPoll ,
You can’t perform that action at this time.
0 commit comments