feat(snapshot-admin): improve tables UX and benchmark flow

This commit is contained in:
2026-06-23 18:00:33 +09:00
parent ba7b10f9a7
commit a343db5812
3 changed files with 596 additions and 70 deletions
+27
View File
@@ -55,6 +55,12 @@ class TestSnapshotAdminWebV1(unittest.TestCase):
self.assertIn("contenteditable", html)
self.assertIn("/api/settings/save", html)
self.assertIn("/api/account_snapshot/save", html)
self.assertIn("opsBanner", html)
self.assertIn("bannerApprovalSummary", html)
self.assertIn("snapshot-panel", html)
self.assertIn("selected-field", html)
self.assertIn("settingsCountChip", html)
self.assertIn("snapshotCountChip", html)
self.assertIn("Lock target", html)
self.assertIn("Lock row", html)
self.assertIn("Approve pending", html)
@@ -74,6 +80,16 @@ class TestSnapshotAdminWebV1(unittest.TestCase):
self.assertIn("/collection", html)
self.assertIn("Open collection dashboard", html)
def test_render_tables_html_contains_table_group_summary(self):
html = render_tables_html()
self.assertIn("Snapshot Admin — Table Browser", html)
self.assertIn("tableGroupSummary", html)
self.assertIn("Workspace tables are editable only when the table is in the canonical workspace DB.", html)
self.assertIn("Table Browser", html)
self.assertIn("Save changes", html)
self.assertIn("Clear filters", html)
self.assertIn("• current", html)
def test_render_collection_html_contains_dashboard_surface(self):
html = render_collection_html()
self.assertIn("KIS Collection Dashboard", html)
@@ -116,6 +132,7 @@ class TestSnapshotAdminWebV1(unittest.TestCase):
package = json.loads((ROOT / "package.json").read_text(encoding="utf-8"))
self.assertTrue(workflow.exists())
self.assertIn("--reload", package["scripts"]["ops:snapshot-web"])
self.assertIn("--reload", package["scripts"]["ops:snapshot-web-watch"])
self.assertIn("ops:snapshot-validate", package["scripts"])
self.assertIn("ops:snapshot-web-validate", package["scripts"])
@@ -128,6 +145,10 @@ class TestSnapshotAdminWebV1(unittest.TestCase):
self.assertIn("/api/domain_rows", html)
self.assertIn("saveCurrentTable", html)
self.assertIn("gridTable", html)
self.assertIn("gridFilter", html)
self.assertIn("gridFilterRow", html)
self.assertIn("Clear filters", html)
self.assertIn("tableBannerDetail", html)
def test_list_browsable_tables_covers_all_three_databases(self):
import tempfile
@@ -141,6 +162,8 @@ class TestSnapshotAdminWebV1(unittest.TestCase):
tables = list_browsable_tables(db_path)
names = {row["table"] for row in tables}
self.assertEqual(tables[0]["table"], "account_snapshot")
self.assertEqual(tables[1]["table"], "settings")
self.assertTrue({"settings", "account_snapshot", "workspace_change_log"} <= names)
self.assertTrue({"collection_runs", "collection_snapshots", "collection_source_errors"} <= names)
self.assertTrue({"sell_strategy_results", "satellite_recommendations"} <= names)
@@ -169,6 +192,10 @@ class TestSnapshotAdminWebV1(unittest.TestCase):
page2 = fetch_table_rows("settings", db_path, limit=2, offset=2)
self.assertNotEqual(page1["rows"], page2["rows"])
filtered = fetch_table_rows("settings", db_path, limit=50, offset=0, filter_text="total_asset_krw")
self.assertEqual(filtered["total"], 1)
self.assertEqual(len(filtered["rows"]), 1)
with self.assertRaises(ValueError):
fetch_table_rows("settings; DROP TABLE settings;--", db_path)
finally: