Accept fixture-bound supplied review nominations without deriving match facts (by Codex)

This commit is contained in:
Codex authored and Codex committed 2026-10-27 08:51:30 +01:00
1 parent 2c4b9d2595
commit 925042b559
6 files changed
+344 -5

No files matched your search

+155
View File
@@ -0,0 +1,155 @@
{
"schema": "openbmh-post-match-eleven-layout@1",
"notice": "Ausschließlich synthetische Layout-Testdaten von Codex, keine tatsächlich ermittelten Nominierungen.",
"eleven": {
"available": true,
"source": "synthetic-layout-fixture",
"notice": "Synthetische Layout-Testelf · keine Spielnoten oder Engineauswertung",
"formation": "3-4-3",
"rows": [
{
"player": {
"id": "player:post-0-0",
"name": "Anton Beispiel"
},
"team": {
"id": "club:post-0",
"name": "Verein 0",
"role": "club"
},
"position": "gk",
"rating": null
},
{
"player": {
"id": "player:post-2-1",
"name": "Benedikt Muster"
},
"team": {
"id": "club:post-2",
"name": "Verein 2",
"role": "club"
},
"position": "def",
"rating": null
},
{
"player": {
"id": "player:post-4-2",
"name": "Cem Öztürk-Demo"
},
"team": {
"id": "club:post-4",
"name": "Verein 4",
"role": "club"
},
"position": "def",
"rating": null
},
{
"player": {
"id": "player:post-6-3",
"name": "Daniel Probe"
},
"team": {
"id": "club:post-6",
"name": "Verein 6",
"role": "club"
},
"position": "def",
"rating": null
},
{
"player": {
"id": "player:post-0-4",
"name": "Emil Testspieler"
},
"team": {
"id": "club:post-0",
"name": "Verein 0",
"role": "club"
},
"position": "mid",
"rating": null
},
{
"player": {
"id": "player:post-2-5",
"name": "Felix Beispielmann"
},
"team": {
"id": "club:post-2",
"name": "Verein 2",
"role": "club"
},
"position": "mid",
"rating": null
},
{
"player": {
"id": "player:post-4-6",
"name": "Gabriel Musterfeld"
},
"team": {
"id": "club:post-4",
"name": "Verein 4",
"role": "club"
},
"position": "mid",
"rating": null
},
{
"player": {
"id": "player:post-6-7",
"name": "Hannes Übung"
},
"team": {
"id": "club:post-6",
"name": "Verein 6",
"role": "club"
},
"position": "mid",
"rating": null
},
{
"player": {
"id": "player:post-0-8",
"name": "Ibrahim Demonstrator"
},
"team": {
"id": "club:post-0",
"name": "Verein 0",
"role": "club"
},
"position": "fwd",
"rating": null
},
{
"player": {
"id": "player:post-2-9",
"name": "Jonas Maximilian Beispiel"
},
"team": {
"id": "club:post-2",
"name": "Verein 2",
"role": "club"
},
"position": "fwd",
"rating": null
},
{
"player": {
"id": "player:post-4-10",
"name": "Kilian Testname"
},
"team": {
"id": "club:post-4",
"name": "Verein 4",
"role": "club"
},
"position": "fwd",
"rating": null
}
]
}
}
+55 -1
View File
@@ -3,6 +3,7 @@
#include "modern/ui/demo_live.hpp"
#include "modern/ui/desktop.hpp"
#include "modern/ui/model.hpp"
#include <algorithm>
#include <iostream>
#include <stdexcept>
@@ -59,8 +60,13 @@ Json request(const Json &recording, const char *kind = "review") {
}
} // namespace
int main() {
int main(int argc, char **argv) {
try {
require(argc == 2, "expected separate synthetic nomination layout fixture");
const auto layout = Json::parse(bmh::editor::read_file(argv[1]));
require(layout.at("schema") == "openbmh-post-match-eleven-layout@1" &&
layout.at("eleven").at("source") == "synthetic-layout-fixture",
"filled nomination example is explicitly synthetic and outside product startup");
struct Unavailable final : DataSource {
Snapshot snapshot() const override { return {}; }
ActionResult apply(const Action &) override { return {false, 0, "unavailable"}; }
@@ -101,10 +107,50 @@ int main() {
for (const auto &event : row.at("events")) require(event.at("match_id") == row.at("id"), "events cannot leak from another match");
}
require(source.read_post_match(request(recording)) == review, "DemoSource read hook gives pure final review");
Json supplied = {{"schema", "openbmh-post-match-records@1"},
{"fixture_id", recording.at("fixture_id")},
{"source_revision", recording.at("source_revision")}, {"eleven", layout.at("eleven")}};
const auto filled = make_demo_post_match(recording, 8, supplied);
require(filled.value("ok", false) && filled.at("eleven") == layout.at("eleven"),
"explicitly supplied synthetic nominations are preserved for filled layout coverage");
auto expected_filled = review; expected_filled["eleven"] = layout.at("eleven");
auto &unknown = expected_filled["unknown_fields"];
unknown.erase(std::remove(unknown.begin(), unknown.end(), Json("eleven")), unknown.end());
require(filled == expected_filled && make_demo_post_match(recording, 8).dump() == review.dump() &&
make_demo_post_match(recording, 8, Json::object()).dump() == review.dump(),
"filled path only supplies its nominations; no-records output remains byte-identical");
require(query_demo_post_match(recording, request(recording), supplied) == filled && recording == original,
"query overload accepts bound records without rewriting recording frames or identity");
auto actual_supplied = supplied; actual_supplied["eleven"]["source"] = "supplied-records";
require(make_demo_post_match(recording, 8, actual_supplied).at("eleven").at("source") == "supplied-records",
"non-layout records retain explicit supplied provenance without claiming engine authority");
for (int fault = 0; fault < 15; ++fault) {
auto bad = supplied;
if (fault == 0) bad["eleven"]["rows"][1]["player"]["id"] = bad["eleven"]["rows"][0]["player"]["id"];
if (fault == 1) bad["eleven"]["rows"][1]["position"] = "gk";
if (fault == 2) bad["eleven"]["rows"].erase(0);
if (fault == 3) bad["eleven"]["rows"][0]["rating"] = 1;
if (fault == 4) bad["source_revision"] = before.revision + 1;
if (fault == 5) bad["fixture_id"] = "foreign";
if (fault == 6) bad["eleven"]["rows"][0]["team"]["id"] = "club:foreign";
if (fault == 7) bad["eleven"]["rows"][0]["team"]["name"] = "Renamed facts";
if (fault == 8) bad["eleven"]["source"] = "engine";
if (fault == 9) bad["eleven"]["formation"] = "4-4-2";
if (fault == 10) bad["generate"] = true;
if (fault == 11) bad["eleven"]["rows"][0]["player"]["name"] = std::string(1, char(0xff));
if (fault == 12) bad["eleven"]["available"] = false;
if (fault == 13) bad["eleven"]["rows"][0]["team"]["role"] = "national";
if (fault == 14) bad = nullptr;
require(!make_demo_post_match(recording, 8, bad).at("ok") &&
!query_demo_post_match(recording, request(recording), bad).at("ok"),
"malformed, stale, unknown-scale, foreign or non-3-4-3 nominations reject atomically");
}
auto seek = request(recording, "report"); seek["match_id"] = recording.at("matches")[1].at("id");
for (int minute : {0, 11, 12, 23, 45, 61, 62, 77, 78, 89, 90}) {
seek["minute"] = minute;
const auto report = query_demo_post_match(recording, seek);
require(query_demo_post_match(recording, seek, supplied) == report,
"optional nominations cannot change report outcomes, events or minutes");
require(report.value("ok", false) && report.at("minute") == minute && report.at("recorded_minute") <= minute &&
report.at("match_id") == seek.at("match_id"), "seek selects existing frame for selected match");
require(report.at("score") == (minute < 12 ? Json::array({0,0}) : minute < 62 ? Json::array({1,0}) :
@@ -150,6 +196,10 @@ int main() {
require(source.apply({source.snapshot().revision, "career", {{"kind", "surface"}, {"value", "indoor"}}}).ok,
"switch indoor board");
const auto hall = live(source); const auto hall_review = make_demo_post_match(hall, 8);
auto hall_records = supplied; hall_records["fixture_id"] = hall.at("fixture_id");
hall_records["source_revision"] = hall.at("source_revision");
require(make_demo_post_match(hall, 8, hall_records).at("error") == "post_match_records_scope_unavailable",
"indoor never receives an outdoor eleven tab through supplied records");
require(hall_review.at("duration") == 40 && hall_review.at("field_count") == 6 && hall_review.at("tables").empty() &&
hall_review.at("tabs") == Json::array({"results", "report", "overview"}), "hall has three tabs and no league table");
auto hall_seek = request(hall, "report"); hall_seek["minute"] = 36;
@@ -159,6 +209,10 @@ int main() {
require(source.apply({source.snapshot().revision, "career", {{"kind", "role"}, {"value", "national"}}}).ok,
"switch national role");
const auto national = live(source); const auto national_review = make_demo_post_match(national, 8);
auto national_records = supplied; national_records["fixture_id"] = national.at("fixture_id");
national_records["source_revision"] = national.at("source_revision");
require(make_demo_post_match(national, 8, national_records).at("error") == "post_match_records_scope_unavailable",
"national cannot display old club nominations even when rebound to its fixture");
require(national_review.at("duration") == 90 && national_review.at("role") == "national" &&
national_review.at("owners").size() == 1 && national_review.at("tables").empty() &&
national_review.at("tabs") == Json::array({"results", "report", "overview"}) &&