fix: don't read '3d'/'2fa' after a stack name as a framework version (#548)

The version pattern in _stack_query_requests_legacy had no trailing
boundary, so 'react 3d ...' parsed as React 3 and the query got only
deprecated rows (or none, for stacks without legacy guidance).

Fixes #547
This commit is contained in:
Jallepalli Harsha Vardhan 2026-10-26 15:37:27 +05:30 committed by GitHub
parent 1f8857914d
commit 28b3b8dee8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 45 additions and 3 deletions

View File

@ -856,7 +856,7 @@ def _stack_query_requests_legacy(query, stack):
if current_version is not None and stack_name is not None:
matches = re.finditer(
rf"\b(?:{stack_name})\s*(?:sdk|ui)?\s*(?:[@(]\s*)?(?:v(?:ersion)?\s*)?"
rf"(\d+)(?:\.(\d+))?\s*\)?",
rf"(\d+)(?:\.(\d+))?(?!\w)\s*\)?",
normalized,
)
requested_versions = [

View File

@ -116,6 +116,20 @@ class TestWebStackFreshness(unittest.TestCase):
{row["Status"] for row in result["results"]}, {"deprecated"}
)
def test_number_starting_a_word_is_not_a_version(self):
cases = {
"react": "react 3d canvas effect cleanup",
"html-tailwind": "tailwind 2xl breakpoint",
"angular": "angular 2fa login form",
}
for stack, query in cases.items():
with self.subTest(stack=stack, query=query):
result = search_stack(query, stack)
self.assertGreater(result["count"], 0)
self.assertNotIn(
"deprecated", {row["Status"] for row in result["results"]}
)
def test_old_major_without_curated_legacy_guidance_abstains(self):
result = search_stack("Astro 5 content collections", "astro")
self.assertEqual(result["count"], 0)

View File

@ -856,7 +856,7 @@ def _stack_query_requests_legacy(query, stack):
if current_version is not None and stack_name is not None:
matches = re.finditer(
rf"\b(?:{stack_name})\s*(?:sdk|ui)?\s*(?:[@(]\s*)?(?:v(?:ersion)?\s*)?"
rf"(\d+)(?:\.(\d+))?\s*\)?",
rf"(\d+)(?:\.(\d+))?(?!\w)\s*\)?",
normalized,
)
requested_versions = [

View File

@ -116,6 +116,20 @@ class TestWebStackFreshness(unittest.TestCase):
{row["Status"] for row in result["results"]}, {"deprecated"}
)
def test_number_starting_a_word_is_not_a_version(self):
cases = {
"react": "react 3d canvas effect cleanup",
"html-tailwind": "tailwind 2xl breakpoint",
"angular": "angular 2fa login form",
}
for stack, query in cases.items():
with self.subTest(stack=stack, query=query):
result = search_stack(query, stack)
self.assertGreater(result["count"], 0)
self.assertNotIn(
"deprecated", {row["Status"] for row in result["results"]}
)
def test_old_major_without_curated_legacy_guidance_abstains(self):
result = search_stack("Astro 5 content collections", "astro")
self.assertEqual(result["count"], 0)

View File

@ -856,7 +856,7 @@ def _stack_query_requests_legacy(query, stack):
if current_version is not None and stack_name is not None:
matches = re.finditer(
rf"\b(?:{stack_name})\s*(?:sdk|ui)?\s*(?:[@(]\s*)?(?:v(?:ersion)?\s*)?"
rf"(\d+)(?:\.(\d+))?\s*\)?",
rf"(\d+)(?:\.(\d+))?(?!\w)\s*\)?",
normalized,
)
requested_versions = [

View File

@ -116,6 +116,20 @@ class TestWebStackFreshness(unittest.TestCase):
{row["Status"] for row in result["results"]}, {"deprecated"}
)
def test_number_starting_a_word_is_not_a_version(self):
cases = {
"react": "react 3d canvas effect cleanup",
"html-tailwind": "tailwind 2xl breakpoint",
"angular": "angular 2fa login form",
}
for stack, query in cases.items():
with self.subTest(stack=stack, query=query):
result = search_stack(query, stack)
self.assertGreater(result["count"], 0)
self.assertNotIn(
"deprecated", {row["Status"] for row in result["results"]}
)
def test_old_major_without_curated_legacy_guidance_abstains(self):
result = search_stack("Astro 5 content collections", "astro")
self.assertEqual(result["count"], 0)