ossie icon indicating copy to clipboard operation
ossie copied to clipboard

orionbelt converter: fix round-trip fidelity + validation robustness

Open ralfbecher opened this issue 4 months ago • 0 comments

Mirrors ralfbecher/orionbelt-semantic-layer#201 (the canonical converter source) into converters/orionbelt/. Three pre-existing bugs found while reviewing #153:

Metric round-trip when a data object's code differs from its display name

OSItoOBML resolved metric references only by dataset name, but the OBML -> OSI emitter writes physical codes (e.g. SUM(fact_orders.amount)), so such metrics were dropped as unconverted on the return trip. Resolution now indexes datasets/fields by both name and physical code (source-table code + field expression, quoted or bare). Resolved refs are bracket-quoted so display names containing spaces stay intact through the dataset.column parsers, and Snowflake/Databricks quoted identifiers resolve too.

Dimension name collision across datasets

_extract_dimensions keyed dimensions by bare field name, so Orders.date and Invoices.date collapsed to one. The later one is now qualified with its data object and a warning is recorded - no silent loss.

validate_osi robustness

It assumed every datasets/fields value was a list of dicts and raised AttributeError on malformed input. It now guards each level and returns schema errors instead.

Tests

Adds tests/test_osi_converter_roundtrip_robustness.py. 154 converter tests pass; ruff clean; mypy clean with the dev extra.

Canonical change: ralfbecher/orionbelt-semantic-layer#202 (merged).

ralfbecher avatar Jul 15 '26 07:07 ralfbecher