Repository navigation
fix: read PRIOMPT_TOKEN, regenerate stubs from priompt/proto, scrub name - #9
Merged
Merged
Conversation
- PromptClient now reads PRIOMPT_TOKEN. Precedence matches the priompt CLI: token=, then PRIOMPT_TOKEN, then the token in url=/PRIOMPT_URL. - Regenerate prompt_pb2.py from priompt/proto (e7dce07). The embedded descriptor carried the old go_package (priomptproto/gen/...); it now says github.com/priompt/proto/gen/priompt/v1. prompt_pb2_grpc.py regenerates byte-identical (after the documented import fix), and the wire paths are unchanged. - Pin the protobuf plugin to v35.1 in buf.gen.yaml so regenerated gencode keeps working with the protobuf>=7.35 floor (unpinned, it now emits 7.36.2 gencode, which rejects an older runtime). - README: use "Ada" in the example instead of a real name; document the token default. Fixes #5 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.
What was wrong
PromptClientignoredPRIOMPT_TOKEN, so a client with onlyPRIOMPT_TOKENset gotUNAUTHENTICATED. The priompt CLI reads that variable.prompt_pb2.pydescriptor still carried the oldgo_package(priomptproto/gen/priompt/v1;priomptv1).Fix
token=, thenPRIOMPT_TOKEN, then the token inurl=/PRIOMPT_URL. That's the same order as the priompt CLI (authCtxprefersPRIOMPT_TOKENover the URL token).buf generatefrompriompt/proto@e7dce07, then applied the documented relocation and import fix.prompt_pb2.pychanges only in the serialized descriptor and thego_packageoption, which is nowgithub.com/priompt/proto/gen/priompt/v1;priomptv1.prompt_pb2_grpc.pyregenerates byte-identical, so it is unchanged. The wire paths/priompt.v1.PromptService/*are untouched.buf.gen.yamlnow pinsbuf.build/protocolbuffers/python:v35.1. Unpinned, the plugin now emits 7.36.2 gencode, which would reject theprotobuf>=7.35runtimes thatpyproject.tomlallows. With the pin, the gencode stays at 7.35.1.name="Sujal"is nowname="Ada", and thetokenrow documents thePRIOMPT_TOKENdefault.Tests
New tests are
test_reads_priompt_token_envandtest_token_precedence.Real run against
priompt v0.7.2 servewithPRIOMPT_TOKEN=admintokon the server. The client hasPRIOMPT_TOKEN=admintokin its environment and notoken=:Before:
After (this also exercises the regenerated stub over the wire):
With
PRIOMPT_TOKEN=wrong, the client still getsUNAUTHENTICATED, as expected.Expected conflict
#7 (fix for #3) also appends tests at the end of
tests/test_client.pyand edits other lines ofREADME.md. Whichever merges second needs a trivial rebase. Keep both test blocks.Fixes #5
🤖 Generated with Claude Code