- Authoritative candidate capture with server-issued artifacts and raw-byte
immutability hashing (source_response_hash server-owned)
- Closed-period lifecycle: request-hash bound approvals, persisted closure
immutability violations, byte-for-byte catalog stability on reclosure
- Verification runs: persisted VerificationRun model + FK migration,
publish gate (block_publish), scheduled observability runs (02:00 UTC)
- FR-013 baseline inheritance: prior_release_id migration, plan_inheritance/
execute_inheritance classification and re-extraction, API endpoints
- Visual executor bound to release-deployment environment; caller mismatch
rejected; visual SSIM/reconciliation modules
- Query execution decomposed: envelope/model/executor split, no direct SQL
- AgentRun approvals extracted to submodule; evidence adapter; _utils
- Dashboard testing service decomposed into 30+ modules (all <400 LOC)
- Five Feature-037 agent tools with permission guards (tools_037.py)
- API readiness endpoint; Alembic env/migrations; test fixture repos
- Specs 036/037 contracts, openapi.yaml, schema.json, tasks/traceability
updated; semantic index rebuilt with 0 parse warnings
- Fix ADR-0003 parser ambiguity: remove [DEF🆔ADR] prose example
- Add axiom-mcp-agent-feedback.md: agent findings for MCP rework plan
- Tests: 298 service + 1464 API + 45 agent passing; ruff clean
114 lines
4.9 KiB
Python
114 lines
4.9 KiB
Python
#region Test.BaselineEngine.StructureSnapshot.Dimensions [C:2] [TYPE Module] [SEMANTICS test,structure-snapshot,dimensions,omitted-semantic]
|
|
# @defgroup Test.BaselineEngine.StructureSnapshot.Dimensions Semantic dimension coverage tests.
|
|
# @LAYER Test
|
|
# @RELATION VERIFIES -> [BaselineEngine.StructureSnapshot.Diff]
|
|
# @TEST_EDGE omitted_semantic_dimensions -> diff covers dataset identity, chart dataset,
|
|
# filter dataset, type, column attributes, metric definition, access capability
|
|
from __future__ import annotations
|
|
|
|
from src.schemas.dashboard_testing import (
|
|
ChartQueryModel,
|
|
ColumnInfo,
|
|
ColumnRef,
|
|
DatasetQueryModel,
|
|
MetricDescriptor,
|
|
NativeFilterModel,
|
|
VizType,
|
|
)
|
|
|
|
|
|
# #region Test.StructureSnapshot.OmittedSemanticDimensions [C:2] [TYPE Class]
|
|
class TestOmittedSemanticDimensions:
|
|
"""Verify that the diff covers all semantic dimensions in DashboardQueryModel.
|
|
|
|
The required dimensions from the spec:
|
|
- dataset identity (dataset_id, dataset_uuid, dataset_name)
|
|
- chart dataset (dataset_id on ChartQueryModel)
|
|
- filter dataset (dataset_id on NativeFilterModel)
|
|
- type (viz_type, filter type, column type)
|
|
- column attributes (column_name, type, groupby, filterable)
|
|
- metric definition (metric_name, label, expression_type, column, aggregate)
|
|
- access capability (access_state on DatasetQueryModel)
|
|
"""
|
|
|
|
def test_dataset_identity_fields(self):
|
|
"""DatasetQueryModel has identity fields: dataset_id, dataset_uuid, dataset_name."""
|
|
ds = DatasetQueryModel(dataset_id=1, dataset_uuid="uuid-1", dataset_name="Test Dataset")
|
|
assert ds.dataset_id == 1
|
|
assert ds.dataset_uuid == "uuid-1"
|
|
assert ds.dataset_name == "Test Dataset"
|
|
|
|
def test_chart_dataset_field(self):
|
|
"""ChartQueryModel has dataset_id, dataset_uuid, dataset_name."""
|
|
chart = ChartQueryModel(
|
|
chart_id=10, slice_name="Test Chart", viz_type=VizType.TABLE,
|
|
dataset_id=1, dataset_name="Test Dataset",
|
|
)
|
|
assert chart.dataset_id == 1
|
|
assert chart.dataset_name == "Test Dataset"
|
|
assert chart.dataset_uuid is None
|
|
|
|
def test_filter_dataset_field(self):
|
|
"""NativeFilterModel has dataset_id and column reference."""
|
|
nf = NativeFilterModel(filter_id="NF-1", name="Region Filter", column="region",
|
|
dataset_id=42, type="STRING")
|
|
assert nf.dataset_id == 42
|
|
assert nf.column == "region"
|
|
assert nf.filter_type == "NATIVE_FILTER"
|
|
|
|
def test_type_fields(self):
|
|
"""Type fields include viz_type, filter type, column type."""
|
|
chart = ChartQueryModel(chart_id=1, slice_name="C1", viz_type=VizType.LINE,
|
|
dataset_id=1, dataset_name="DS1")
|
|
assert chart.viz_type == VizType.LINE
|
|
|
|
nf = NativeFilterModel(filter_id="F1", name="F1", column="col", dataset_id=1, type="DATE")
|
|
assert nf.type == "DATE"
|
|
|
|
col = ColumnInfo(column_name="amount", type="BIGINT", groupby=True)
|
|
assert col.type == "BIGINT"
|
|
|
|
def test_column_attributes(self):
|
|
"""ColumnInfo has column_name, type, groupby, filterable."""
|
|
col = ColumnInfo(column_name="revenue", type="FLOAT", groupby=True, filterable=True)
|
|
assert col.column_name == "revenue"
|
|
assert col.type == "FLOAT"
|
|
assert col.groupby is True
|
|
assert col.filterable is True
|
|
|
|
col2 = ColumnInfo(column_name="name", type="STRING")
|
|
assert col2.groupby is False
|
|
assert col2.filterable is False
|
|
|
|
def test_metric_definition(self):
|
|
"""MetricDescriptor has metric_name, label, expression_type, column, aggregate."""
|
|
m = MetricDescriptor(
|
|
metric_name="sum_revenue", label="Total Revenue", expression_type="SIMPLE",
|
|
column=ColumnRef(column_name="revenue", type="FLOAT"), aggregate="SUM",
|
|
)
|
|
assert m.metric_name == "sum_revenue"
|
|
assert m.label == "Total Revenue"
|
|
assert m.expression_type == "SIMPLE"
|
|
assert m.column is not None and m.column.column_name == "revenue"
|
|
assert m.aggregate == "SUM"
|
|
|
|
m2 = MetricDescriptor(
|
|
metric_name="profit", label="Profit", expression_type="SQL_EXPRESSION",
|
|
sql_expression="SUM(revenue) - SUM(cost)",
|
|
)
|
|
assert m2.expression_type == "SQL_EXPRESSION"
|
|
assert m2.sql_expression == "SUM(revenue) - SUM(cost)"
|
|
|
|
def test_access_capability(self):
|
|
"""DatasetQueryModel has access_state field."""
|
|
ds = DatasetQueryModel(dataset_id=1, dataset_name="DS1", access_state="accessible")
|
|
assert ds.access_state == "accessible"
|
|
|
|
ds2 = DatasetQueryModel(dataset_id=2, dataset_name="DS2", access_state="restricted")
|
|
assert ds2.access_state == "restricted"
|
|
|
|
ds3 = DatasetQueryModel(dataset_id=3, dataset_name="DS3", access_state="inaccessible")
|
|
assert ds3.access_state == "inaccessible"
|
|
# #endregion
|
|
#endregion Test.BaselineEngine.StructureSnapshot.Dimensions
|