Skip to content

test: assert notification rule secrets stay out of SDK debug trace and exceptions - #700

Draft
sophiecarreras wants to merge 1 commit into
masterfrom
qk-nonexposure-tests
Draft

sophiecarreras wants to merge 1 commit into
masterfrom
qk-nonexposure-tests

Conversation

@sophiecarreras

Copy link
Copy Markdown
Contributor

Summary

Adds unit tests proving the signing secret and a custom header value of a notification rule never appear in the SDK DEBUG trace or in exception text raised by Bucket.set_notification_rules, on four paths: success, pre-authorization, API error and validation error. One test per (surface, path), parametrized over the two inputs; 16 cases.

  • API error: the real B2RawHTTPApi over a faked HTTP session answering 400.
  • Pre-authorization: account info cleared after the bucket is created.
  • Validation error: a request that cannot be serialized (eventTypes as a set), which fails locally before anything is sent.
  • Success x exception: nothing is raised, so that test is weaker by nature; it asserts the call does not raise. This is stated in the module docstring.
  • On success, pre-authorization and validation paths the SDK writes little to the DEBUG log, so those tests also emit a marker record to prove capture is live.

No production code changed and no real leak was found.

Verification

  • pytest --api=v0..v3 on the new file: 16 passed each; pytest --api=v3 test/unit: 1244 passed, 77 skipped, 25 xfailed; ruff check and ruff format --check clean.
  • Non-vacuity: a temporary logger.debug of the rules in Bucket.set_notification_rules failed all 8 debug-trace cases; a temporary re-raise embedding the rules failed the exception cases on the failure paths (and the validation debug-trace cases, via the exception type). Both reverted.
  • Quality Keeper local run: notification_rule_set missing cells (surfaces, paths, inputs) went from all missing to none missing; expectation state moved from missing to pending_run (a bound run is a separate criterion).

🤖 Generated with Claude Code

…d exceptions

Covers Bucket.set_notification_rules for the signing secret and a custom
header value on the success, pre-authorization, API error and validation
error paths.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant