@@ -160,6 +160,25 @@ describe("tool search gateway e2e lane assertions", () => {
|
160 | 160 | ).toThrow(`code lane did not bridge-call ${targetTool}`); |
161 | 161 | }); |
162 | 162 | |
| 163 | +it("rejects code lane proof that also exposes the direct target tool", () => { |
| 164 | +expect(() => |
| 165 | +assertToolSearchLaneResults({ |
| 166 | + normal, |
| 167 | + targetTool, |
| 168 | +code: { |
| 169 | +gatewayOutputText: `FAKE_PLUGIN_OK ${targetTool}`, |
| 170 | +providerDeclaredToolCount: 2, |
| 171 | +providerPlannedTools: ["tool_search_code", targetTool], |
| 172 | +providerRawBytes: 4_000, |
| 173 | +sessionLogToolMentions: { |
| 174 | +tool_search_code: 1, |
| 175 | +[targetTool]: 1, |
| 176 | +}, |
| 177 | +}, |
| 178 | +}), |
| 179 | +).toThrow(`code lane exposed direct provider tool ${targetTool}`); |
| 180 | +}); |
| 181 | + |
163 | 182 | it("rejects normal lane output that only echoes the target tool name", () => { |
164 | 183 | expect(() => |
165 | 184 | assertToolSearchLaneResults({ |
@@ -183,4 +202,30 @@ describe("tool search gateway e2e lane assertions", () => {
|
183 | 202 | }), |
184 | 203 | ).toThrow(`normal lane did not call ${targetTool}`); |
185 | 204 | }); |
| 205 | + |
| 206 | +it("rejects normal lane proof that uses the Tool Search bridge", () => { |
| 207 | +expect(() => |
| 208 | +assertToolSearchLaneResults({ |
| 209 | + targetTool, |
| 210 | +normal: { |
| 211 | + ...normal, |
| 212 | +providerPlannedTools: [targetTool, "tool_search_code"], |
| 213 | +sessionLogToolMentions: { |
| 214 | +tool_search_code: 1, |
| 215 | +[targetTool]: 1, |
| 216 | +}, |
| 217 | +}, |
| 218 | +code: { |
| 219 | +gatewayOutputText: `FAKE_PLUGIN_OK ${targetTool}`, |
| 220 | +providerDeclaredToolCount: 1, |
| 221 | +providerPlannedTools: ["tool_search_code"], |
| 222 | +providerRawBytes: 4_000, |
| 223 | +sessionLogToolMentions: { |
| 224 | +tool_search_code: 1, |
| 225 | +[targetTool]: 1, |
| 226 | +}, |
| 227 | +}, |
| 228 | +}), |
| 229 | +).toThrow("normal lane unexpectedly used Tool Search bridge"); |
| 230 | +}); |
186 | 231 | }); |