feat(HEL-566): 去掉主站行情管理入口并修好模型列表收起

主站行情管理并入数据中枢
- 数据中枢数据源配置页新增「主站行情任务」卡:交易时段后台刷新开关、
  手动后台刷新、历史区间回补(任务提交 + 轮询主站 job 记录亮灯),
  数据与调度仍归主站,控制台只经桥接代操作
- 新增桥接端点 /api/hub-admin/market/{refresh,backfill};回补改为
  market.backfill 后台任务(jobs.config.json 注册,锁独立,超时 30 分钟),
  桥接调用秒回,不再阻塞
- 主站桌面端删除顶栏「行情管理」按钮与整个行情管理对话框,清理随之
  失效的 CSS;移动端删除 system/admin 页与入口,管理员专区只留数据中枢
- Tushare Token / iFinD 凭证编辑沿用数据源页既有凭证区,无功能缺失

模型池收起修复
- 拉出模型清单后按钮切换为「收起列表」,收起只留一行摘要;再次点击
  重新拉取并展开;勾选添加完成后清单自动收起(原逻辑保留)
- 交互全部沿用 HEL-558 已确认样式的既有按钮与提示组件,未新增视觉

自测
- verify_baseline 通过;pytest 492 项通过;数据中枢 240 项通过
- verify_datahub_console 新增 [11b] 行情任务桥接端到端段;UI 自测新增
  行情任务卡开关往返、模型清单展开/收起/再展开/添加自动收起,日夜主题
  与 1030 窄屏复验通过
- Playwright e2e 102/103:唯一失败项在基线提交上同样失败(本机字体度量
  导致的头部溢出,与本卡无关)

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
总工
2026-09-16 17:24:05 +08:00
co-authored by multica-agent
parent 44d6de3e2b
commit fa82b8621e
28 changed files with 563 additions and 551 deletions
-24
View File
@@ -632,7 +632,6 @@ test("admin shell opens every primary workspace and global search", async ({ pag
await expect(page.locator("#authGate")).toBeHidden();
await openHeaderCommandMenu(page);
await expect(page.locator("#settingsButton")).toBeVisible();
await expect(page.locator("#marketAdminButton")).toBeVisible();
await expect(page.locator("#syncButton")).toBeVisible();
await page.keyboard.press("Escape");
await page.locator("#alertButton").click();
@@ -1754,7 +1753,6 @@ test("regular account cannot see admin controls and member features are gated",
await mockApplication(page, session("user", false));
await page.goto("/index.html");
await expect(page.locator("#settingsButton")).toBeHidden();
await expect(page.locator("#marketAdminButton")).toBeHidden();
await expect(page.locator("#syncButton")).toBeHidden();
await expect(page.locator("#accountVipLabel")).toHaveText("非会员");
await page.locator('[data-view="screenerView"]').first().click();
@@ -2222,7 +2220,6 @@ test("native dialogs share one lifecycle and success feedback stays content-size
"alertsDialog",
"assistantDialog",
"settingsDialog",
"adminDialog",
];
await page.evaluate(() => {
@@ -3333,16 +3330,6 @@ test("global dialogs share the stage 18 geometry without changing account or adm
expect(Math.abs(accountBox.y + accountBox.height / 2 - 450)).toBeLessThanOrEqual(2);
await page.locator("#closeSettingsDialog").click();
await openHeaderCommandMenu(page);
await page.locator("#marketAdminButton").click();
await expect(page.locator("#adminDialog")).toHaveAttribute("aria-labelledby", "adminDialogTitle");
await expect(page.locator("#systemMarketForm")).toBeVisible();
const adminBox = await page.locator("#adminDialog").boundingBox();
expect(adminBox.width).toBeLessThanOrEqual(902);
expect(Math.abs(adminBox.x + adminBox.width / 2 - 720)).toBeLessThanOrEqual(2);
expect(Math.abs(adminBox.y + adminBox.height / 2 - 450)).toBeLessThanOrEqual(2);
await page.locator("#closeAdminDialog").click();
await page.setViewportSize({ width: 375, height: 812 });
await page.locator("#headerMenuButton").click();
await page.locator('[data-mobile-command-target="alertButton"]').click();
@@ -3511,12 +3498,6 @@ test("B-199 screener review and account surfaces fit day night viewports", async
await shot("account-1600-day");
await page.locator("#closeSettingsDialog").click();
await openHeaderCommandMenu(page);
await page.locator("#marketAdminButton").click();
await expect(page.locator("#adminDialog")).toBeVisible();
await shot("admin-1600-day");
await page.locator("#closeAdminDialog").click();
await page.locator("#themeToggle").click();
await expect(page.locator("html")).toHaveAttribute("data-theme", "dark");
await page.locator('[data-view="screenerView"]').first().click();
@@ -3611,7 +3592,6 @@ test("desktop header keeps refresh, admin commands and account identity visible"
await expect(page.locator("#refreshButton")).toBeVisible();
await expect(page.locator("#syncButton")).toBeVisible();
await expect(page.locator("#settingsButton")).toBeVisible();
await expect(page.locator("#marketAdminButton")).toBeVisible();
await expect(page.locator("#accountAdminBadge")).toBeVisible();
await expect(page.locator("#accountVipBadge")).toBeVisible();
await expect(page.locator("#accountButton")).toBeVisible();
@@ -3624,9 +3604,6 @@ test("desktop header keeps refresh, admin commands and account identity visible"
expect(geometry.nameFits, `${viewport.width} account name truncated`).toBe(true);
await page.locator("#refreshButton").click();
await expect(page.locator("#loadingOverlay")).toBeHidden();
await page.locator("#marketAdminButton").click();
await expect(page.locator("#adminDialog")).toBeVisible();
await page.locator("#closeAdminDialog").click();
await page.locator("#accountButton").click();
await expect(page.locator("#accountDropdown")).toBeVisible();
await page.keyboard.press("Escape");
@@ -3671,7 +3648,6 @@ test("desktop header keeps refresh, admin commands and account identity visible"
await expect(page.locator("#refreshButton")).toBeVisible();
await expect(page.locator("#syncButton")).toBeHidden();
await expect(page.locator("#settingsButton")).toBeHidden();
await expect(page.locator("#marketAdminButton")).toBeHidden();
await expect(page.locator("#accountAdminBadge")).toBeHidden();
await expect(page.locator("#accountVipBadge")).toBeVisible();
await expect(page.locator("#accountName")).toHaveText("normal_user");
+10 -27
View File
@@ -161,13 +161,6 @@ async function mockMobileApi(page, options = {}) {
},
},
};
} else if (path === "/api/admin/settings") {
payload = {
data: { configured: true, snapshot_dates: 12, background_refresh_enabled: true, ifind: { configured: false } },
llm: { models: [{ id: "model-1", name: "主模型", base_url: "https://api.openai.com/v1", model: "gpt-4.1", configured: true }], primary_model_id: "model-1", fallback_model_id: "" },
membership: { member_daily_limit: 50 },
users: [{ id: 2, username: "normal_user", role: "user", membership_subscribed: true, membership_status: "active", membership_expires_at: "2026-09-18", used_today: 3 }],
};
} else if (/^\/api\/stock\/\d+\/preview$/.test(path)) {
payload = {
meta: { trade_date: "2026-07-22", intraday_status: "available" },
@@ -264,7 +257,6 @@ const SYSTEM_PAGES = [
["system/profile", "账号资料"],
["system/password", "修改密码"],
["system/membership", "会员状态"],
["system/admin", "行情管理"],
];
const PLACEHOLDER_COPY = "该功能页将在后续批次实现";
@@ -347,7 +339,7 @@ test("system management pages render real content instead of placeholders", asyn
await expect(page.locator("#m-title")).toHaveText(label);
await expect(page.locator(".m-placeholder")).toHaveCount(0);
await expect(page.locator("#m-view")).not.toContainText(PLACEHOLDER_COPY);
await expect(page.locator("[data-system-page], [data-system-admin-panel]").first()).toBeVisible();
await expect(page.locator("[data-system-page]").first()).toBeVisible();
expect(await measureOverflow(page)).toBeLessThanOrEqual(1);
}
await navigateToFeature(page, "system/profile");
@@ -357,9 +349,10 @@ test("system management pages render real content instead of placeholders", asyn
await expect(page.locator("#m-sys-password-current")).toBeVisible();
await navigateToFeature(page, "system/membership");
await expect(page.locator(".m-sys-grid")).toBeVisible();
await navigateToFeature(page, "system/admin");
await expect(page.locator("#m-sys-token")).toBeVisible();
// HEL-566: 行情管理并入数据中枢后,管理员专区只保留数据中枢入口
await page.evaluate(() => { window.MobileRouter.navigate("#/hub/system"); });
await expect(page.locator("[data-system-datahub]")).toBeVisible();
await expect(page.locator("#m-view")).not.toContainText("行情管理");
});
test("system home groups entries and keeps admin-only items gated", async ({ page }) => {
@@ -375,20 +368,9 @@ test("system home groups entries and keeps admin-only items gated", async ({ pag
expect(await measureOverflow(page)).toBeLessThanOrEqual(1);
});
test("system settings tabs, model editor, delete confirm and theme toggle work", async ({ page }) => {
test("profile delete confirm, theme toggle and data hub entry work", async ({ page }) => {
await mockMobileApi(page);
await openMobile(page);
await navigateToFeature(page, "system/admin");
await expect(page.locator("[data-system-admin-panel='market']")).toBeVisible();
await page.locator("[data-system-admin-tab='models']").click();
await expect(page.locator("[data-system-admin-panel='models']")).toBeVisible();
await page.locator("[data-system-edit-model]").first().click();
await expect(page.locator(".m-sheet-root.is-open")).toBeVisible();
await expect(page.locator(".m-sheet-head h2")).toHaveText("编辑模型");
await page.locator("[data-sheet-close]").click();
await page.locator("[data-system-admin-tab='market']").click();
await expect(page.locator("#m-sys-token")).toBeVisible();
await navigateToFeature(page, "system/profile");
await page.locator("[data-system-delete-birth]").click();
await expect(page.locator(".m-dialog")).toBeVisible();
@@ -428,7 +410,7 @@ test("empty birth profile save shows a validation toast", async ({ page }) => {
await expect(page.locator("#m-toast")).toContainText("请填写完整出生日期和时间");
});
test("non-admin cannot open system admin pages as placeholders", async ({ page }) => {
test("non-admin sees no admin-only entries and removed admin page falls back to placeholder", async ({ page }) => {
await mockMobileApi(page, { auth: authSession("user", true) });
await openMobile(page);
await page.evaluate(() => { window.MobileRouter.navigate("#/hub/system"); });
@@ -436,9 +418,10 @@ test("non-admin cannot open system admin pages as placeholders", async ({ page }
await expect(page.locator('[data-route="#/feature/system/admin"]')).toHaveCount(0);
await expect(page.locator("[data-system-datahub]")).toHaveCount(0);
await expect(page.locator("[data-system-switch]")).toBeVisible();
await navigateToFeature(page, "system/admin");
await expect(page.locator("#m-view")).not.toContainText(PLACEHOLDER_COPY);
await expect(page.locator("[data-system-page='forbidden']")).toBeVisible();
// HEL-566: 行情管理页已删除,直达旧路由只会看到占位说明,不再有行情管理内容
await page.evaluate(() => { window.MobileRouter.navigate("#/feature/system/admin"); });
await expect(page.locator(".m-placeholder")).toBeVisible();
await expect(page.locator("#m-view")).not.toContainText("行情管理");
});
test("assistant chat renders with presets and input", async ({ page }) => {
+2 -2
View File
@@ -227,7 +227,7 @@ class FrontendBoundaryTests(unittest.TestCase):
"XiaobaiState.create",
"XiaobaiAPI.configure",
"function loadDashboard(",
"function openAdminSettings(",
"function openDataHubConsole(",
"function syncThemeControl(",
"function initializeAutoTableSorting(",
):
@@ -244,7 +244,7 @@ class FrontendBoundaryTests(unittest.TestCase):
"context.js": "XiaobaiState.create",
"application.js": "XiaobaiAPI.configure",
"dashboard.js": "function loadDashboard(",
"admin.js": "function openAdminSettings(",
"admin.js": "function openDataHubConsole(",
"theme.js": "function syncThemeControl(",
"table.js": "function initializeAutoTableSorting(",
}
+7 -8
View File
@@ -166,14 +166,13 @@ class FrontendContractTests(unittest.TestCase):
self.assertIn('id="accountDropdown"', self.html)
self.assertIn('id="settingsButton"', self.html)
def test_backfill_clears_sentiment_cache_and_reloads_sentiment_view(self):
start = self.script.index("async function backfillData")
end = self.script.index("async function openAdminSettings", start)
backfill = self.script[start:end]
self.assertIn("state.sentimentHistory = null;", backfill)
self.assertIn('state.sentimentHistoryKey = "";', backfill)
self.assertIn('if (state.activeView === "sentimentCycleView")', backfill)
self.assertIn("await loadSentimentHistory(true);", backfill)
def test_market_admin_panel_is_served_by_the_data_hub(self):
# HEL-566: 行情管理整体并入数据中枢,主站前端不再有行情管理入口与回补表单
self.assertNotIn("id=\"marketAdminButton\"", self.html)
self.assertNotIn("id=\"adminDialog\"", self.html)
self.assertNotIn("async function backfillData", self.script)
self.assertNotIn("function openAdminSettings", self.script)
self.assertNotIn("/api/backfill", self.script)
def test_screener_uses_progressive_strategy_editor(self):
for step in ("regime", "strategy", "run", "result"):
+1 -1
View File
@@ -138,7 +138,7 @@ class HttpDispatchContractTests(unittest.TestCase):
self.assertTrue(claimed.isdisjoint(methods))
claimed.update(methods)
self.assertLessEqual(len(path.read_text(encoding="utf-8").splitlines()), line_limit)
self.assertEqual(len(claimed), 28)
self.assertEqual(len(claimed), 29)
if __name__ == "__main__":
+4 -10
View File
@@ -24,12 +24,14 @@ class MobileSystemPagesRegressionTests(unittest.TestCase):
"system/profile",
"system/password",
"system/membership",
"system/admin",
],
)
for key in keys:
self.assertIn(f'"{key}": setupSystemPage', pages)
self.assertIn(f'"{key}": loadSystem', pages)
# HEL-566: 行情管理并入数据中枢后,主站不再有 system/admin 页
self.assertNotIn('"system/admin"', nav)
self.assertNotIn('"system/admin"', pages)
def test_placeholder_copy_is_only_a_router_fallback(self) -> None:
router = ROUTER.read_text(encoding="utf-8")
@@ -46,16 +48,12 @@ class MobileSystemPagesRegressionTests(unittest.TestCase):
'data-system-page="profile"',
'data-system-page="password"',
'data-system-page="membership"',
'data-system-page="forbidden"',
'data-system-admin-panel="market"',
"m-sys-birth-date",
"m-sys-password-current",
"m-sys-token",
"data-system-switch",
"data-system-datahub",
"管理员专区",
"刷新状态",
"打开数据中枢",
"数据源 · 模型池 · 会员与邀请码",
'location.assign("/login/")',
):
self.assertIn(marker, pages)
@@ -71,10 +69,6 @@ class MobileSystemPagesRegressionTests(unittest.TestCase):
for name in (
"data-system-save-birth",
"data-system-save-password",
"data-system-save-market",
"data-system-refresh",
"data-system-toggle-refresh",
"data-system-backfill",
"data-system-datahub",
):
self.assertIn(name, pages)