Skip to content

0.5.0: sell against an allowance the caller counted - #8

Merged
ralyodio merged 1 commit into
mainfrom
feat/quota-from-caller
Sep 9, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/quota-from-caller

Conversation

@ralyodio

@ralyodio ralyodio commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@profullstack/throttle meters every route on a site, not just the paths a crawler list matches, and then wants the same 402 the gateway already knows how to write. Two seams were missing for that.

sell(request, { usage, quota }) now takes the allowance to quote. It used to read o.freeQuota unconditionally whenever a usage was passed, so a gateway with no allowance of its own — which is every gateway whose counting lives in the throttle — threw on that path. The gateway's own quota is still the default, so nothing that worked before changes.

passFrom and verifyPass are exposed because a pass has to be honoured by everything that could refuse a request, not only by handle. The throttle has to skip whoever already paid, and recomputing the signing-secret fallback (secret || coinpay.apiKey) on its side is the kind of duplicated rule that drifts and starts charging paying crawlers twice.

Additive: 82/82 tests pass, six of them new.

🤖 Generated with Claude Code

@profullstack/throttle meters every route on a site, not just the paths a
crawler list matches, and then wants the same 402 the gateway already knows
how to write. Two seams were missing for that.

`sell(request, { usage, quota })` now takes the allowance to quote. It used
to read `o.freeQuota` unconditionally whenever a usage was passed, so a
gateway that had no allowance of its own -- which is every gateway whose
counting lives in the throttle -- threw on that path. The gateway's own
quota is still the default, so nothing that worked before changes.

`passFrom` and `verifyPass` are exposed because a pass has to be honoured by
everything that could refuse a request, not only by `handle`. The throttle
has to skip whoever already paid, and recomputing the signing-secret
fallback (`secret || coinpay.apiKey`) on its side is the kind of duplicated
rule that drifts and starts charging paying crawlers twice.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YDGCxTmEPs3ecwjjLJDQXh
@ralyodio
ralyodio merged commit ffea26c into main Sep 9, 2026
6 checks passed
@ralyodio
ralyodio deleted the feat/quota-from-caller branch September 9, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant