Skip to content

fix: avoid traceback for absent keyring entries - #7

Open
UglyEgg wants to merge 1 commit into
ProtonVPN:stablefrom
UglyEgg:contrib/missing-entry-logging
Open

UglyEgg wants to merge 1 commit into
ProtonVPN:stablefrom
UglyEgg:contrib/missing-entry-logging

Conversation

@UglyEgg

@UglyEgg UglyEgg commented Sep 13, 2026

Copy link
Copy Markdown

Problem

KeyringBackendLinux._del_item deliberately translates PasswordDeleteError into KeyError when an entry is already absent, but first logs the expected condition as an internal failure with a traceback. This makes routine cleanup look like a backend fault and obscures actionable errors.

Change

Log the already-absent condition at debug level without exception information. Preserve the existing KeyError result and retain error-level traceback logging for every other KeyringError.

Verification

  • The regression test asserts that an absent entry still raises KeyError, produces the diagnostic debug message, and emits no error-level record.
  • A separate assertion confirms that a genuine keyring failure still produces an error record with exception information.
  • Complete upstream suite: 21 passed.
  • ruff check and git diff --check pass.

No public API, storage format, provider selection, or authentication behavior changes.

Development disclosure: I developed this patch with material assistance from OpenAI Codex under my direction, then reviewed, tested, and signed the final change.

Deleting an entry that is already absent is translated to KeyError by the existing mapping contract, but it is currently logged as an internal failure with a traceback.

Log the expected condition at debug level while preserving error-level traceback logging for other keyring failures. Add regression assertions for both paths.

Development disclosure: I developed this patch with material assistance from OpenAI Codex under my direction, then reviewed, tested, and signed the final change.
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