Repository navigation
What the upstream page needs to edit in one save - #32
Merged
Merged
Conversation
The desktop app's upstream page edits upstreams, price sheets and speed
tests in dialogs. Five things it needs had no endpoint, so the page would
have had to re-derive core logic or save in several steps:
- Speed tests take `providers` (empty means all) instead of a single
`provider`, so a dialog can test the upstreams the user ticked. Each
quote item says when an upstream cannot serve the model: `out_of_scope`
when the model is outside `models_only`, `not_offered` when its model
list lacks it. Those are left out of the total and are not sent, since
the request would only come back as a 4xx. A disabled upstream can
still be tested, which is the point of testing before enabling it.
- Saving a price sheet can carry `used_by`: exactly those upstreams use the
sheet afterwards, and upstreams that used it but are not listed go back to
the default table. It is written in the same version as the sheet, so
"set prices for these unpriced models on these upstreams" is one save.
- `GET /pricing/sheets/{name}` returns a sheet's full definition for
editing. The overview only carries counts.
- `ProviderView.billing_effective` says how an upstream is actually
billed when `billing` is not written, the same way the ledger decides.
- `POST /providers/preview` reports what automatic detection picks for an
address, without touching the network: the protocol, whether it is an
official endpoint, and which kinds would be redacted. A dialog can show
what "automatic" means while the address is being typed, and the rules
stay in core.
The workspace version goes to 0.2.1 for the desktop app to pin.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the PR. One thing before review: this targets
No need to close and reopen: click Edit next to the PR title and change the base branch to See CONTRIBUTING.md and CONTRIBUTING.md for the branch contract. |
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.
Why
The desktop app's upstream page (next lite PR) edits upstreams, price sheets and speed tests in dialogs. Five things it needs had no endpoint. Without them the page would re-derive core logic, or save one dialog in several config versions.
What
Speed tests for the upstreams the user ticked (
/speed/quote,/speed/run)SpeedRunRequest.providersreplacesprovider. An empty list means all upstreams, and naming an unknown upstream is a 404.skippedwhen the upstream cannot serve the model:out_of_scope(outsidemodels_only) ornot_offered(missing from its model list). Skipped items stay out of the total and are not sent, because the request would only come back as a 4xx.tw_gateway::models::fitis the check shared with routing, minus the disabled test.A price sheet and the upstreams that use it, in one save
PriceSheetSave.used_by: when given, exactly those upstreams use the sheet afterwards, and upstreams that used it but are not listed go back to the default table.Reads the dialogs need
GET /pricing/sheets/{name}returns a sheet's full definition. The overview only carries counts.ProviderView.billing_effectiveis how the upstream is actually billed whenbillingis not written, decided the way the ledger decides.POST /providers/previewreports what automatic detection picks for an address: protocol, official endpoint or not, and default redaction kinds. It makes no network calls, so a dialog can call it while the address is typed and the rules stay in core.The workspace version goes to 0.2.1, the tag the desktop app will pin.
Tests
tw-control/tests/speed.rs:tw-control/tests/pricing.rs:used_byassigns;used_bychanges nothing;tw-control/tests/models.rs:billing_effectivewhenbillingis unset.fmt,clippy -D warningsandcargo test --workspace(1,250 tests) pass.scripts/smoke.sh: 48 passed, 0 failed, 1 over target and not a regression (memory 33 MB against a 30 MB target).🤖 Generated with Claude Code