fix(config): honor AEVS_RECEIPT_VISIBILITY env var fallback#17
Open
web3guru888 wants to merge 1 commit into
Open
fix(config): honor AEVS_RECEIPT_VISIBILITY env var fallback#17web3guru888 wants to merge 1 commit into
web3guru888 wants to merge 1 commit into
Conversation
The `receipt_visibility` parameter of `configure()` defaulted to the
truthy string "private", so the expression
receipt_visibility or os.environ.get("AEVS_RECEIPT_VISIBILITY", "private")
always short-circuited on the parameter and never consulted the
environment variable. This contradicted the documented behavior
("Falls back to AEVS_RECEIPT_VISIBILITY", docs/08-api-reference.md and
docs/06-receipt-verification.md), making the env var effectively dead
code.
Default the parameter to None so resolution precedence becomes
explicit argument -> AEVS_RECEIPT_VISIBILITY -> "private". An invalid
value from either source continues to warn and fall back to "private"
via _sanitize_config (never raises to host code). Update the docstring
to document the fallback.
Adds TestReceiptVisibility regression coverage: default, explicit
param, env fallback, param-precedence-over-env, case-insensitivity,
and invalid-value warn-and-fallback.
Signed-off-by: Robin Dey <robin@vbrl.ai>
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.
fix(config): honor AEVS_RECEIPT_VISIBILITY env var fallback
What
configure(receipt_visibility=...)defaulted to the truthy string"private",so the resolution expression
always short-circuited on the parameter and never read the
AEVS_RECEIPT_VISIBILITYenvironment variable. The env var was effectivelydead code.
Why it matters
The documentation states the option falls back to the env var:
docs/08-api-reference.md— "Falls back to environment variables forapi_key,agent_id, andreceipt_visibility"docs/06-receipt-verification.md— "You can also set this via theAEVS_RECEIPT_VISIBILITYenvironment variable."docs/03-configuration.md— listsAEVS_RECEIPT_VISIBILITY → receipt_visibilityin the env-var table.A user setting
AEVS_RECEIPT_VISIBILITY=proof_only(e.g. to keep inputs/outputsoff the wire in production) silently got
privateinstead — a privacy-relevantsurprise.
The fix
Default the parameter to
Noneso the existingorexpression resolves withthe intended precedence: explicit argument →
AEVS_RECEIPT_VISIBILITY→"private".The resolution site is unchanged —
Noneis falsy, so precedence now works asdocumented. The docstring is updated. The "never raise to host code" contract is
preserved: an invalid value from either source still warns and falls back to
"private"via_sanitize_config.Tests
New
tests/test_config.py::TestReceiptVisibility(6 cases): default,explicit-param, env fallback, explicit-param-beats-env, case-insensitivity, and
invalid-value warn-and-fallback. The env-fallback / case / invalid cases fail on
mainand pass with this change.Verification
make checkon this branch:pytest: 498 passed, 2 skipped (492 baseline + 6 new)ruff check: cleanmypy --strict: clean (22 files)Closes the documented-vs-actual behavior gap for
receipt_visibility.