diagnostics.report#

Diagnostic report types.

Defines the Severity, Diagnostic, and DiagnosticReport types produced by optiland.diagnostics.check_system. This module contains no logic that inspects an Optic — that lives in checks.py.

Kramer Harrison, 2026

Classes

Diagnostic(severity, code, message, fix[, ...])

A single diagnostic finding produced by a system check.

DiagnosticReport(diagnostics)

The result of running check_system on an Optic.

Severity(*values)

Severity level of a diagnostic finding.

class Diagnostic(severity: Severity, code: str, message: str, fix: str, where: int | str | None = None, doc_url: str | None = None)[source]#

A single diagnostic finding produced by a system check.

Variables:
  • severity (diagnostics.report.Severity) – How serious the finding is.

  • code (str) – Stable identifier for the check that produced this finding, e.g. "OPT001".

  • message (str) – What is wrong, stating the offending object and value.

  • fix (str) – What to do about it, as a runnable line of code where possible.

  • where (int | str | None) – The surface index or object reference the finding concerns, or None if it applies to the system as a whole.

  • doc_url (str | None) – Deep link into the documentation for this check.

code: str#
doc_url: str | None = None#
fix: str#
message: str#
severity: Severity#
where: int | str | None = None#
class DiagnosticReport(diagnostics: list[Diagnostic])[source]#

The result of running check_system on an Optic.

Variables:

diagnostics – All findings, in the order the checks ran.

property errors: list[Diagnostic]#

Findings with Severity.ERROR.

Type:

list[Diagnostic]

property ok: bool#

True if no error-severity findings were reported.

Warnings do not affect this — a system with only warnings is considered usable, if imperfect.

Type:

bool

property warnings: list[Diagnostic]#

Findings with Severity.WARNING.

Type:

list[Diagnostic]

class Severity(*values)[source]#

Severity level of a diagnostic finding.

ERROR = 'error'#
WARNING = 'warning'#