exlab_wizard.validator.findings#
Validator finding dataclass and serialization helpers.
Backend Spec §11.8 (finding shape contract) and §8.1 (rule catalog).
Every validator finding (creation-time or audit mode) is materialised as
a frozen Finding instance. Frozen so findings can be put in
sets / sorted / hashed for the delta computation in the audit pub-sub
channel (Backend Spec §11.8 – the 30-second background refresh diffs
two snapshots and emits adds/removes; that diff requires hashable
elements).
The on-the-wire JSON shape lives in §11.8 (verbatim copy below):
{
"rule": "unresolved_placeholder_token",
"tier": "hard",
"run_path": "/data/lab/CONFOCAL_01/PROJ-0042/Run_<run_date>",
"offending_path": "/data/lab/CONFOCAL_01/PROJ-0042/Run_<run_date>",
"offending_kind": "directory_segment",
"matched_token": "<run_date>",
"rule_detail": "Angle-bracket identifier token <run_date>...",
"synced_under_prior_policy": false,
"override_active": false
}
Finding.to_dict() and Finding.from_dict() round-trip this
shape; both modes (creation-time and audit) produce dictionaries that
are byte-identical given byte-identical inputs (the §11.8 determinism
contract).
Classes
|
One validator finding. |
- class exlab_wizard.validator.findings.Finding(rule, tier, run_path, offending_path, offending_kind, matched_token=None, rule_detail='', synced_under_prior_policy=False, override_active=False)[source]#
Bases:
objectOne validator finding. Backend Spec §8.1, §11.8.
Frozen so findings can be put in sets / sorted / hashed for the delta computation in the audit pub-sub channel (§11.8).
slotsis set so that the dataclass does not allocate a per-instance__dict__– audit mode can produce thousands of findings on a large tree and the per-instance overhead matters.Field semantics (§11.8):
rule– the §8.1 rule that fired. One of theProblemClassvalues; kept as a plain string here so the dataclass does not depend on the closed enum at the typing surface (the enum is the canonical truth, but a string field keeps round-tripping viamsgspec/JSON cheap).tier–"hard"or"soft"per the §8.1.6 tier mapping.run_path– the run-level directory ancestor (or project/equipment level for orphans at those levels).offending_path– the absolute path of the artefact that tripped the rule. May equalrun_pathwhen the rule applies to the run-level directory itself.offending_kind– one ofdirectory_segment,file_name,file_content(§11.8).matched_token– the substring (e.g."<run_date>") or reserved name (e.g."CON") that triggered the rule.Nonefor rules that don’t have a single matched token (e.g. orphan).rule_detail– a short human-readable description suitable for the Problems-tab row. Defaults to""so the field is always present in the JSON shape.synced_under_prior_policy– set toTruewhen audit mode finds a hard-tier finding on a run whosecreation.jsonsync_statusis already"synced"(Backend Spec §7.3). Defaults toFalsefor creation-time findings.override_active– set toTruewhen the run’svalidation_overridescontains a non-revoked entry whoseproblem_classmatchesrule. Defaults toFalse.
- Parameters: