fix(sites): HHClub parsing, resource list layout and request restraint
HHClub (憨憨) was checked read-only against a real account (one detail
request; list, user data and health came from the product's own fetch).
Parsing fixes:
- list titles carried the site's new-torrent marker "[新]" (58 of 100
rows; the detail page title has none); stripped with a replace filter
- refreshing a detail overwrote seeders / leechers / snatched / category
name / H&R with null because the HHClub div detail page lacks them;
detail values now fall back to the list snapshot (mergeDetailOverList),
and an unknown detail promotion keeps the list promotion
- level "贵宾" is VIP (umt.vipLevels)
- sanitized minimal fixture HHANCLUB_LIST_PAGE_2026 + tests; README marks
HHClub as verified 2026-09-29
Size, counts, category ids/names, +08:00 time and subtitle were correct.
Request restraint:
- site definitions may carry umt.defaults; merged with settings.sites
(longer intervals, fewer pages): new settings defaultSnapshotMaxPages 1,
defaultHealthCheckIntervalSec 6 h, defaultDetailCacheSec 24 h; default
burst 2. HHClub: snapshot 60 min page 1 only, health 6 h, search
concurrency 1, detail cache 24 h, 1 token / 3 s burst 2
- periodic / manual snapshots are capped to that page count; scheduled
health checks skip sites checked within the interval; detail refresh is
served from cache inside the window; live searches on one site queue
- every rate-limiter token is counted per site per hour
(site_request_count, migration 0046); GET /sites/{id}/request-stats;
site overview and resource list show requests in the last 24 hours
Resource list: two-layer rows. Main line: title + spec tags (episodes,
resolution, source, codec, HDR, group, 国语/中字, site tags) + promotion
with time left + H&R. Second line: subtitle (one line, ellipsis) and
fixed-width category / size / seed-leech-snatched / upload time
(relative, absolute on hover) columns, stale badge, inventory overlay;
folds into a card on phones.
Also aligns identity_candidate.normalized_title order in db types with
the migrations (schema drift test).
Takes effect after the stack is rebuilt (migration 0046).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
20b63db254
commit
901b01d1a1
43 files changed
+1222
-1315
No files matched your search
@@ -1,16 +1,6 @@
|
||||
import type { AgentRunEvent } from "@umt/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
authDenial,
|
||||
type ConvEntry,
|
||||
groupConversation,
|
||||
isDenied,
|
||||
isLongReport,
|
||||
pairAudit,
|
||||
runPlanIds,
|
||||
toolSummary,
|
||||
} from "./agent-conversation.tsx";
|
||||
import { matchesHistory, rangeStart } from "./agent-session-list.tsx";
|
||||
import { authDenial, isDenied, pairAudit, runPlanIds } from "./agent-conversation.tsx";
|
||||
import { contextFromPath, contextPrefix, splitContextGoal } from "./agent-store.ts";
|
||||
import { foldEvents, type StreamItem, type ToolCallView } from "./use-agent-stream.ts";
|
||||
|
||||
@@ -121,67 +111,3 @@ describe("事件折叠", () => {
|
||||
expect(tools[0]?.kind === "tool" && tools[0].call).toMatchObject({ status: "succeeded", recovery: true });
|
||||
});
|
||||
});
|
||||
|
||||
describe("会话排版(AGUI-2)", () => {
|
||||
const e = (key: string, role: ConvEntry["role"], foldable = false): ConvEntry => ({
|
||||
key,
|
||||
at: key,
|
||||
role,
|
||||
foldable,
|
||||
label: foldable ? "查本地库存" : undefined,
|
||||
node: null,
|
||||
});
|
||||
it("同一助手回合归为一组,用户 / 系统条目打断回合", () => {
|
||||
const blocks = groupConversation([e("a", "assistant"), e("b", "assistant"), e("c", "user"), e("d", "assistant")]);
|
||||
expect(blocks.map((b) => b.kind)).toEqual(["turn", "single", "turn"]);
|
||||
const first = blocks[0];
|
||||
expect(first?.kind === "turn" && first.parts.length).toBe(2);
|
||||
});
|
||||
it("连续 ≥3 条可折叠的活动并成一行,不足 3 条原样展示", () => {
|
||||
const [t] = groupConversation([
|
||||
e("1", "assistant", true),
|
||||
e("2", "assistant", true),
|
||||
e("3", "assistant", true),
|
||||
e("4", "assistant"),
|
||||
e("5", "assistant", true),
|
||||
e("6", "assistant", true),
|
||||
]);
|
||||
expect(t?.kind).toBe("turn");
|
||||
if (t?.kind !== "turn") return;
|
||||
expect(t.parts.map((p) => (p.kind === "fold" ? `fold${p.entries.length}` : p.entry.key))).toEqual([
|
||||
"fold3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
]);
|
||||
});
|
||||
it("工具卡一行摘要", () => {
|
||||
expect(toolSummary({ status: "running", outputSummary: null })).toBe("等待结果…");
|
||||
expect(toolSummary({ status: "succeeded", outputSummary: '{"items":[1,2,3]}' })).toBe("3 条结果");
|
||||
expect(toolSummary({ status: "failed", outputSummary: '{"error":{"code":"x","message":"超时"}}' })).toBe("超时");
|
||||
expect(toolSummary({ status: "succeeded", outputSummary: '{"found":true,"count":2}' })).toBe(
|
||||
"found: true · count: 2",
|
||||
);
|
||||
expect(toolSummary({ status: "succeeded", outputSummary: "下载器连接超时" })).toBe("下载器连接超时");
|
||||
});
|
||||
it("长汇报判定", () => {
|
||||
expect(isLongReport("短")).toBe(false);
|
||||
expect(isLongReport("x".repeat(601))).toBe(true);
|
||||
expect(isLongReport(Array(14).fill("行").join("\n"))).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("会话历史筛选", () => {
|
||||
const now = new Date("2026-09-29T12:00:00Z").getTime();
|
||||
const run = { id: "abcd1234-0000", goal: "[上下文 作品 x] 把 沙丘 收进来", createdAt: "2026-09-25T12:00:00Z" };
|
||||
it("搜索匹配目标或 ID 前缀", () => {
|
||||
expect(matchesHistory(run, { q: "沙丘", range: "" }, now)).toBe(true);
|
||||
expect(matchesHistory(run, { q: "abcd", range: "" }, now)).toBe(true);
|
||||
expect(matchesHistory(run, { q: "奥本海默", range: "" }, now)).toBe(false);
|
||||
});
|
||||
it("时间范围按创建时间", () => {
|
||||
expect(matchesHistory(run, { q: "", range: "7d" }, now)).toBe(true);
|
||||
expect(matchesHistory(run, { q: "", range: "today" }, now)).toBe(false);
|
||||
expect(rangeStart("", now)).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user