stack: Telemetrie-Default nach Installationsform, Byte-Deckel und Session-Retention (schliesst #55)
Files changed: - .gitea/workflows/ci.yml - .gitignore - CHANGES.md - EVALS.md - INSTALL-MCP.md - INSTALL.md - VERSION - instructions/setup-instance.md - reports/CONTRACT.md - tools/CONTRACT.md - tools/chemenu/commands/doctor.py - tools/chemenu/config.py - tools/chemenu/mcp/server.py - tools/chemenu/telemetry/policy.py - tools/chemenu/telemetry/schema.py - tools/chemenu/telemetry/writer.py - tools/chemenu/tests/conftest.py - tools/chemenu/tests/test_doctor.py - tools/chemenu/tests/test_mcp_server.py - tools/chemenu/tests/test_telemetry_emit.py - tools/chemenu/tests/test_telemetry_policy.py - tools/chemenu/version.py
This commit is contained in:
1 parent
71446c0f29
commit
82a22eaa93
22 files changed
+801
-44
No files matched your search
@@ -345,6 +345,45 @@ def test_not_a_git_repo_fails(tmp_path, monkeypatch):
|
||||
assert _status(checks, "git-repo") == "FAIL"
|
||||
|
||||
|
||||
def test_telemetry_is_on_by_default_for_a_dev_checkout(instance):
|
||||
checks = doctor.run_doctor()
|
||||
assert _status(checks, "telemetry") == "OK"
|
||||
detail = next(c.detail for c in checks if c.name == "telemetry")
|
||||
assert detail.startswith("on (")
|
||||
assert "0/250 session(s)" in detail
|
||||
|
||||
|
||||
def test_telemetry_is_off_by_default_for_a_stamped_distribution(instance):
|
||||
(config.ROOT / ".wikitool-release.json").write_text(
|
||||
'{"version": "0.1.0", "exported_at": "2026-08-29"}', encoding="utf-8"
|
||||
)
|
||||
detail = next(c.detail for c in doctor.run_doctor() if c.name == "telemetry")
|
||||
assert detail.startswith("off (")
|
||||
assert ".wikitool-release.json present" in detail
|
||||
|
||||
|
||||
def test_telemetry_never_fails_either_way(instance):
|
||||
(config.ROOT / ".wikitool-release.json").write_text(
|
||||
'{"version": "0.1.0", "exported_at": "2026-08-29"}', encoding="utf-8"
|
||||
)
|
||||
assert _status(doctor.run_doctor(), "telemetry") == "OK"
|
||||
|
||||
|
||||
def test_telemetry_reports_the_current_session_count_and_byte_total(instance, monkeypatch):
|
||||
from chemenu.telemetry.writer import TRACE_FILE, trace_root
|
||||
|
||||
trace_dir = config.ROOT / "traces"
|
||||
monkeypatch.setenv("WIKI_TRACE_DIR", str(trace_dir))
|
||||
for name, content in (("a", "111"), ("b", "22222")):
|
||||
session_dir = trace_root() / name
|
||||
session_dir.mkdir(parents=True)
|
||||
(session_dir / TRACE_FILE).write_text(content, encoding="utf-8")
|
||||
|
||||
detail = next(c.detail for c in doctor.run_doctor() if c.name == "telemetry")
|
||||
assert "2/250 session(s)" in detail
|
||||
assert "8 byte(s)" in detail # "111" + "22222"
|
||||
|
||||
|
||||
def test_doctor_command_exits_nonzero_only_on_fail(instance, capsys):
|
||||
import typer
|
||||
|
||||
|
||||
Reference in new issue
Block a user