Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ecc384852 | |||
| 5c8c74e9b3 | |||
| 0d7eb0f086 | |||
| f79176dbb6 | |||
| 34eada90b2 | |||
| ea8692a2bd | |||
| 3278654c14 | |||
| 394b455f1d | |||
| 7a71484c95 | |||
| d00059fbe0 | |||
| 376461b762 | |||
| a1a3ccc72e | |||
| c2c0770260 | |||
| 1ba28fb87c | |||
| 747660d9f4 | |||
| 9f5efdd8a8 | |||
| ac5a0a63c6 |
@ -1078,6 +1078,9 @@ func TestExecuteDelegation_DeliveryConfirmedProxyError_TreatsAsSuccess(t *testin
|
||||
allowLoopbackForTest(t)
|
||||
|
||||
expectExecuteDelegationBase(mock)
|
||||
// CanCommunicate: workspace hierarchy check added in b9311134; must be mocked
|
||||
// so proxyA2ARequest doesn't return 403 and trigger the failure path.
|
||||
mockCanCommunicate(mock, testSourceID, testTargetID, true)
|
||||
expectExecuteDelegationSuccess(mock, `{"result":{"parts":[{"text":"work completed successfully"}]}}`)
|
||||
|
||||
// Execute synchronously (not as a goroutine) so we can check DB state immediately.
|
||||
@ -1148,6 +1151,9 @@ func TestExecuteDelegation_ProxyErrorNon2xx_RemainsFailed(t *testing.T) {
|
||||
allowLoopbackForTest(t)
|
||||
|
||||
expectExecuteDelegationBase(mock)
|
||||
// CanCommunicate: workspace hierarchy check added in b9311134; must be mocked
|
||||
// so proxyA2ARequest doesn't return 403 and trigger the failure path.
|
||||
mockCanCommunicate(mock, testSourceID, testTargetID, true)
|
||||
expectExecuteDelegationFailed(mock)
|
||||
|
||||
a2aBody, _ := json.Marshal(map[string]interface{}{
|
||||
@ -1195,6 +1201,9 @@ func TestExecuteDelegation_ProxyErrorEmptyBody_RemainsFailed(t *testing.T) {
|
||||
|
||||
// First attempt: updateDelegationStatus(dispatched) — from expectExecuteDelegationBase
|
||||
expectExecuteDelegationBase(mock)
|
||||
// CanCommunicate: workspace hierarchy check added in b9311134; must be mocked
|
||||
// so proxyA2ARequest doesn't return 403 and trigger the failure path.
|
||||
mockCanCommunicate(mock, testSourceID, testTargetID, true)
|
||||
// Second attempt (retry): updateDelegationStatus(dispatched) again
|
||||
mock.ExpectExec("UPDATE activity_logs SET status").
|
||||
WithArgs("dispatched", "", testSourceID, testDelegationID).
|
||||
@ -1243,6 +1252,9 @@ func TestExecuteDelegation_CleanProxyResponse_Unchanged(t *testing.T) {
|
||||
allowLoopbackForTest(t)
|
||||
|
||||
expectExecuteDelegationBase(mock)
|
||||
// CanCommunicate: workspace hierarchy check added in b9311134; must be mocked
|
||||
// so proxyA2ARequest doesn't return 403 and trigger the failure path.
|
||||
mockCanCommunicate(mock, testSourceID, testTargetID, true)
|
||||
expectExecuteDelegationSuccess(mock, `{"result":{"parts":[{"text":"all good"}]}}`)
|
||||
|
||||
a2aBody, _ := json.Marshal(map[string]interface{}{
|
||||
|
||||
@ -26,6 +26,10 @@ func newMCPHandler(t *testing.T) (*MCPHandler, sqlmock.Sqlmock) {
|
||||
t.Helper()
|
||||
mock := setupTestDB(t)
|
||||
h := NewMCPHandler(db.DB, newTestBroadcaster())
|
||||
// Wire memv2 so toolCommitMemory takes the v2 path (where GLOBAL scope
|
||||
// is blocked before any DB call), rather than the legacy shim path
|
||||
// (which calls scopeToWritableNamespace before the scope check).
|
||||
h.withMemoryV2APIs(nil, nil)
|
||||
return h, mock
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user