From 793529467dd2db1c9c854e7cb3563d5523906771 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Tue, 15 Sep 2026 14:45:50 -0700 Subject: [PATCH] test(web): make the redirect cache-key test bite on positional pairing The redirect test used a single requested URL, so main's positional zip(fetch_urls, results) happened to key it correctly and the test only pinned. Omit the first requested URL and redirect the second: positional pairing now files the page under the wrong requested URL, while the metadata.sourceURL key still lands on the right one. --- tests/tools/test_web_tools_tavily.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/tools/test_web_tools_tavily.py b/tests/tools/test_web_tools_tavily.py index fd5412a1f9..ae6c8ff52c 100644 --- a/tests/tools/test_web_tools_tavily.py +++ b/tests/tools/test_web_tools_tavily.py @@ -174,7 +174,9 @@ class TestWebExtractCacheAttribution: def test_redirected_page_caches_under_requested_source_url(self): """Keenable/Firecrawl report the post-redirect address in ``url`` and the requested URL in - ``metadata.sourceURL``; the cache key must stay the requested URL, never the redirect target.""" + ``metadata.sourceURL``; the cache key must stay the requested URL, never the redirect target. + The first requested page is omitted, so positional pairing would file the redirected page + under the wrong requested URL.""" from tools import web_tools_extract as wte class _RedirectProvider: @@ -182,10 +184,11 @@ class TestWebExtractCacheAttribution: async def extract(self, urls, format=None): return [{"url": "https://www.example.com/moved", "raw_content": "moved page", "title": "Moved", - "metadata": {"sourceURL": urls[0]}}] + "metadata": {"sourceURL": urls[1]}}] + urls = ["https://example.com/failed", "https://example.com/old"] with patch("tools.web_result_cache.extract_cache_put") as cache_put: - asyncio.run(wte._dispatch_extract(_RedirectProvider(), ["https://example.com/old"], None)) + asyncio.run(wte._dispatch_extract(_RedirectProvider(), urls, None)) cache_put.assert_called_once_with( "https://example.com/old", "moved page", "Moved", format=None, provider="keenable"