diff --git a/src/cifflow/dictionary/ddlm_parser.py b/src/cifflow/dictionary/ddlm_parser.py index fc4124c..15f32ba 100644 --- a/src/cifflow/dictionary/ddlm_parser.py +++ b/src/cifflow/dictionary/ddlm_parser.py @@ -59,3 +59,17 @@ class DdlmDictionary: warnings: list[str] = field(default_factory=list) source_files: list[str] = field(default_factory=list) uri: str | None = None + + @property + def has_warnings(self) -> bool: + """Return True if any non-fatal issues were recorded during loading. + + Warnings range from purely informational (e.g. a dictionary with + multiple data blocks) to significant (e.g. a skipped import). A + dictionary with warnings is not necessarily unusable; inspect + :attr:`warnings` to determine severity. + """ + return bool(self.warnings) + + # def __bool__(self) -> bool: + # return self.is_valid diff --git a/tasks/todo.md b/tasks/todo.md index 0c644e7..b5e7cbf 100644 --- a/tasks/todo.md +++ b/tasks/todo.md @@ -49,9 +49,13 @@ Decomposed all F-grade and all 6 reducible E-grade functions into private helper ingest a real `.cif` to file-backed SQLite, emit to `.cif` and re-ingest, property-based tests for `_BlockData` helpers. - 4. **Unify severity levels** across parser/ingest/validation — audit every `on_error` / - `ParseError` site; assign `'Error' | 'Warning' | 'Info'`; standardise message phrasing; - decide `ingest()` return type. + 4. **Unify severity levels** across parser/ingest/validation/dictionary — audit every `on_error` / + `ParseError` site and every `warn()` call in `loader.py`; assign `'Error' | 'Warning' | 'Info'`; + standardise message phrasing; decide `ingest()` return type. Dictionary warnings currently span + the full range from purely informational ("has 2 data blocks — using first") to effectively fatal + ("contains no data blocks"), making `DdlmDictionary.is_valid` / `__bool__` meaningless as a + single threshold. Fix requires classifying each warning site before exposing validity on the + public API. 6. **`CifBuilder` cross-type duplicate tag detection** — scalar-then-loop silently loses scalar; loop-then-scalar makes loop structurally inconsistent. Fix in `builder.py` with