official-stockfish / fishtest

The Stockfish testing framework
https://tests.stockfishchess.org/tests
270 stars 126 forks source link

Enhancement of validation. #2056

Closed vdbergh closed 3 weeks ago

vdbergh commented 3 weeks ago

Many data structure in Fishtest contain references to a run objects. Naively validating such data structures means that we are also validating the embedded run objects, which is wasteful as these are already validated elsewhere.

The latest version of vtjson makes it possible to change subschemas during validation.

In this PR we define the cache_schema as

cache_schema = {
    run_id: {
        "run": set_label(runs_schema, "runs_schema"),
    "is_changed": bool,
        "last_sync_time": ufloat,
        "last_access_time": ufloat,
    },
}

and we perform validation via

validate(cache_schema, self.run_cache, name="run_cache", subs={"runs_schema": dict})

Requires upgrade of vtjson.

vdbergh commented 3 weeks ago

Part of the program to document and validate the data structures used by Fishtest...

ppigazzini commented 3 weeks ago

PROD rebuilt from scratch, thank you @vdbergh