Repository navigation
feat: omni_sk_live_/omni_sk_test_ API key prefixes and test_mode - #77
Merged
Merged
Conversation
Replaces the single omni_sk_ prefix with omni_sk_live_/omni_sk_test_, chosen per key at creation (ApiKeyCreate.test, both routers). A key's mode is derived from its already-stored, non-secret key_prefix (is_test_key) rather than a new DB column. exchange_api_key now reports test_mode in its response, so the gateway can serve a canned, unbilled response instead of forwarding to RAG -- see the matching omnibioai-api-gateway change. Every key issued before this migration keeps the bare omni_sk_ prefix and is unambiguously live. Co-Authored-By: Claude Sonnet 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
Closes the first of gap #9's two remaining sub-items (the other, test-mode's canned/unbilled gateway behavior, is a paired PR in omnibioai-api-gateway).
ApiKeyCreate.test(defaultFalse) lets a caller request a sandbox key -- both/orgs/{org_id}/api-keysand/me/api-keys-- issued asomni_sk_test_...instead ofomni_sk_live_....apikey_service.is_test_key()derives mode from the already-stored, non-secretkey_prefixrather than a new DB column -- no migration needed.exchange_api_keynow reportstest_modein its response;ApiKeyOut/ApiKeyCreatedreporttestso a key's mode is visible wherever it's listed.omni_sk_prefix (_PREFIX, unchanged) and is unambiguously live --is_test_keyonly matches the newomni_sk_test_prefix.Test plan
pytest tests/test_apikeys.py tests/test_me_api_keys.py tests/test_apikey_exchange.py-- 48 passed, including live-by-default, explicit test-key creation (both routers),test_modepropagation through exchange, and a pre-M13 legacy bare-prefix key still exchanging successfully as non-test🤖 Generated with Claude Code