You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: clean up server_tool_association before tool deletion (#4263)
* fix: clean up server_tool_association before tool deletion
delete_tool() uses a Core SQL DELETE which bypasses ORM cascades.
The server_tool_association FK to tools.id has no ondelete cascade,
so deleting a tool that is associated with a virtual server (e.g. an
A2A agent tool) raises sqlite3.IntegrityError.
Explicitly delete server_tool_association rows for the tool before
the tool row itself, matching the pattern already used in
gateway_service.
Closes#4261
Signed-off-by: Madhav Kandukuri <madhav165@gmail.com>
* fix(tests): update tool delete test to expect association cleanup execute call
delete_tool now calls db.execute twice: once for server_tool_association
cleanup and once for the tool DELETE. The test assertion was stale after
commit 5be84b4 added the association cleanup step.
Signed-off-by: Madhav Kandukuri <madhav165@gmail.com>
* docs(test): correct stale 'DELETE ... RETURNING' docstring in concurrency test
test_concurrent_tool_delete_operations described an 'atomic
DELETE ... RETURNING' implementation that no longer reflects the production
code. delete_tool currently uses get_for_update(nowait=True) to acquire a
row-level lock, then a Core-SQL DELETE with a rowcount check. Update the
docstring so it accurately describes the two paths a losing concurrent
caller can take (lock-conflict 409 or not-found 404).
Signed-off-by: Jonathan Springer <jps@s390x.com>
---------
Signed-off-by: Madhav Kandukuri <madhav165@gmail.com>
Signed-off-by: Jonathan Springer <jps@s390x.com>
Co-authored-by: Jonathan Springer <jps@s390x.com>
0 commit comments