Skip to content

Commit b72cef5

Browse files
committed
merge: carry the lint fixes forward
2 parents 4ce4101 + 2e6683d commit b72cef5

4 files changed

Lines changed: 29 additions & 14 deletions

File tree

‎pyproject.toml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ target-version = "py311"
1515
# UP pyupgrade · C4 comprehensions · RUF ruff-native
1616
select = ["E", "W", "F", "I", "B", "UP", "C4", "RUF"]
1717

18+
[tool.ruff.lint.per-file-ignores]
19+
# scripts/perf_baseline.py is an INSTRUMENT SOURCE: its bytes are hashed into
20+
# the measurement harness digest that the frozen #263 preregistration names
21+
# (104c384d01bf), and steps 4, 5 and 6 are bound to that same value. Rewrapping
22+
# a line there is not a cosmetic edit — it moves the digest and makes the frozen
23+
# contract point at an identity the tree no longer contains, which is exactly
24+
# what scripts/step7/mergegate.py exists to refuse. So the one over-long line
25+
# stays and the linter is told why, rather than the instrument being reformatted
26+
# to please it. Lift this only together with a re-binding of steps 4/5/6.
27+
"scripts/perf_baseline.py" = ["E501"]
28+
1829
[tool.mypy]
1930
# The package is held to --strict. Tests/fuzzers are not (they lean on dynamic
2031
# construction and an AST oracle); ruff still covers them. The evidence tooling

‎scripts/step7/execbinding.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def sha256_file(path: Path) -> str:
8888

8989

9090
def _now() -> str:
91-
return datetime.datetime.now(datetime.timezone.utc).isoformat(timespec="seconds")
91+
return datetime.datetime.now(datetime.UTC).isoformat(timespec="seconds")
9292

9393

9494
def _git(repo: Path, *args: str) -> tuple[int, bytes]:

‎scripts/step7/hostqual.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class QualificationRefused(Exception):
117117

118118

119119
def _now() -> str:
120-
return datetime.datetime.now(datetime.timezone.utc).isoformat(timespec="seconds")
120+
return datetime.datetime.now(datetime.UTC).isoformat(timespec="seconds")
121121

122122

123123
def sha256_bytes(raw: bytes) -> str:
@@ -334,11 +334,12 @@ def validate_provisioning(doc: dict) -> list[str]:
334334

335335
virt = doc.get("virtualization")
336336
if not isinstance(virt, dict):
337-
return problems + ["virtualization is missing"]
337+
return [*problems, "virtualization is missing"]
338338
is_vm = virt.get("is_vm")
339339
if not isinstance(is_vm, bool):
340-
return problems + [f"virtualization.is_vm must be a real boolean, got {is_vm!r}: "
341-
"whether this is a VM is not a question a host may decline"]
340+
return [*problems,
341+
f"virtualization.is_vm must be a real boolean, got {is_vm!r}: "
342+
"whether this is a VM is not a question a host may decline"]
342343
# Applicability is shape; the answers themselves are the predicate's business.
343344
for key in PROVISIONING_VM_BOOLEANS:
344345
value = virt.get(key, "<missing>")

‎tests/test_step7_hostqual.py‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def refuses(call: Callable[[], object]) -> str | None:
9595

9696
T0_FROZEN = "# T0\n\n```text\nStatus:\n FROZEN.\n collection_authorized: true\n```\n"
9797
T0_OPEN = "# T0\n\n```text\nStatus:\n NOT_FROZEN.\n collection_authorized: false\n```\n"
98-
T0_FROZEN_UNAUTHORIZED = "# T0\n\n```text\nStatus:\n FROZEN.\n collection_authorized: false\n```\n"
98+
T0_FROZEN_UNAUTHORIZED = ("# T0\n\n```text\nStatus:\n FROZEN.\n"
99+
" collection_authorized: false\n```\n")
99100
T0_OPEN_AUTHORIZED = "# T0\n\n```text\nStatus:\n NOT_FROZEN.\n collection_authorized: true\n```\n"
100101

101102
# A compliant Windows snapshot, used as a fixture on every platform so the
@@ -201,7 +202,7 @@ def qualification(stratum: str = "linux", t0: dict | None = None, **overrides) -
201202
"environment_manifest": {"sha256": "1" * 64},
202203
"qualification_tool": {"sha256": "2" * 64},
203204
"power_snapshot": dict(COMPLIANT_POWER),
204-
"predicate": {k: "pass" for k in hq.PREDICATE_KEYS},
205+
"predicate": dict.fromkeys(hq.PREDICATE_KEYS, "pass"),
205206
"memory_metric": hq.STRATUM_METRIC[stratum],
206207
"qualified": True, "qualified_at": "2026-09-16T00:00:00+00:00"}
207208
doc.update(overrides)
@@ -368,8 +369,8 @@ def control_artifact_boundary() -> None:
368369
qual = path if slot == "qual" else good_q
369370
fresh = path if slot == "manifest" else good_m
370371
with fixed_power(COMPLIANT_POWER):
371-
message = refuses(lambda: hq.session_eligibility(
372-
binding, qual, fresh, good_d, cand, good_link, crepo,
372+
message = refuses(lambda b=binding, q=qual, f=fresh: hq.session_eligibility(
373+
b, q, f, good_d, cand, good_link, crepo,
373374
quiesce_result=quiet))
374375
if message is None:
375376
fail("hostqual-artifact-boundary", f"{label} was consumed as a real artifact")
@@ -621,7 +622,7 @@ def control_candidate_at_start() -> None:
621622
def control_postflight() -> None:
622623
with tempfile.TemporaryDirectory() as raw:
623624
tmp = Path(raw)
624-
pre, (bpath, qpath, mpath, dpath, cpath, lpath, crepo) = session_fixture(tmp)
625+
pre, (bpath, qpath, mpath, _dpath, cpath, lpath, crepo) = session_fixture(tmp)
625626
ppath = write(tmp, "pre.json", pre)
626627
probe = tmp / "probe.json"
627628
probe.write_text("{}", encoding="utf-8")
@@ -658,14 +659,15 @@ def control_postflight() -> None:
658659
def control_one_binding() -> None:
659660
with tempfile.TemporaryDirectory() as raw:
660661
tmp = Path(raw)
661-
pre, (bpath, qpath, mpath, dpath, cpath, lpath, crepo) = session_fixture(tmp)
662+
pre, (bpath, qpath, mpath, _dpath, cpath, lpath, crepo) = session_fixture(tmp)
662663
ppath = write(tmp, "pre.json", pre)
663664
probe = tmp / "probe.json"
664665
probe.write_text("{}", encoding="utf-8")
665666
original = json.loads(bpath.read_text(encoding="utf-8"))
666667
second = write(tmp, "b2.json", {**original, "bound_at": "a later moment"})
667668
with fixed_power(COMPLIANT_POWER):
668-
mixed = hq.session_admissibility(second, qpath, ppath, mpath, cpath, probe, lpath, crepo)
669+
mixed = hq.session_admissibility(second, qpath, ppath, mpath, cpath,
670+
probe, lpath, crepo)
669671
if mixed["admissible"]:
670672
fail("hostqual-one-binding",
671673
"a preflight from one binding and a postflight from another were admissible")
@@ -975,7 +977,8 @@ def qualify_cli(name: str, prov: dict) -> tuple[int, Path]:
975977
record = hq.session_eligibility(bpath, qpath, mpath, dpath, cpath, lpath, crepo,
976978
quiesce_result=quiet)
977979
if record["eligible"]:
978-
fail("hostqual-negative-evidence", "a declared prohibited job left the session eligible")
980+
fail("hostqual-negative-evidence",
981+
"a declared prohibited job left the session eligible")
979982
return
980983
if not any("declaration" in r for r in record["reasons"]):
981984
fail("hostqual-negative-evidence",
@@ -1019,7 +1022,7 @@ def control_campaign_link() -> None:
10191022
"a D7 payload edited after the campaign was linked to it was accepted")
10201023
return
10211024

1022-
pre, (bpath, qpath, mpath, dpath, cpath, lpath, crepo) = session_fixture(tmp)
1025+
pre, (bpath, qpath, mpath, _dpath, cpath, _lpath, _crepo) = session_fixture(tmp)
10231026
ppath = write(tmp, "pre.json", pre)
10241027
probe = tmp / "probe.json"
10251028
probe.write_text("{}", encoding="utf-8")

0 commit comments

Comments
 (0)