Compare commits

..

6 Commits

Author SHA1 Message Date
pzhang_zywl e65623e29d fix: switch image model from qwen3-vl-plus to qwen3.6-flash - Closes #88
CI / test (pull_request) Successful in 9s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 14:54:11 +08:00
pzhang_zywl bdef679c2b Merge pull request 'fix: [product] _normalize_rule 增加 screen_type 默认值防御 + step2 test 降级 warn - Closes #86' (#87) from dev/issue-86-screen-type-defense into main
CI / test (push) Waiting to run
2026-06-03 14:44:47 +08:00
pzhang_zywl f7f00091a6 fix: _normalize_rule adds screen_type/geo defaults + step2 test downgrades to warn - Closes #86
CI / test (pull_request) Successful in 10s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 14:44:11 +08:00
pzhang_zywl 34c27cbf38 Merge pull request 'fix: [bug] run_pipeline.py subprocess GBK encoding causes stdout=None on Windows - Closes #84' (#85) from dev/issue-84-encoding-fix into main
CI / test (push) Waiting to run
2026-06-03 14:41:20 +08:00
pzhang_zywl a5f3efc555 fix: subprocess encoding=utf-8 to prevent GBK stdout crash on Windows - Closes #84
CI / test (pull_request) Successful in 10s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 14:39:55 +08:00
pzhang_zywl 5b27f86890 Merge pull request 'fix: [test] QE-Agent session 2026-06-02 收尾:更新 GLOBAL_STATE.md - Closes #82' (#83) from test/issue-82 into main
CI / test (push) Successful in 13s
2026-06-02 20:07:56 +08:00
6 changed files with 65 additions and 7 deletions
+5 -1
View File
@@ -83,7 +83,7 @@ def run_ir_pipeline(parsed_path: str) -> str | None:
result = subprocess.run(
[sys.executable, str(script_path)],
cwd=str(PROJECT_ROOT),
capture_output=True, text=True,
capture_output=True, text=True, encoding="utf-8",
env=env,
)
if result.returncode != 0:
@@ -111,6 +111,8 @@ def run_acceptance_tests(parsed_json_path: str) -> int:
print("[3/3] Running QE acceptance tests...")
test_dir = PROJECT_ROOT / "tests" / "acceptance"
env = os.environ.copy()
env.setdefault("PYTHONIOENCODING", "utf-8")
result = subprocess.run(
[
sys.executable, "-m", "pytest", str(test_dir),
@@ -120,6 +122,8 @@ def run_acceptance_tests(parsed_json_path: str) -> int:
"--tb=short",
],
cwd=str(PROJECT_ROOT),
encoding="utf-8",
env=env,
)
return result.returncode
@@ -63,7 +63,7 @@ class LLMClient:
print(llm.usage)
"""
IMAGE_MODEL = "qwen3-vl-plus"
IMAGE_MODEL = "qwen3.6-flash"
TEXT_MODEL = "deepseek-v4-flash"
DASHSCOPE_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
@@ -72,7 +72,7 @@ class LLMClient:
TIMEOUT = 120
MAX_RETRIES = 3
_VISION_KEYWORDS = ("vl", "vision", "qwen-vl", "qwen3-vl")
_VISION_KEYWORDS = ("vl", "vision", "qwen-vl", "qwen3-vl", "qwen3.6")
def __init__(
self,
+2 -2
View File
@@ -63,7 +63,7 @@ class LLMClient:
print(llm.usage)
"""
IMAGE_MODEL = "qwen3-vl-plus"
IMAGE_MODEL = "qwen3.6-flash"
TEXT_MODEL = "deepseek-v4-flash"
DASHSCOPE_BASE = "https://dashscope.aliyuncs.com/compatible-mode/v1"
@@ -72,7 +72,7 @@ class LLMClient:
TIMEOUT = 120
MAX_RETRIES = 3
_VISION_KEYWORDS = ("vl", "vision", "qwen-vl", "qwen3-vl")
_VISION_KEYWORDS = ("vl", "vision", "qwen-vl", "qwen3-vl", "qwen3.6")
def __init__(
self,
@@ -134,6 +134,18 @@ def _normalize_rule(rule: dict) -> dict:
Fixes common LLM output issues: missing trigger, null operator, etc.
"""
# Ensure precondition has required fields (defensive against LLM omission)
if "precondition" not in rule:
rule["precondition"] = {}
precond = rule["precondition"]
if precond is None:
rule["precondition"] = {}
precond = rule["precondition"]
if "geographic_scope" not in precond or not precond["geographic_scope"]:
precond["geographic_scope"] = "global"
if "screen_type" not in precond:
precond["screen_type"] = "any"
# Ensure trigger exists
if not rule.get("trigger"):
rule["trigger"] = {}
@@ -351,12 +351,15 @@ def test_step2_rule_paths():
def test_step2_precondition_fields():
"""pytest: every rule must have precondition with geographic_scope and screen_type."""
"""Warn: rules missing precondition fields (depends on LLM output, defense in step3)."""
fragments = _load_fragments_or_skip()
if fragments is None:
pytest.skip("ir_fragments.json not found")
errors = check_precondition_fields(fragments)
assert not errors, f"precondition errors: {errors[:5]}"
if errors:
print(f"\n[WARN] {len(errors)} 个规则缺少 precondition 字段 (LLM 输出变异,step3 _normalize_rule 兜底)")
for e in errors[:5]:
print(f" - {e}")
def test_step2_user_interaction_content():
@@ -575,3 +575,42 @@ class TestNormalizeRule:
}
normalized = _normalize_rule(rule)
assert normalized["sources"][0]["section"] == "4.2 关闭流程"
def test_normalize_precondition_missing_screen_type(self):
"""Missing screen_type defaults to 'any'."""
rule = {
"trigger": {"conditions": [{"signal": "x", "operator": "==", "value": "1"}]},
"precondition": {"geographic_scope": "国内"},
}
normalized = _normalize_rule(rule)
assert normalized["precondition"]["screen_type"] == "any"
assert normalized["precondition"]["geographic_scope"] == "国内"
def test_normalize_precondition_missing_geo(self):
"""Missing geographic_scope defaults to 'global'."""
rule = {
"trigger": {"conditions": [{"signal": "x", "operator": "==", "value": "1"}]},
"precondition": {"screen_type": "cluster"},
}
normalized = _normalize_rule(rule)
assert normalized["precondition"]["geographic_scope"] == "global"
assert normalized["precondition"]["screen_type"] == "cluster"
def test_normalize_precondition_none(self):
"""None precondition is replaced with defaults."""
rule = {
"trigger": {"conditions": [{"signal": "x", "operator": "==", "value": "1"}]},
"precondition": None,
}
normalized = _normalize_rule(rule)
assert normalized["precondition"]["screen_type"] == "any"
assert normalized["precondition"]["geographic_scope"] == "global"
def test_normalize_precondition_missing(self):
"""Missing precondition key gets defaults."""
rule = {
"trigger": {"conditions": [{"signal": "x", "operator": "==", "value": "1"}]},
}
normalized = _normalize_rule(rule)
assert normalized["precondition"]["screen_type"] == "any"
assert normalized["precondition"]["geographic_scope"] == "global"