fix(config): the URL resolver defaulted to the internal host, defeating #78 - #82
Merged
Merged
Conversation
…he constant With KESTREL_API_URL unset, config.KESTREL_API_URL returned the PUBLIC host while get_kestrel_api_url() returned the INTERNAL one. The client resolves through the function, so dev has been defaulting to kestrel.nathanpricelab.com since #78 merged -- the public-default promotion that #78 exists to deliver was cosmetic. Two independent readings of one setting. get_kestrel_api_url() was added by #74 with its own hardcoded fallback, correct at the time because the repo default WAS internal. #78 promoted the default to public by moving the constant, and nothing connected the two, so they silently disagreed. Drop the private _DEFAULT_KESTREL_API_URL and fall back to PUBLIC_KESTREL_API_URL, leaving exactly one place that decides the default. Env override is unaffected: KESTREL_API_URL=... still wins, and --kestrel-url still reaches the client after import. Adds a test asserting the constant and the resolver agree under a cleared environment. Verified it fails against the pre-fix code with 'https://kestrel.nathanpricelab.com/api' != 'https://kestrel.krakenkg.com/api'. ruff clean, black clean, pyright 0 errors, 303 passed / 62 deselected. Co-Authored-By: Claude Opus 5 (1M context) <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.
The bug
With
KESTREL_API_URLunset,devresolves the Kestrel backend to the internal host. #78's public-default promotion, merged an hour ago, is currently cosmetic.The client resolves through the function, so the function's answer is the one that ships.
Why it happened
Two independent readings of one setting:
config.KESTREL_API_URLos.getenv(..., PUBLIC_KESTREL_API_URL)get_kestrel_api_url()os.environ.get(..., _DEFAULT_KESTREL_API_URL)get_kestrel_api_url()arrived in #74 with its own hardcoded fallback — correct then, because the repo default was internal. #78 promoted the default by moving the constant. Nothing tied the two together, so they silently diverged.This is a consequence of the #78 rebase I did: that rebase resolved
bulk_kestrel_requestonto the resolver (per #79's adjudication, and necessary — the credential guard has to judge the URL the request actually goes to). Correct on its own terms, but it made the resolver's stale fallback load-bearing, and I did not check that the two defaults matched. Caught while mergingdevdown into the fork.The fix
Drop
_DEFAULT_KESTREL_API_URL; the resolver falls back toPUBLIC_KESTREL_API_URL. One place decides the default.Env override unaffected —
KESTREL_API_URL=...still wins, and--kestrel-urlstill reaches the client after import (verified both).Test
test_the_constant_and_the_resolver_share_one_defaultasserts the two agree under a cleared environment (reimportingconfig, since the constant is import-time state). Verified it fails on pre-fix code:Verification
ruff clean · black clean · pyright 0 errors ·
test-fast.sh303 passed, 62 deselected🤖 Generated with Claude Code