From 34585a010dc258965f5224719dc32f00b62652d2 Mon Sep 17 00:00:00 2001 From: Kyoung Min Kim Date: Mon, 26 Oct 2026 11:18:57 +0900 Subject: [PATCH 1/4] test(validation): pin the dialect tables to extensions/dialects.md A dialect registered in extensions/dialects.md also has to be listed in validate.py, in SQLGLOT_DIALECTS with the reader that parses it or in NON_SQL_DIALECTS, or the validator warns about a token the registry says is fine. Nothing checked that. Compare the union of the two sets with the table, keep them disjoint, keep the default reader to ANSI_SQL and OSSIE_SQL_2026, and resolve every reader through sqlglot so a misspelled one fails here rather than as a ValueError on the first document in that dialect. The comment on the unsupported-dialect warning said such a token may be a legitimate registry entry; with the pin it is one the registry does not have either, so say that instead. Generated-by: Claude Code --- validation/tests/test_validate.py | 44 +++++++++++++++++++++++++++++++ validation/validate.py | 8 +++--- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/validation/tests/test_validate.py b/validation/tests/test_validate.py index ece083f1e..8f7968cc2 100644 --- a/validation/tests/test_validate.py +++ b/validation/tests/test_validate.py @@ -17,6 +17,7 @@ import copy import json +import re import urllib.request from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path @@ -348,6 +349,49 @@ def test_holistics_aql_is_skipped_rather_than_parsed_as_sql() -> None: assert "HOLISTICS_AQL" not in _VALIDATE.SQLGLOT_DIALECTS +def _registered_dialects() -> set[str]: + """The tokens in the table of extensions/dialects.md.""" + registry = Path(__file__).parents[2] / "extensions" / "dialects.md" + return { + match.group(1) + for line in registry.read_text(encoding="utf-8").splitlines() + if (match := re.match(r"^\|\s*`([^`]+)`\s*\|", line)) + } + + +def test_the_dialect_tables_match_the_registry() -> None: + # A dialect registered in extensions/dialects.md has to be listed here as + # well, as the sqlglot reader that parses it or as one sqlglot cannot read, + # or the validator warns about a token the registry says is fine. A dialect + # listed here but not in the registry is a registration someone skipped. + known = set(_VALIDATE.SQLGLOT_DIALECTS) | _VALIDATE.NON_SQL_DIALECTS + + assert known == _registered_dialects(), ( + "extensions/dialects.md and SQLGLOT_DIALECTS / NON_SQL_DIALECTS in" + " validate.py do not list the same dialects; register a dialect in both" + ) + assert set(_VALIDATE.SQLGLOT_DIALECTS) & _VALIDATE.NON_SQL_DIALECTS == set() + + +def test_only_the_portable_dialects_use_the_default_reader() -> None: + # A None reader is sqlglot's default, which only ANSI_SQL and the portable + # language are meant to be parsed with. + default_reader = {d for d, reader in _VALIDATE.SQLGLOT_DIALECTS.items() if reader is None} + + assert default_reader == {"ANSI_SQL", _VALIDATE.PORTABLE_DIALECT} + + +def test_every_sqlglot_reader_exists() -> None: + # Separate from the registry checks so that those still run without + # sqlglot. A misspelled reader passes them and then makes sqlglot raise + # ValueError, which _parse_sql_expression does not catch. + sqlglot = pytest.importorskip("sqlglot") + + for reader in _VALIDATE.SQLGLOT_DIALECTS.values(): + if reader is not None: + sqlglot.Dialect.get_or_raise(reader) + + def test_a_holistics_aql_expression_is_not_reported_as_invalid_sql() -> None: # `|` is AQL's pipe operator. Parsed as SQL it is a bitwise OR over two # names, which sqlglot accepts, so the skip is asserted through a body that diff --git a/validation/validate.py b/validation/validate.py index 8d705e85c..669dc4107 100644 --- a/validation/validate.py +++ b/validation/validate.py @@ -520,9 +520,11 @@ def validate_sql(data: dict) -> list[str]: model_name = data.get("name", "") errors = [] - # A dialect outside both sets is one this validator cannot parse. It may be a - # legitimate entry from extensions/dialects.md, so warn once that its - # expressions went unchecked rather than treat it as an error. + # A dialect outside both sets is one this validator does not know. The two + # sets are pinned to extensions/dialects.md, so this is a token the registry + # does not have either; it is still legitimate (dialect is free-form), so + # warn once that its expressions went unchecked rather than treat it as an + # error. unsupported_dialects = Counter() for expression in iter_expressions(data): From 4c0041c07a9fd02f0f99c441be276ab493bc8fc8 Mon Sep 17 00:00:00 2001 From: Kyoung Min Kim Date: Mon, 26 Oct 2026 11:18:57 +0900 Subject: [PATCH 2/4] fix(python): register the vendors the SDK and extensions/vendors.md disagree on OssieVendor had SEMANTIDO (#207 added it to the enum only) and lacked HONEYDEW, POWER_BI and THOUGHTSPOT, which the spec table had. #617 moved that table to extensions/vendors.md, so the two now differ in both directions. Add the three to the enum and SEMANTIDO to the registry. Generated-by: Claude Code --- extensions/vendors.md | 1 + python/src/ossie/models.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/extensions/vendors.md b/extensions/vendors.md index c0e84377a..302efc0ab 100644 --- a/extensions/vendors.md +++ b/extensions/vendors.md @@ -42,6 +42,7 @@ community uses (see [`README.md`](README.md) for how these lists are used). | `DBT` | dbt-specific attributes | | `DATABRICKS` | Databricks-specific attributes | | `GOODDATA` | GoodData-specific attributes | +| `SEMANTIDO` | Semantido-specific attributes | | `HONEYDEW` | Honeydew-specific attributes | | `WISDOM` | WisdomAI-specific attributes | | `POWER_BI` | Microsoft Power BI-specific attributes | diff --git a/python/src/ossie/models.py b/python/src/ossie/models.py index a7bc947b6..9ae119b5d 100644 --- a/python/src/ossie/models.py +++ b/python/src/ossie/models.py @@ -172,8 +172,11 @@ class OssieVendor(str, Enum): DATABRICKS = "DATABRICKS" GOODDATA = "GOODDATA" SEMANTIDO = "SEMANTIDO" + HONEYDEW = "HONEYDEW" WISDOM = "WISDOM" + POWER_BI = "POWER_BI" SIGMA = "SIGMA" + THOUGHTSPOT = "THOUGHTSPOT" HEX = "HEX" ATACCAMA = "ATACCAMA" From d61e781bfe3a19f8b9bb10ed325e7d3b46fa175e Mon Sep 17 00:00:00 2001 From: Kyoung Min Kim Date: Mon, 26 Oct 2026 11:18:57 +0900 Subject: [PATCH 3/4] test(python): pin OssieDialect and OssieVendor to the registries The fields accept any string; the enums are the well-known values, so they should carry exactly what extensions/dialects.md and vendors.md register. The schema has no enum to compare them with, Dialect since Generated-by: Claude Code #617 and Vendor from the start, so compare them with the tables. --- python/tests/test_models.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/python/tests/test_models.py b/python/tests/test_models.py index 040e5f4c9..a203c5d91 100644 --- a/python/tests/test_models.py +++ b/python/tests/test_models.py @@ -16,6 +16,7 @@ # under the License. import json +import re from collections.abc import Callable from pathlib import Path @@ -37,6 +38,7 @@ OssieMetric, OssieRelationship, OssieSemanticModel, + OssieVendor, ) @@ -56,6 +58,30 @@ def test_dialect_is_free_form_in_core_schema() -> None: assert "OSSIE_SQL_2026" in dialect["examples"] +def _registered_tokens(registry: str) -> set[str]: + """The tokens in the table of extensions/.md.""" + path = Path(__file__).parents[2] / "extensions" / f"{registry}.md" + return { + match.group(1) + for line in path.read_text(encoding="utf-8").splitlines() + if (match := re.match(r"^\|\s*`([^`]+)`\s*\|", line)) + } + + +def test_dialect_enum_matches_the_registry() -> None: + # The field accepts any string; the enum is the well-known values, so it + # carries exactly what extensions/dialects.md registers. + assert {member.value for member in OssieDialect} == _registered_tokens("dialects"), ( + "OssieDialect and extensions/dialects.md do not list the same dialects" + ) + + +def test_vendor_enum_matches_the_registry() -> None: + assert {member.value for member in OssieVendor} == _registered_tokens("vendors"), ( + "OssieVendor and extensions/vendors.md do not list the same vendors" + ) + + @pytest.mark.parametrize( "dialect", ["ANSI_SQL", OssieDialect.ANSI_SQL], From 28bd7bec3d28e311ef2595a33bada3f490918412 Mon Sep 17 00:00:00 2001 From: Kyoung Min Kim Date: Mon, 26 Oct 2026 11:18:57 +0900 Subject: [PATCH 4/4] ci: run validation-ci and python-ci when extensions/ changes The registry pins compare the tables in extensions/ with validate.py and the SDK, so a change to a table alone has to run both suites. Generated-by: Claude Code --- .github/workflows/python-ci.yml | 2 ++ .github/workflows/validation-ci.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 301f92eba..fb3e4b042 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -25,12 +25,14 @@ on: paths: - 'python/**' - 'core-spec/**' + - 'extensions/**' - '.github/workflows/python-ci.yml' pull_request: branches: [ "main" ] paths: - 'python/**' - 'core-spec/**' + - 'extensions/**' - '.github/workflows/python-ci.yml' permissions: diff --git a/.github/workflows/validation-ci.yml b/.github/workflows/validation-ci.yml index 9e3c45aa4..4b3db06d4 100644 --- a/.github/workflows/validation-ci.yml +++ b/.github/workflows/validation-ci.yml @@ -26,6 +26,7 @@ on: - "validation/**" - "python/**" - "core-spec/**" + - "extensions/**" - "ontology/**" - "examples/flights*.yaml" - "examples/tpcds_semantic_model.yaml" @@ -37,6 +38,7 @@ on: - "validation/**" - "python/**" - "core-spec/**" + - "extensions/**" - "ontology/**" - "examples/flights*.yaml" - "examples/tpcds_semantic_model.yaml"