add relationship fields

This commit is contained in:
larssand
2026-07-02 15:07:15 +02:00
parent d48d34f96c
commit 7d0e66c239
13 changed files with 437 additions and 31 deletions

View File

@@ -5,6 +5,7 @@ from pathlib import Path
from unittest.mock import patch
from fgai.history import StatusSnapshotStore
from fgai.history import FieldDiscoveryStore
from fgai.monitor import add_llm_assessment, build_status, cached_status_with_error, write_refreshing_status, write_status
@@ -192,6 +193,24 @@ class MonitorTests(unittest.TestCase):
self.assertIn("lcs_result", suggestion["categorical_fields"])
self.assertGreater(status["baseline"]["discovery_cache_events"], 0)
def test_field_catalog_creates_discovery_events_without_raw_values(self):
with tempfile.TemporaryDirectory() as tmp:
store = FieldDiscoveryStore(str(Path(tmp) / "history.sqlite3"))
store.ingest_catalog(
"app",
"App",
[
{"name": "lcs_customer_id", "type": {"type": "string", "properties": ["enumerable"]}},
{"name": "lcs_duration_ms", "type": {"type": "long", "properties": ["numeric"]}},
],
)
events = store.synthetic_events()
fields = {field for event in events for field in event.fields}
self.assertIn("lcs_customer_id", fields)
self.assertIn("lcs_duration_ms", fields)
def test_cached_status_with_error_keeps_last_good_dashboard_data(self):
with tempfile.TemporaryDirectory() as tmp:
cache_path = str(Path(tmp) / "status-cache.sqlite3")