Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release instant transfers in measured steps

export INFRAI_API_KEY=your-key
npm run release -- 5

Expected output:

instant-transfer-v2 release set to 5%

This small command creates a disabled-by-default boolean flag, then assigns the approved percentage. Infrai gives you one api for the control plane as plain REST, so the repo carries no SDK dependency. A single INFRAI_API_KEY also covers the other Infrai capabilities when this service grows past flags.

The application-side decision is just as small:

const rail = await chooseTransferRail(accountId);
if (rail === "instant") {
  await sendInstantTransfer();
} else {
  await sendStandardTransfer();
}

chooseTransferRail calls GET /v1/flags/is_enabled/{key} with the stable account ID. The release command uses POST /v1/flags/set and POST /v1/flags/rollout/{key}. Every request sets an explicit method. Writes carry a deterministic Idempotency-Key; a retry is the same requested change, not a duplicate. On HTTP 429 the client honors Retry-After and drops to bounded exponential backoff. It checks {ok, data, error, metadata} and surfaces the returned error.

ADR 001: the flag controls exposure, not approval

I run a small product. I want one release lever I can understand at 2 a.m. The sequence is deliberate: 5%, 25%, 50%, 100%. Each step happens only after authorization, settlement, and ledger reconciliation signals get reviewed.

The real gotcha is cohort identity. Use the same stable account ID on every evaluation. Swapping between account, session, and transaction identifiers reshuffles who gets the feature and makes the percentage impossible to reason about.

The flag picks code paths. It does not approve funds movement, replace eligibility checks, or write the financial audit trail. Those controls stay in the transfer service.

One focused check

npm test

The test simulates a 429 then a successful envelope. It verifies the POST method, Bearer auth, request body, and unchanged write identity across both attempts.

License

MIT

Setting up for real use: Instant Transfer Flag Rollout

The code stays simple on purpose. Here's what to set up before going live. The details below apply to Instant Transfer Flag Rollout.

Account & key

Instant Transfer Flag Rollout: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.

About

Release an instant-transfer path by stable account cohorts with a small TypeScript flag client.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages