Skip to content

Comments

remote: fix StoreObjectNotFound exception lost over RPC, fixes #9380#9381

Open
mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
mr-raj12:fix-remote-store-object-not-found
Open

remote: fix StoreObjectNotFound exception lost over RPC, fixes #9380#9381
mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
mr-raj12:fix-remote-store-object-not-found

Conversation

@mr-raj12
Copy link
Contributor

Summary

  • RemoteRepository RPC layer serializes exceptions using e.__class__.__name__, but both borgstore.store.ObjectNotFound and Repository.ObjectNotFound share __name__ == "ObjectNotFound"
  • Client-side handle_error always reconstructs Repository.ObjectNotFound, even when the server actually raised StoreObjectNotFound from a store_load()/store_delete() call
  • This was already acknowledged with TODO comments at 3 sites in cache.py: # TODO: ^ seem like RemoteRepository raises Repository.ONF instead of StoreONF
  • Fix: distinguish StoreObjectNotFound during server-side serialization and reconstruct it correctly on the client side

Fixes #9380

Changes

File Change
src/borg/remote.py Import StoreObjectNotFound; serialize it as "StoreObjectNotFound" (not ambiguous "ObjectNotFound") on the server side; add client-side handle_error branch to reconstruct it; add inject_exception test hook
src/borg/cache.py Simplify 3 except clauses from (Repository.ObjectNotFound, StoreObjectNotFound) to StoreObjectNotFound; remove TODO comments
src/borg/testsuite/repository_test.py Add StoreObjectNotFound round-trip test in test_remote_rpc_exception_transport

Backward compatibility note

This changes the RPC wire format for StoreObjectNotFound:

  • Old server → new client: old server sends "ObjectNotFound", new client raises Repository.ObjectNotFound - cache.py callers would miss it. In practice, store_* methods are borg2-only and borg2 is in beta, so mixed-version deployments are not a supported scenario.
  • New server → old client: old client falls through to RPCError fallback.

Checklist

  • PR is against master
  • New code has tests
  • Tests pass
  • Commit message references related issue
  • Code formatted with black

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.47%. Comparing base (cace06f) to head (1935d75).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/cache.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9381      +/-   ##
==========================================
+ Coverage   76.44%   76.47%   +0.03%     
==========================================
  Files          85       85              
  Lines       14799    14801       +2     
  Branches     2212     2213       +1     
==========================================
+ Hits        11313    11319       +6     
+ Misses       2808     2804       -4     
  Partials      678      678              

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

Copy link
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, some TODOs less!

@mr-raj12 mr-raj12 force-pushed the fix-remote-store-object-not-found branch from d406fe2 to 1935d75 Compare February 20, 2026 17:38
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.

remote: RemoteRepository raises Repository.ObjectNotFound instead of StoreObjectNotFound

2 participants