Repository navigation
refactor(topup-agent): the pull runs on the offline simulation; a pull to a real bank goes through the CodeSpar API - #136
Merged
Conversation
…l to a real bank goes through the CodeSpar API The kit no longer carries a client of a payment provider. The direct sweeping client and the `--rail api` path are removed; the simulated rail (SweepingPullRail over FixtureSweepingApi) is the only rail and the default, with the same state machine and the same guarantees: one pull per approved execution, the marker written before the payment request, no consent link in state.db. - src/iniciador.ts is removed; the rail's types and its error class (SweepingApiError) move into src/modules/sweeping-pull.ts. - kit.ts builds only the simulated rail; `--rail api` is refused with a message that names the CodeSpar API. apiRailKey stays "none", so the hosted catalog is unchanged. - The two limits are read from TOPUP_TOTAL_CENTS / TOPUP_TX_LIMIT_CENTS. - Tests: the HTTP client tests and the api-rail command test are removed; the rail tests run over an in-memory fake of the four calls. - README, runbook, .env.example, AGENTS.md/CLAUDE.md, agent.yaml and OPEN_QUESTIONS 66 describe the simulated rail and the CodeSpar API path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orization; --rail api is refused - sweeping-pull.test.ts: the happy path asserts the authorization request (both limits, creditor, trigger, externalId). - kit-rail.test.ts: the rail the kit builds with TOPUP_TOTAL_CENTS / TOPUP_TX_LIMIT_CENTS set puts the same caps in the mandate and in the authorization; the defaults are R$ 10,00 / R$ 5,00; buildRail with kind "api" throws instead of falling back to the simulation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The topup-agent no longer carries a client of a payment provider. The pull runs on the kit's offline simulation of the bank, which stays the default and now is the only rail; a pull to a real bank goes through the CodeSpar API.
--rail apipath are removed;--rail apiis refused with a message naming the CodeSpar API.src/modules/sweeping-pull.ts; the rail keeps its guarantees (one pull per approved execution, marker before the payment request, no consent link in state.db).TOPUP_TOTAL_CENTS/TOPUP_TX_LIMIT_CENTS.apiRailKey: "none"kept)..env.example, AGENTS.md/CLAUDE.md, agent.yaml and OPEN_QUESTIONS 66 describe the simulated rail.Tests
npm run typechecknpm run checknpm test(1114 passed, 43 skipped: the WhatsApp cases without the emulator)npm run eval --workspace=agents/topup-agent(7 adversarial cases, 13 scenario runs)🤖 Generated with Claude Code