Skip to main content

usageDedupeKey

@forge/monorepo


@forge/monorepo / backend/src / usageDedupeKey

Function: usageDedupeKey()

usageDedupeKey(event): string

Defined in: backend/src/usage/index.ts:69

The key an append is idempotent on: (runId, stepId) when a step is known, else the event id.

Lives here rather than in an adapter so every adapter dedupes identically by construction. The reference adapter owned a private copy of this, which meant "both adapters agree" was a coincidence — the same situation DEFAULT_SESSION_STATE_MAX_BYTES was in before #97 moved it to the port. A recovered run re-recording a step it already logged must be a no-op in every adapter, because the alternative is double-counting real money.

Parameters

event

Pick<UsageEvent, "id" | "runId"> & object

Returns

string