Official Codebase of 3DCodeVerse
Python
contracts: delete SkillsUsage.probe_trustworthy — no production reader; deep_read_rate carries the atime-control rule and now keeps its rationale
gaoypeng978955a7fbd2
diff --git a/harness/codeverse3d/contracts/run.py b/harness/codeverse3d/contracts/run.pyindex faeb1702..682b13ef 100644--- a/harness/codeverse3d/contracts/run.py+++ b/harness/codeverse3d/contracts/run.py@@ -66,20 +66,6 @@ class SkillsUsage(BaseModel):"its backend in trajectories/*/transcript.jsonl (exact); 'atime' = the file-access ""probe, the fallback when a session left no tool trace")- @property- def probe_trustworthy(self) -> bool:- """False when the atime probe's control fired — the only honest reading of the numbers below.-- A run computes ``files_changed`` through ``git add -A -N`` + ``git diff``, and git- reads every untracked file to do it, which bumps atime on the whole bundle tree.- CLI activation opens ``references/`` too. Either way the probe says "read" when- nobody chose to read, and only the control can tell you which session you are in.- Transcript evidence is the CLI's own record of what it called, so it is trusted as is.- """- if self.evidence == "transcript":- return True- return self.control_present and not self.control_read-@propertydef surfaced(self) -> list[str]:return [r.name for r in self.reads if r.surfaced]@@ -90,7 +76,9 @@ class SkillsUsage(BaseModel):@propertydef deep_read_rate(self) -> float | None:- """None when there is nothing listed, or when the atime control says the probe is blind."""+ """None when there is nothing listed, or when the atime control says the probe is blind: git reads+ every untracked file for ``files_changed`` and CLI activation opens ``references/``, so atime says+ "read" when nobody chose to — only the control tells. Transcript evidence is trusted as is."""if not self.listed or (self.evidence == "atime" and self.control_present and self.control_read):return Nonereturn len(self.deep) / len(self.listed)diff --git a/harness/docs/SKILLS.md b/harness/docs/SKILLS.mdindex d2eea5f7..563565cb 100644--- a/harness/docs/SKILLS.md+++ b/harness/docs/SKILLS.md@@ -126,7 +126,7 @@ not mean that.** Two independent causes, both reproduced:So a fourth signal was added: `materialize.write_control` puts one **never-routed,never-indexed** bundle beside the real ones. Nothing should ever open it. When it comes-back opened, `SkillsUsage.control_read` is set, `probe_trustworthy` is false and+back opened, `SkillsUsage.control_read` is set andthe session's deep-read rate is **`None`** — not 100%, not 0. `3dcode skills report` excludes thosesessions from the rate and prints how many it dropped.diff --git a/harness/tests/skills/test_telemetry.py b/harness/tests/skills/test_telemetry.pyindex a93bb3de..d5af7902 100644--- a/harness/tests/skills/test_telemetry.py+++ b/harness/tests/skills/test_telemetry.py@@ -108,7 +108,6 @@ def test_the_control_bundle_is_materialised_and_starts_unread(ws, library):materialize_skills(ws, [library["c3d-part-contact"]])usage = probe_reads(ws, _materialized(library, "c3d-part-contact"))assert usage.control_present and not usage.control_read- assert usage.probe_trustworthyassert CONTROL_NAME not in usage.listed@@ -123,7 +122,7 @@ def test_a_control_that_was_opened_makes_the_rate_unmeasurable(ws, library):_touch(ws / AGENTS_SKILL_ROOT / CONTROL_NAME / "references" / "control.md")usage = probe_reads(ws, _materialized(library, "c3d-part-contact"))assert usage.deep == ["c3d-part-contact"] # the raw signal is still reported- assert usage.control_read and not usage.probe_trustworthy+ assert usage.control_read and usage.deep_read_rate is Noneassert usage.deep_read_rate is None # but the RATE refuses to lie@@ -150,7 +149,7 @@ def test_git_diff_alone_trips_the_control(tmp_path, library): # noqa: PLR0915os.utime(f, (st.st_mtime - 10, st.st_mtime - 10))before = probe_reads(ws, _materialized(library, "c3d-part-contact"))- assert before.probe_trustworthy, "materialisation alone must leave the control unread"+ assert not before.control_read, "materialisation alone must leave the control unread"subprocess.run(["git", "add", "-A", "-N"], cwd=ws, check=True)subprocess.run(["git", "diff", "--numstat", "HEAD"], cwd=ws, check=True, capture_output=True)@@ -214,7 +213,7 @@ def test_the_cli_transcript_is_the_evidence_when_every_session_left_one(ws, librusage = probe_reads(ws, got)assert usage.evidence == "transcript"assert usage.surfaced == [a, b] and usage.deep == [b]- assert not usage.control_read and usage.probe_trustworthy+ assert not usage.control_readassert usage.deep_read_rate == 1 / len(got.listed)@@ -262,7 +261,7 @@ def test_an_agent_that_opens_the_control_is_reported_not_called_blind(ws, librart=time.time() + 1)usage = probe_reads(ws, got)assert usage.evidence == "transcript" and usage.control_read- assert usage.probe_trustworthy and usage.deep_read_rate == 0.0 # exact: it read the control, and nothing else+ assert usage.deep_read_rate == 0.0 # exact: it read the control, and nothing elsedef test_the_path_match_is_exact_about_names_and_about_reading():