mirror of
https://codeberg.org/reverse-skill-lab/apk-reverse
synced 2026-11-24 15:14:08 +08:00
Fix the corpus count, recalibrate the token estimate, add a PR template
- check_budget.py counted scripts/__pycache__/*.pyc in its corpus note, so the same commit reported 27 scripts on a machine that had run the suite and 16 on a clean checkout. The routing gate said 16 throughout; two gates disagreeing about one tree was the finding. - TOKENS_PER_CHAR was calibrated against a 67,011-character SKILL.md and the docstring's arithmetic (0.30 characters-to-tokens) did not describe that measurement. Re-measured here: 54,983 chars -> 12,906 tokens = 4.260; the constant and both comments now carry the number this tree measures. - test_budget_measurement.py pins the corpus exclusion, so a bytecode cache cannot re-enter the count and quietly change it again. - .github/PULL_REQUEST_TEMPLATE.md carries what CONTRIBUTING.md asks a contributor for: what was run, the four labels, what has to move with the change, and the boundary that was not exercised.
This commit is contained in:
@@ -112,3 +112,25 @@ def test_an_index_row_past_the_hard_limit_fails_rather_than_warns(budget):
|
||||
assert levels(budget.INDEX_ROW_HARD + 10) == {"fail"}, (
|
||||
"a row past INDEX_ROW_HARD (%d chars) must fail the gate, not warn about it"
|
||||
% budget.INDEX_ROW_HARD)
|
||||
|
||||
def test_the_corpus_count_ignores_a_bytecode_cache(budget, tmp_path, monkeypatch):
|
||||
"""A measurement that changes when a reader runs the suite measures the reader.
|
||||
|
||||
The corpus note once counted scripts/__pycache__/*.pyc, so the same commit reported 27 scripts
|
||||
on a machine that had run pytest and 16 on a clean checkout. The routing gate said 16 the whole
|
||||
time; the disagreement between two gates about one tree is what surfaced it.
|
||||
"""
|
||||
refs = tmp_path / "references"
|
||||
refs.mkdir()
|
||||
(refs / "one.md").write_text("# one\n", encoding="utf-8")
|
||||
scripts = tmp_path / "scripts"
|
||||
scripts.mkdir()
|
||||
(scripts / "one.py").write_text("print(1)\n", encoding="utf-8")
|
||||
cache = scripts / "__pycache__"
|
||||
cache.mkdir()
|
||||
(cache / "one.cpython-314.pyc").write_bytes(b"\x00" * 10)
|
||||
|
||||
monkeypatch.setattr(budget, "REFS", str(refs))
|
||||
monkeypatch.setattr(budget, "SKILL_DIR", str(tmp_path))
|
||||
notes = budget.check_corpus()
|
||||
assert notes[0].startswith("corpus: 1 references + 1 scripts = 2 files"), notes[0]
|
||||
|
||||
Reference in New Issue
Block a user