test(v1-gate): the MAF list is operator-approved; row 5 reads 3 of 8
The eight U-IDs and their type pointers were checked against the approved list (no deviation) and the data file now says approved, with the date and the source. Row 5 no longer reports "not approved" but the measured count: 3 of 8 (U12, U4, U6), because a point counts only when every type it points at is green and only types 1, 3 and 7 are. No gate logic changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
83c94e4fb6
commit
9847e014e7
2 changed files with 35 additions and 4 deletions
|
|
@ -234,13 +234,42 @@ def test_row4_a_line_kept_once_counts_once(tmp_path: Path) -> None:
|
|||
|
||||
|
||||
def test_row5_is_red_until_the_operator_approves_the_list() -> None:
|
||||
assert _CONFIG["maf_points"]["approved"] is False
|
||||
unapproved = {**_CONFIG["maf_points"], "approved": False}
|
||||
verdicts = gate.green_types(_CONFIG["feedback_types"], _all_pass(_ALL_NODEIDS))
|
||||
row = gate.score_maf(_CONFIG["maf_points"], verdicts, gate._PACKAGE_SRC)
|
||||
row = gate.score_maf(unapproved, verdicts, gate._PACKAGE_SRC)
|
||||
assert (row.k, row.status, row.reason) == (0, gate.RED, "M ikke godkjent av operatøren")
|
||||
assert "presence 7 av 8" in row.diagnostics
|
||||
|
||||
|
||||
def test_row5_the_approved_list_counts_only_points_whose_types_are_green() -> None:
|
||||
"""The tracked list is operator-approved (17.09): eight U-IDs, and a point counts only when
|
||||
every type it points at is green. With today's green types (1, 3, 7) that is U12, U4, U6."""
|
||||
maf = _CONFIG["maf_points"]
|
||||
assert (maf["approved"], maf["approved_on"], maf["approved_by"]) == (
|
||||
True,
|
||||
"2026-09-17",
|
||||
"operatørgodkjent",
|
||||
)
|
||||
assert [(p["u_id"], p["types"]) for p in maf["points"]] == [
|
||||
("U13", [1, 2]),
|
||||
("U9", [1, 8]),
|
||||
("U12", [1]),
|
||||
("U4", [3]),
|
||||
("U7", [4]),
|
||||
("U11", [5]),
|
||||
("U5", [6]),
|
||||
("U6", [7]),
|
||||
]
|
||||
today = {
|
||||
n: ("passed" if int(t) in (1, 3, 7) else "failed")
|
||||
for t, spec in _CONFIG["feedback_types"].items()
|
||||
for n in spec["evidence"]
|
||||
}
|
||||
row = gate.score_maf(maf, gate.green_types(_CONFIG["feedback_types"], today), gate._PACKAGE_SRC)
|
||||
assert (row.k, row.n, row.status) == (3, 8, gate.RED)
|
||||
assert all(p not in " ".join(row.exceptions) for p in ("U12 ", "U4 ", "U6 "))
|
||||
|
||||
|
||||
def _synthetic_src(tmp: Path, *, comment_only: bool = False) -> Path:
|
||||
body = (
|
||||
"# uses SkillsProvider\n" if comment_only else "def build():\n return SkillsProvider()\n"
|
||||
|
|
@ -397,6 +426,6 @@ def test_the_command_is_red_today_with_every_row_in_its_output(tmp_path: Path) -
|
|||
assert (rows["rounds"]["k"], rows["changes"]["k"]) == (0, 0)
|
||||
assert (rows["types"]["k"], rows["types"]["n"]) == (3, 8)
|
||||
assert rows["kept"]["status"] == gate.RED
|
||||
assert rows["maf"]["reason"] == "M ikke godkjent av operatøren"
|
||||
assert (rows["maf"]["k"], rows["maf"]["n"], rows["maf"]["status"]) == (3, 8, gate.RED)
|
||||
assert rows["undeclared"]["status"] == gate.RED
|
||||
assert rows["named"]["failing"] is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue