fix(search): warn that --stack is ignored in --design-system mode (#484) (#487)

Merged by github-maintain automation. Closes #484 Finding 1 (priority-1 quick win: silent --stack flag drop in --design-system mode).
This commit is contained in:
Shxiao 2026-09-06 13:31:08 +09:00 committed by GitHub
parent b2ac9b2aa1
commit 314307f156
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 201 additions and 0 deletions

View File

@ -120,6 +120,12 @@ if __name__ == "__main__":
# Design system takes priority
if args.design_system:
if args.stack:
print(
f"note: --stack {args.stack} is ignored in --design-system mode; "
"run a separate --stack query for stack-specific guidelines",
file=sys.stderr,
)
result = generate_design_system(
args.query,
args.project_name,

View File

@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Regression tests for the dropped --stack flag in --design-system mode (issue #484).
`search.py "<query>" --design-system --stack nextjs` used to exit successfully
without any indication that the stack was never applied, so a caller following
SKILL.md's "never assume a stack" guidance could believe stack guidance was
part of the generated design system. The combination must stay valid, but it
must say that --stack was ignored.
Stdlib-only (unittest, not pytest) to match test_core.py -- this project ships
with zero external dependencies.
Run with:
python -m unittest discover -s scripts/tests -v
or directly:
python scripts/tests/test_design_system_stack.py
"""
import subprocess
import sys
import unittest
from pathlib import Path
SCRIPTS_DIR = Path(__file__).resolve().parent.parent
SEARCH = SCRIPTS_DIR / "search.py"
class TestStackFlagWithDesignSystem(unittest.TestCase):
def run_search(self, *args):
# The child forces UTF-8 on its streams (search.py), so decode as UTF-8
# regardless of the parent's locale on Windows.
return subprocess.run(
[sys.executable, str(SEARCH), *map(str, args)],
capture_output=True,
text=True,
encoding="utf-8",
errors="replace",
check=False,
)
def test_design_system_with_stack_succeeds_and_says_stack_is_ignored(self):
proc = self.run_search("platform engineer dashboard", "--design-system", "--stack", "nextjs")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertIn("--stack", proc.stderr)
self.assertIn("ignored", proc.stderr.lower())
def test_design_system_without_stack_stays_quiet(self):
proc = self.run_search("platform engineer dashboard", "--design-system")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertNotIn("ignored", proc.stderr.lower())
def test_stack_search_alone_never_warns(self):
proc = self.run_search("dashboard table density", "--stack", "nextjs")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertNotIn("ignored", proc.stderr.lower())
if __name__ == "__main__":
unittest.main(verbosity=2)

View File

@ -120,6 +120,12 @@ if __name__ == "__main__":
# Design system takes priority
if args.design_system:
if args.stack:
print(
f"note: --stack {args.stack} is ignored in --design-system mode; "
"run a separate --stack query for stack-specific guidelines",
file=sys.stderr,
)
result = generate_design_system(
args.query,
args.project_name,

View File

@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Regression tests for the dropped --stack flag in --design-system mode (issue #484).
`search.py "<query>" --design-system --stack nextjs` used to exit successfully
without any indication that the stack was never applied, so a caller following
SKILL.md's "never assume a stack" guidance could believe stack guidance was
part of the generated design system. The combination must stay valid, but it
must say that --stack was ignored.
Stdlib-only (unittest, not pytest) to match test_core.py -- this project ships
with zero external dependencies.
Run with:
python -m unittest discover -s scripts/tests -v
or directly:
python scripts/tests/test_design_system_stack.py
"""
import subprocess
import sys
import unittest
from pathlib import Path
SCRIPTS_DIR = Path(__file__).resolve().parent.parent
SEARCH = SCRIPTS_DIR / "search.py"
class TestStackFlagWithDesignSystem(unittest.TestCase):
def run_search(self, *args):
# The child forces UTF-8 on its streams (search.py), so decode as UTF-8
# regardless of the parent's locale on Windows.
return subprocess.run(
[sys.executable, str(SEARCH), *map(str, args)],
capture_output=True,
text=True,
encoding="utf-8",
errors="replace",
check=False,
)
def test_design_system_with_stack_succeeds_and_says_stack_is_ignored(self):
proc = self.run_search("platform engineer dashboard", "--design-system", "--stack", "nextjs")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertIn("--stack", proc.stderr)
self.assertIn("ignored", proc.stderr.lower())
def test_design_system_without_stack_stays_quiet(self):
proc = self.run_search("platform engineer dashboard", "--design-system")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertNotIn("ignored", proc.stderr.lower())
def test_stack_search_alone_never_warns(self):
proc = self.run_search("dashboard table density", "--stack", "nextjs")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertNotIn("ignored", proc.stderr.lower())
if __name__ == "__main__":
unittest.main(verbosity=2)

View File

@ -120,6 +120,12 @@ if __name__ == "__main__":
# Design system takes priority
if args.design_system:
if args.stack:
print(
f"note: --stack {args.stack} is ignored in --design-system mode; "
"run a separate --stack query for stack-specific guidelines",
file=sys.stderr,
)
result = generate_design_system(
args.query,
args.project_name,

View File

@ -0,0 +1,61 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Regression tests for the dropped --stack flag in --design-system mode (issue #484).
`search.py "<query>" --design-system --stack nextjs` used to exit successfully
without any indication that the stack was never applied, so a caller following
SKILL.md's "never assume a stack" guidance could believe stack guidance was
part of the generated design system. The combination must stay valid, but it
must say that --stack was ignored.
Stdlib-only (unittest, not pytest) to match test_core.py -- this project ships
with zero external dependencies.
Run with:
python -m unittest discover -s scripts/tests -v
or directly:
python scripts/tests/test_design_system_stack.py
"""
import subprocess
import sys
import unittest
from pathlib import Path
SCRIPTS_DIR = Path(__file__).resolve().parent.parent
SEARCH = SCRIPTS_DIR / "search.py"
class TestStackFlagWithDesignSystem(unittest.TestCase):
def run_search(self, *args):
# The child forces UTF-8 on its streams (search.py), so decode as UTF-8
# regardless of the parent's locale on Windows.
return subprocess.run(
[sys.executable, str(SEARCH), *map(str, args)],
capture_output=True,
text=True,
encoding="utf-8",
errors="replace",
check=False,
)
def test_design_system_with_stack_succeeds_and_says_stack_is_ignored(self):
proc = self.run_search("platform engineer dashboard", "--design-system", "--stack", "nextjs")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertIn("--stack", proc.stderr)
self.assertIn("ignored", proc.stderr.lower())
def test_design_system_without_stack_stays_quiet(self):
proc = self.run_search("platform engineer dashboard", "--design-system")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertNotIn("ignored", proc.stderr.lower())
def test_stack_search_alone_never_warns(self):
proc = self.run_search("dashboard table density", "--stack", "nextjs")
self.assertEqual(proc.returncode, 0, proc.stderr)
self.assertNotIn("ignored", proc.stderr.lower())
if __name__ == "__main__":
unittest.main(verbosity=2)