feat: manual country target for runs and sessions - #3
Merged
Conversation
Sessions and variation runs can now declare a target country (ISO 3166-1 alpha-2) when the proxy config itself does not encode one — a dedicated gateway host or provider-side geo pinning leaves both the username parser and the run honor rate blind to the intended country. The value is stored per session (runs propagate it to every child at creation) and overrides a country axis param or username country token when set. Run reports compute honor rate from it for runs without a country axis, and the session Targeting panel compares it (marked "manual") against the observed egress countries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Show the manual target country on the run page header so the honor
rate is never measured against an invisible target.
- When a manual target contradicts a username-encoded country, the
Targeting panel's requested column now names the overridden value
("DE (manual, overrides US)") instead of hiding it.
- Bucket observed country codes case-insensitively in dominantCountry
so a mixed-case reputation code cannot split the vote.
- Widen the target_country spec pattern to ^([A-Za-z]{2})?$ — the
server already treats an empty string as unset.
- Replace the hand-rolled byte-range check with a package-level regexp
matching the spec, and collapse the optional-string response mapping
into an optionalString helper.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Re-lands the run-page header line (Target country XX (manual)) that a concurrent editor buffer reverted out of the previous commit, and aligns per-cell presentation with the override semantics: CellReport now carries the effective target_country, and the run page's cell label appends 'target US (manual)' when the honor rate was measured against a manual target rather than the cell's own country param. Co-Authored-By: Claude Fable 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.
Summary
Sessions and variation runs can now declare a manual target country (ISO 3166-1 alpha-2) when the proxy config itself does not encode one — a dedicated gateway host or provider-side geo pinning otherwise leaves both the username parser and the run honor rate blind to the intended country.
sampling_sessions.target_countrycolumn (goose migration, empty = unset). Runs propagate the value to every child session at creation; there is no separate run column.variantHonorfalls back to the variant's target country, so runs without a{country}axis get a real honor rate and per-cell honor instead of "unknown".CellReportcarries the effectivetarget_country, and the run page labels such cellscountry=de · target US (manual)so a cell is never displayed as honored under a country its honor was not measured against.target_country(^([A-Za-z]{2})?$, normalized to uppercase) onCreateSessionRequest/CreateRunRequest; echoed onSession,VariantSummary, andRunReport.cells[].Target country US (manual); the session Targeting panel compares the manual target against observed egress and, on a conflict with a username country, showsDE (manual, overrides US).dominantCountryto bucket observed codes case-insensitively.web/distis regenerated and committed (embedded SPA).Testing
make test,make test-race(withTEST_DATABASE_URL),make vet,make generate-checkall pass.🤖 Generated with Claude Code