Repository navigation
fix: report not ready without flags, and reject unusable configuration - #23
Open
lourens-octopus wants to merge 1 commit into
Open
lourens-octopus wants to merge 1 commit into
lourens-octopus wants to merge 1 commit into
Conversation
- Until a fetch succeeds, every evaluation reports PROVIDER_NOT_READY with the TypeScript provider's message, instead of FLAG_NOT_FOUND and a warning blaming the slug. A wrong client identifier no longer looks like a typo in every flag key. - Strip whitespace around client_identifier and release_version_override, and reject values that still can't be sent in an HTTP header. A trailing newline from a file or mounted secret made every request fail. - Reject an http_client that isn't an httpx.Client. An httpx.AsyncClient made every request fail with an un-awaited coroutine. 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.
Resolves BMBB-1565.
What
Fixes three behaviour issues from the Python provider 0.1.0 review. The review's flags freeze issue isn't included.
Without any fetched flags, evaluations report
PROVIDER_NOT_READYWith a wrong client identifier, the server returns 404 and
set_provider_and_waitstill succeeds. Every flag then returnedFLAG_NOT_FOUND, and every flag logged a warning to "double check your slug". The real cause, that no flags were ever fetched, showed up only as one warning at startup.This follows the TypeScript providers (
requireEvaluatorinpackages/server/src/octopusFeatureProvider.ts). Until a fetch succeeds (the evaluator's content hash is empty), boolean and non-boolean evaluations raiseProviderNotReadyErrorwith the same message: "No Octopus feature flags are available. The provider failed to initialize, or was used before initializing." The slug warning is no longer logged in that state.cache_duration.FLAG_NOT_FOUND.This reverses what BMBB-1515 asked for. .NET, Go and Java still return
FLAG_NOT_FOUNDhere, and matching them up has no ticket yet.Header values are stripped and validated
The emptiness check on
client_identifierstripped whitespace, but the request used the value unstripped. A trailing newline, which is common when the value is read from a file or a mounted secret, made httpx raiseLocalProtocolError: Illegal header valueon every request.release_version_overridewasn't validated at all.The constructor now strips both values. It raises
ValueErrorif a value is empty or contains anything other than printable ASCII, andTypeErrorif it isn't astr.http_clientmust be anhttpx.ClientPassing an
httpx.AsyncClientmade every request fail withAttributeError: 'coroutine' object has no attribute 'status_code'and a "coroutine was never awaited" warning. The constructor now raisesTypeError.Testing
FLAG_NOT_FOUNDafter a failed fetch.uv run ruff check && uv run ruff format --check && uv run mypy && uv run pytest: 433 passed.🤖 Generated with Claude Code