fix: Script bug fixes (bare except, timezone, regex, test)

- collector.py, compliance_checker.py, trends.py: bare except -> specific
- db_helper.py: datetime.now() -> timezone.utc (8 occurrences)
- compliance_checker.py: regex \x08 -> \b word boundary + import json
- search_providers.py: minor fixes
- test_new_features.py: service reachability check retry

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Yuzhiran Dev
2026-06-16 08:24:50 +08:00
parent d601a26850
commit 63a6fabc00
6 changed files with 33 additions and 30 deletions
+10 -7
View File
@@ -46,14 +46,17 @@ def start_server():
t = threading.Thread(target=start_server, daemon=True)
t.start()
time.sleep(4)
base = "http://127.0.0.1:18503"
try:
r = requests.get(f"{base}/api/system/status", timeout=5)
test("服务可访问", r.status_code == 200)
except Exception as e:
test("服务可访问", False, str(e))
for _ in range(8):
time.sleep(1.5)
try:
r = requests.get(f"{base}/api/system/status", timeout=3)
test("服务可访问", True)
break
except Exception:
continue
else:
test("服务可访问", False, "Server did not start within 12s")
exit(1)
# 3. Login