Skip to content

Delete cloudhook on config entry removal - #317

Merged
jbergler merged 1 commit into
developfrom
fix-316-cloudhook-leak-on-removal
Jul 25, 2026
Merged

Delete cloudhook on config entry removal#317
jbergler merged 1 commit into
developfrom
fix-316-cloudhook-leak-on-removal

Conversation

@jbergler

Copy link
Copy Markdown
Owner

Summary

  • async_remove_entry now calls cloud.async_delete_cloudhook when a TTLock config entry is removed, closing a permanent leak in Nabu Casa cloud prefs for cloud users
  • Checks that no sibling config entry still shares the removed entry's webhook_id (entries can share one webhook per developer application, see docs/adr/0002-shared-webhook-per-developer-application.md) before deleting
  • Suppresses ValueError alongside cloud.CloudNotAvailable, since hass_nabucasa raises a bare ValueError when the webhook_id was never actually converted to a cloudhook — same gap HA core's mobile_app integration already works around

Fixes #316

Test plan

  • script/check passes (lint, type-check, 251 tests)
  • New tests cover all three acceptance criteria: last-entry-sharing removal deletes the cloudhook, removal of one of several sharing entries does not, and removal is a no-op (not an error) both for non-cloud users and for cloud users whose webhook was never converted to a cloudhook

🤖 Generated with Claude Code

https://claude.ai/code/session_01PvyPWXq9s7xw1L3fkphDGc

async_remove_entry now calls cloud.async_delete_cloudhook once no
sibling config entry still shares the removed entry's webhook_id,
preventing a permanent leak in Nabu Casa cloud prefs on uninstall.
Suppresses ValueError alongside CloudNotAvailable, since
hass_nabucasa raises a bare ValueError when the webhook_id was never
actually converted to a cloudhook - same gap mobile_app's
async_remove_entry already works around.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PvyPWXq9s7xw1L3fkphDGc
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.00%. Comparing base (aee79af) to head (f037b3f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
custom_components/ttlock/__init__.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #317      +/-   ##
===========================================
+ Coverage    95.97%   96.00%   +0.03%     
===========================================
  Files           17       17              
  Lines         1589     1602      +13     
===========================================
+ Hits          1525     1538      +13     
  Misses          64       64              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@jbergler
jbergler merged commit 18c9ad6 into develop Jul 25, 2026
7 of 8 checks passed
@jbergler
jbergler deleted the fix-316-cloudhook-leak-on-removal branch July 25, 2026 20:31
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.

Cloudhook is leaked in Nabu Casa cloud prefs on integration removal

1 participant