schemas.py becomes pydantic, so the reference domain is the normal pattern rather than an exception carrying a footnote. Frozen: a result is a statement about what was found, and nothing downstream should edit the finding on its way to being reported. pydantic stays off the --help path — test_lazy_domains still passes, which is precisely the assertion that it loads with the domain and not with the CLI. The acceptance criterion could not be met as written, and that is the finding worth keeping. It asked for byte-for-byte parity with the old script; D-263 was amended after this ticket to give reach a streaming model that puts the verdict on stderr, while the old script writes its success line to stdout. Measured: the text is byte-identical in text mode, only the stream differs. Matching both would mean abandoning streaming or special-casing every ported gate. So parity is redefined, and it is stronger than bytes where it counts: exit codes match exactly, no fact the old message carried is lost, and failures name a remedy as a structured field. That governs every port in T-1251, not just this one, so it is in D-263 rather than only here. test_check_parity.py runs three paths — ok, drift, missing file — through both implementations and compares. It builds a throwaway fixture repo and copies the OLD script into it, because that script resolves its root from __file__ and has no override; the new command just takes SR_REPO_ROOT. That asymmetry is part of why the port earns its keep. It also asserts the failing paths actually exit non-zero, without which "the exit codes matched" would be vacuous for two checks that both silently pass. Proven to fail twice before being trusted. Once by accident: the first version asserted the yaml version appears on every failing path, which the old script does not report when the client file is missing — the test was wrong, not the code, and it now derives expected facts from what the old output actually contains. Once on purpose: mutating the router to drop a version made it fail and name the missing fact. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""Data shapes for the `check` domain.
|
|
|
|
pydantic, as every domain's `schemas.py` should be (D-263). The earlier stdlib
|
|
dataclass here was a carve-out justified by a timing-parity budget that D-263
|
|
withdrew on 2026-08-20 — and a reference implementation carrying a footnote is a
|
|
worse reference than one that is simply normal.
|
|
|
|
Shapes are frozen. A result object is a statement about what was found, and
|
|
nothing downstream should be able to edit the finding on its way to being
|
|
reported.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class VersionCheck(BaseModel):
|
|
"""The outcome of comparing project.yaml against client/project.godot.
|
|
|
|
`problem` and `ok` are deliberately separate. A check can fail because the
|
|
versions disagree (`ok=False`, both versions known) or because it could not
|
|
read them at all (`problem` set) — and those want different messages, since
|
|
only the first has a remedy the caller can act on.
|
|
"""
|
|
|
|
model_config = ConfigDict(frozen=True)
|
|
|
|
ok: bool
|
|
yaml_version: str | None = None
|
|
godot_version: str | None = None
|
|
problem: str | None = None
|