Initial import of streamline
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import { lazy, Suspense, useState } from "react";
|
||||
import { ClipboardList, GitMerge, Hammer, History, OctagonAlert, Plus, Search, Server } from "lucide-react";
|
||||
import { getCurrentSsoUser } from "../lib/sso";
|
||||
const DemoBoard = lazy(() => import("../App").then(module => ({ default: module.AppShell })));
|
||||
import ImportDialog from "../components/ImportDialog";
|
||||
import GhostLogo from "../components/GhostLogo";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import { api } from "../lib/api";
|
||||
import type { BoardItem } from "../types";
|
||||
|
||||
type DemoRow = { id: string; title: string; status: string };
|
||||
const sections = [
|
||||
{ key: "active", title: "执行中", icon: Hammer, accepts: (s: string) => ["fixing", "awaiting_fix"].includes(s) },
|
||||
{ key: "todo", title: "待处理", icon: ClipboardList, accepts: (s: string) => ["pending_confirmation", "manual_review", "fix_succeeded"].includes(s) },
|
||||
{ key: "error", title: "异常", icon: OctagonAlert, accepts: (s: string) => s === "fix_failed" },
|
||||
{ key: "flow", title: "流转", icon: GitMerge, accepts: () => false },
|
||||
{ key: "history", title: "历史", icon: History, accepts: () => false },
|
||||
];
|
||||
|
||||
/** Demo shell uses the product's rail/list/drawer styles; no production task is changed. */
|
||||
export default function AuditDemoWorkspace({ report, tasks }: { report: Extract<BoardItem, { kind: "verify" }>; tasks: DemoRow[]; sharedIssue: string | null }) {
|
||||
const [createOpen, setCreateOpen] = useState(false);
|
||||
const [section, setSection] = useState("todo");
|
||||
const [query, setQuery] = useState("");
|
||||
const [plan, setPlan] = useState(false);
|
||||
const [selected, setSelected] = useState<string | null>(report.id);
|
||||
const [bug, setBug] = useState<BoardItem | null>(null);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const group = sections.find((s) => s.key === section)!;
|
||||
const rows = tasks.filter((task) => group.accepts(task.status) && (plan ? task.status === "pending_confirmation" : task.status !== "pending_confirmation"));
|
||||
const showReport = section === "todo" && !plan;
|
||||
const openReport = () => { setSelected(report.id); setBug(null); };
|
||||
const openBug = async (task: DemoRow) => {
|
||||
setSelected(task.id); setLoading(true);
|
||||
try { setBug({ ...await api.getTask(task.id), kind: "bug" } as BoardItem); }
|
||||
finally { setLoading(false); }
|
||||
};
|
||||
if (!selected) return <Suspense fallback={<div className="audit-demo-loading" role="status">加载看板…</div>}>
|
||||
<DemoBoard user={getCurrentSsoUser() ?? { email: "", name: "本地预览", avatarUrl: "" }} onLogout={() => {}} />
|
||||
</Suspense>;
|
||||
return <div className="audit-demo-workspace">
|
||||
<aside className="rail audit-demo-rail">
|
||||
<button className="sidebar-brand" onClick={() => { setSection("todo"); setPlan(false); openReport(); }}>
|
||||
<GhostLogo className="sidebar-brand-logo" /><span><span className="brand-initial">S</span>treamline</span>
|
||||
</button>
|
||||
<div className="sidebar-actions"><label className="audit-demo-search" style={{ flex: "3 1 0", minWidth: 0 }}><Search size={16}/><input aria-label="搜索任务" placeholder="搜索任务" value={query} onChange={(e) => setQuery(e.target.value)}/></label>
|
||||
<button className="sidebar-create" aria-label="创建" title="创建" onClick={() => setCreateOpen(true)}><Plus size={20} strokeWidth={2.4}/></button>
|
||||
</div>
|
||||
<nav className="board-tabs" role="tablist" aria-label="任务分类">
|
||||
{sections.map(({ key, title, icon: Icon, accepts }) => <button key={key} role="tab" aria-selected={section === key} className={`board-tab ${section === key ? "on" : ""}`}
|
||||
onClick={() => { setSection(key); setPlan(false); }}><Icon size={16}/><span className="board-tab-label">{title}</span><span className="board-tab-count">{tasks.filter((t) => accepts(t.status)).length + (key === "todo" ? 1 : 0)}</span></button>)}
|
||||
</nav>
|
||||
<div className="audit-demo-rail-footer"><Server size={16}/><span>本地预览</span></div>
|
||||
</aside>
|
||||
<aside className="detail-task-list" aria-label="任务列表">
|
||||
<div className="detail-task-list-tabs" role="tablist" aria-label="任务阶段">
|
||||
<button role="tab" aria-selected={plan} className={`detail-task-list-tab ${plan ? "on" : ""}`} onClick={() => setPlan(true)}>确认计划</button>
|
||||
<button role="tab" aria-selected={!plan} className={`detail-task-list-tab ${!plan ? "on" : ""}`} onClick={() => setPlan(false)}>结果审阅</button>
|
||||
</div>
|
||||
<div className="detail-task-list-scroll">
|
||||
{showReport && report.title.toLowerCase().includes(query.toLowerCase()) && <button className={`detail-task-list-item ${selected === report.id ? "is-selected" : ""}`} onClick={openReport}><strong>{report.title}</strong><small>iOS · 验证报告</small></button>}
|
||||
{rows.filter((task) => task.title.toLowerCase().includes(query.toLowerCase())).map((task) => <button key={task.id} className={`detail-task-list-item ${selected === task.id ? "is-selected" : ""}`} onClick={() => void openBug(task)}><strong>{task.title}</strong><small>iOS · Bug</small></button>)}
|
||||
{!showReport && !rows.length && <p className="audit-demo-empty">当前分类没有演示任务</p>}
|
||||
</div>
|
||||
</aside>
|
||||
{selected && <TaskDetailDrawer item={bug ?? report} onClose={() => { setSelected(null); setBug(null); }} />}
|
||||
<ImportDialog open={createOpen} onClose={() => setCreateOpen(false)} />
|
||||
{loading && <div className="audit-demo-loading" role="status">加载任务…</div>}
|
||||
</div>;
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import AuditDemoWorkspace from "./AuditDemoWorkspace";
|
||||
import type { BoardItem } from "../types";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
import type { AuditData } from "@bbbug/shared/audit_report";
|
||||
import { auditBatchTag, auditIssueIds, auditIssueNum, parseAuditVerdicts, planAuditFixMerge, renderAuditFixDescription, type AuditFixGroup, type AuditFixPick, type AuditVerdictRow } from "@bbbug/shared/audit_fix_plan";
|
||||
|
||||
/**
|
||||
* 本地演示:UI 走查的交付报告(按问题读)—— 顶上「后续执行」、开始修复 / 无需修复 / 修复所选 / 重新检查、全屏。
|
||||
* 「修复所选」先弹分组预览(同一个面合并成一张、P0/P1 和功能类单独成单),建单在本地模拟服务端的 fix-batch;
|
||||
* 合并单建好后「停泊」(演示里 40 秒,线上 15 分钟)才开跑,期间再转同一面的问题会并进去。
|
||||
* 点修复单打开抽屉,「原始问题与截图」按合并单的真实正文渲染(一条一行)。
|
||||
*
|
||||
* 报告数据是真的(只读):走 vite 代理读线上内网只读 API 的一份已完成走查;
|
||||
* 默认只读加载关联工单快照;建单、状态变更均拦截在本地,不写线上。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=https://streamline-internal-api.bytedance.net bun x vite --port 8094`,
|
||||
* 访问 /demo-audit-fix.html(`?dark=1` 看深色,`?id=<验证任务 id>` 换一份报告,
|
||||
* `?fixtures=1` 铺满各档演示状态;默认展示真实关联工单;
|
||||
* `?issue=<页面 id>:<序号>` 模拟从单条问题的分享链接进来)。
|
||||
*
|
||||
* 逐条结论(合并单修好几条就交几条):真实模式下读每张关联工单线上的 FixReport,用和服务端同一个
|
||||
* 解析器算;`?fixtures=1` 另铺一张待复核的合并单,已修复 / 未修复 / 不成立 / 不在本仓各一条以上。
|
||||
* 有真实结论的一份走查:`?id=00889383-43f7-49bd-a349-f9d6de9419bf`(Android 社交走查)。
|
||||
*/
|
||||
// The preview may reuse the full board, but never forward API mutations.
|
||||
const previewFetch = window.fetch.bind(window);
|
||||
window.fetch = ((input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const url = new URL(input instanceof Request ? input.url : String(input), location.href);
|
||||
const method = (init?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
|
||||
if (url.pathname.startsWith("/api/") && !["GET", "HEAD", "OPTIONS"].includes(method)) {
|
||||
return Promise.reject(new Error("本地预览:不向线上提交操作"));
|
||||
}
|
||||
return previewFetch(input, init);
|
||||
}) as typeof window.fetch;
|
||||
const q = new URLSearchParams(location.search);
|
||||
if (q.has("dark")) document.documentElement.dataset.theme = "dark";
|
||||
const id = q.get("id") || "e3c30b3d-4825-47c5-957e-dece098e0722";
|
||||
|
||||
type Note = { pageId: string; issueN: number; lang: string; note: string | null; filedTaskId: string | null; repro?: string | null; cause?: string | null };
|
||||
const notes: (Note & { dismissedAt?: number | null })[] = [];
|
||||
type DemoTask = { id: string; title: string; status: string; mrState: string | null; mrUrl: string | null; createdAt: number; statusChangedAt: number };
|
||||
const tasks = new Map<string, DemoTask>();
|
||||
let reportData: AuditData | null = null;
|
||||
const a = api as unknown as Record<string, unknown>;
|
||||
const readNotes = api.verificationAuditNotes;
|
||||
const readTask = api.getTask;
|
||||
const realSnapshots = new Map<string, Awaited<ReturnType<typeof api.getTask>>>();
|
||||
a.verificationAuditNotes = async () => ({ notes });
|
||||
a.saveVerificationAuditNote = async (_id: string, body: Note & { dismissed?: boolean }) => {
|
||||
const { dismissed, ...rest } = body;
|
||||
const row = { ...rest, ...(dismissed === undefined ? {} : { dismissedAt: dismissed ? Date.now() : null }) };
|
||||
const i = notes.findIndex((n) => n.pageId === body.pageId && n.issueN === body.issueN && n.lang === body.lang);
|
||||
if (i >= 0) notes[i] = { ...notes[i], ...row, filedTaskId: row.filedTaskId ?? notes[i].filedTaskId }; else notes.push(row as Note);
|
||||
return { ok: true };
|
||||
};
|
||||
// 模拟 GET /api/verifications/:id/audit-verdicts:每条问题取最近挂上的那张单,按编号对 FixReport 的逐条结论。
|
||||
const demoVerdicts = new Map<string, Map<number, AuditVerdictRow>>();
|
||||
a.verificationAuditVerdicts = async () => {
|
||||
if (!reportData) return { verdicts: [] };
|
||||
const ids = auditIssueIds(reportData.report);
|
||||
const latest = new Map<string, Note>();
|
||||
for (const n of notes) if (n.filedTaskId) latest.set(`${n.pageId}#${n.issueN}`, n);
|
||||
const out: { pageId: string; issueN: number; taskId: string; verdict: AuditVerdictRow["verdict"]; evidence: string }[] = [];
|
||||
for (const [k, n] of latest) {
|
||||
const tid = n.filedTaskId!;
|
||||
if (!demoVerdicts.has(tid)) {
|
||||
const md = tid.startsWith("demo-") || tid.startsWith("seed-") ? ""
|
||||
: await previewFetch(`/api/tasks/${encodeURIComponent(tid)}/fix-report`).then((r) => (r.ok ? r.text() : "")).catch(() => "");
|
||||
demoVerdicts.set(tid, parseAuditVerdicts(md));
|
||||
}
|
||||
const fid = ids.get(k);
|
||||
const v = fid ? demoVerdicts.get(tid)!.get(auditIssueNum(fid)) : undefined;
|
||||
if (v) out.push({ pageId: n.pageId, issueN: n.issueN, taskId: tid, verdict: v.verdict, evidence: v.evidence });
|
||||
}
|
||||
return { verdicts: out };
|
||||
};
|
||||
a.feedbackVerification = async (_id: string, text: string) => { console.log("[demo] 重新检查意见:\n" + text); return { ok: true }; };
|
||||
a.listVerificationEvidence = async () => { throw new Error("demo: 证据一律走卫星代理"); };
|
||||
a.getTask = async (tid: string) => {
|
||||
if (realSnapshots.has(tid)) return realSnapshots.get(tid)!;
|
||||
const t = tasks.get(tid);
|
||||
if (!t) throw new Error("not found");
|
||||
const merged = demoGroups.get(tid);
|
||||
if (merged && reportData) {
|
||||
// 和服务端同一个渲染器;截图走走查任务的证据代理(线上是转存到 TOS 的 plan 图)。
|
||||
const files = Object.fromEntries(reportData.shots.map((sh) => [sh.file, api.verificationEvidenceFileUrl(id, sh.file)]));
|
||||
const noteOf = Object.fromEntries(notes.filter((n) => n.note).map((n) => [`${n.pageId}#${n.issueN}`, { note: n.note }]));
|
||||
const description = renderAuditFixDescription(merged, { data: reportData, source: { id, title: reportData.report.title }, notes: noteOf, files });
|
||||
return { ...t, platform: "ios", clusters: [], watchers: [], tags: [auditBatchTag(id)], description };
|
||||
}
|
||||
const note = notes.find((n) => n.filedTaskId === tid);
|
||||
const page = reportData?.report.pages.find((p) => p.id === note?.pageId);
|
||||
const issue = page?.issues.find((i) => i.n === note?.issueN);
|
||||
const shot = reportData?.shots.find((s) => s.pageId === page?.id && s.lang === note?.lang);
|
||||
return { ...t, platform: "ios", clusters: [], watchers: [],
|
||||
description: `${t.title}\n\n来源:验证任务「${reportData?.report.title}」(${id})\n\n${issue?.text ?? "演示问题"}\n\n${issue?.detail ?? ""}\n\n${shot ? `证据:\`${shot.file}\`` : ""}` };
|
||||
};
|
||||
// Local transitions exercise the same drawer/report refresh chain without production writes.
|
||||
function transitionTask(tid: string, status: string, allowed?: string[]) {
|
||||
const task = realSnapshots.get(tid) ?? tasks.get(tid);
|
||||
if (!task) throw new Error("not found");
|
||||
if (allowed && !allowed.includes(task.status)) throw new Error(`cannot transition from status ${task.status}`);
|
||||
const updated = { ...task, status, statusChangedAt: Date.now() };
|
||||
tasks.set(tid, updated as DemoTask);
|
||||
if (realSnapshots.has(tid)) realSnapshots.set(tid, updated as Awaited<ReturnType<typeof api.getTask>>);
|
||||
return { ok: true };
|
||||
}
|
||||
a.confirmPlan = async (tid: string) => transitionTask(tid, "awaiting_fix", ["pending_confirmation"]);
|
||||
a.reviewApprove = async (tid: string) => transitionTask(tid, "fix_succeeded", ["manual_review"]);
|
||||
a.reviewReject = async (tid: string) => transitionTask(tid, "awaiting_fix", ["manual_review"]);
|
||||
a.archive = async (tid: string) => transitionTask(tid, "archived");
|
||||
a.reopen = async (tid: string) => transitionTask(tid, "manual_review");
|
||||
a.taskBatchPulse = async () => ({ batches: [] });
|
||||
// Creation forms are preview-only; never submit other task kinds to production.
|
||||
for (const method of ["createVerification", "createFeature", "createPrototype", "createSecurity"]) {
|
||||
a[method] = async () => { throw new Error("本地预览:仅展示创建表单,不提交任务"); };
|
||||
}
|
||||
a.import = async (text: string) => {
|
||||
await new Promise((r) => setTimeout(r, 400));
|
||||
const tid = `demo-${Math.random().toString(16).slice(2, 10)}`;
|
||||
// 新建的单和线上一样先停在「待确认执行」,8 秒后「修复中」、20 秒后「修复完成」——
|
||||
// 报告每分钟刷一次修复单,所以要等下一次刷新才看得到变化。
|
||||
const now = Date.now();
|
||||
tasks.set(tid, { id: tid, title: text.split("\n")[0].replace(/^#\s*/, ""), status: "pending_confirmation", mrState: null, mrUrl: null, createdAt: now, statusChangedAt: now });
|
||||
setTimeout(() => { const t = tasks.get(tid); if (t) { t.status = "fixing"; t.statusChangedAt = Date.now(); } }, 8_000);
|
||||
setTimeout(() => { const t = tasks.get(tid); if (t) { t.status = "fix_succeeded"; t.statusChangedAt = Date.now(); } }, 20_000);
|
||||
return { added: [{ id: tid, title: text.split("\n")[0] }], skipped: [] };
|
||||
};
|
||||
// 模拟 POST /api/verifications/:id/fix-batch:分组和并单用和服务端同一份 planAuditFixMerge。
|
||||
// 合并单复现已确认、直接进修复队列,先停泊(待修复)40 秒,期间同一面上再转的问题并进去;
|
||||
// 单独成单的先评估,停在「待确认执行」。
|
||||
const demoGroups = new Map<string, AuditFixGroup>();
|
||||
const PARK_DEMO_MS = 40_000;
|
||||
a.fileAuditFixes = async (_vid: string, body: { picks: AuditFixPick[]; dryRun?: boolean }) => {
|
||||
await new Promise((r) => setTimeout(r, body.dryRun ? 250 : 600));
|
||||
if (!reportData) throw new Error("报告还没加载");
|
||||
const data = reportData;
|
||||
const parked = [...demoGroups].filter(([tid, g]) => g.trusted && tasks.get(tid)?.status === "awaiting_fix")
|
||||
.map(([tid, g]) => ({ taskId: tid, title: g.title, surface: g.surface, picks: g.picks }));
|
||||
const plan = planAuditFixMerge(body.picks, parked, data.report);
|
||||
const appended = plan.appends.map((x) => ({ taskId: x.taskId, title: x.title, picks: x.added, total: x.picks.length }));
|
||||
if (body.dryRun) {
|
||||
return { batchTag: auditBatchTag(id), appended, created: plan.groups.map((g) => ({ taskId: "", title: g.title, trusted: g.trusted, picks: g.picks })), skipped: [], failed: [] };
|
||||
}
|
||||
const now = Date.now();
|
||||
const step = (tid: string, ms: number, status: string) => setTimeout(() => { const t = tasks.get(tid); if (t) { t.status = status; t.statusChangedAt = Date.now(); } }, ms);
|
||||
for (const x of plan.appends) {
|
||||
demoGroups.set(x.taskId, { trusted: true, surface: x.surface, title: x.title, sev: x.sev, picks: x.picks });
|
||||
const t = tasks.get(x.taskId)!;
|
||||
t.title = x.title;
|
||||
for (const p of x.added) notes.push({ pageId: p.pageId, issueN: p.n, lang: p.lang, note: null, filedTaskId: x.taskId });
|
||||
}
|
||||
const created = plan.groups.map((g) => {
|
||||
const tid = `demo-${Math.random().toString(16).slice(2, 10)}`;
|
||||
demoGroups.set(tid, g);
|
||||
tasks.set(tid, { id: tid, title: g.title, status: g.trusted ? "awaiting_fix" : "initializing", mrState: null, mrUrl: null, createdAt: now, statusChangedAt: now });
|
||||
if (g.trusted) { step(tid, PARK_DEMO_MS, "fixing"); step(tid, PARK_DEMO_MS + 30_000, "manual_review"); } else step(tid, 6_000, "pending_confirmation");
|
||||
for (const p of g.picks) notes.push({ pageId: p.pageId, issueN: p.n, lang: p.lang, note: null, filedTaskId: tid });
|
||||
return { taskId: tid, title: g.title, trusted: g.trusted, picks: g.picks };
|
||||
});
|
||||
return { batchTag: auditBatchTag(id), appended, created, skipped: [], failed: [] };
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const data = await api.verificationAuditReport(id) as AuditData;
|
||||
reportData = data;
|
||||
const issues = data.report.pages.flatMap((p) => p.issues.map((i) => ({ p, i })));
|
||||
const lang = (i: { langs: string[] }) => i.langs[0] ?? data.report.langs[0];
|
||||
const H = 3_600_000, now = Date.now();
|
||||
// 线上真实的那一张:ruyiliu 10-14 21:58 转的,至今「待确认执行」。
|
||||
const real = issues.find((x) => x.p.id === "s1-profile/10-edit-profile-ai-self-sheet" && x.i.n === 2);
|
||||
if (real) {
|
||||
const tid = "e115c1ef-0296-409e-82c9-a243c109160d";
|
||||
tasks.set(tid, { id: tid, title: "[UI] AI Self 介绍半屏是业务自绘的介绍页,没有用 TUX 的 Intro sheet 组件", status: "pending_confirmation",
|
||||
mrState: null, mrUrl: null, createdAt: 1792040281689, statusChangedAt: 1792040281689 });
|
||||
notes.push({ pageId: real.p.id, issueN: real.i.n, lang: lang(real.i), note: null, filedTaskId: tid });
|
||||
}
|
||||
// F-19:人补充的复现条件和原因(线上同样写在 verification_notes 里)。
|
||||
const f19 = issues.find((x) => x.p.id === "s1-profile/12-find-friends" && x.i.n === 1);
|
||||
if (f19) notes.push({ pageId: f19.p.id, issueN: 1, lang: lang(f19.i), note: null, filedTaskId: null,
|
||||
repro: "我 → 右上角「加好友」图标 → Find friends,看下方「new suggested accounts」里昵称和 handle 都很短(宽度都不到约 100pt,大约 12 个字符以内)、推荐理由是「Friends with + 共同好友头像」的那张推人卡片。本次实例:测试账号 @b236874 看到的 @yyyyyyy8523(昵称 Yyyyyyy)。en / de 都出现(de 为「Be / fre / un」)。handle 长的卡片正常,所以大多数账号看不到。采集环境:TikTokM 47.3.0(473000)inhouse M-Staff,macCatalyst + DeviceSim(iPhone16,1 画像 394×854pt),非构造态。",
|
||||
cause: "为什么是一字一行、只剩 3 行:「Friends with」排成一行大约要 75pt 宽,但这张卡片只给这段文字留了 16pt(不到两个字母宽),所以每行只能放 2–3 个字母,被拆成 Fri / en / ds / wi / th;而文字框只有 51pt 高、放得下 3 行,后面的「with」被截掉看不到。\n为什么只留 16pt:卡片里「昵称 / handle / 推荐理由」是竖着排的一列,这一列多宽取决于昵称和 handle 里较长的那个。这张卡片的 handle @yyyyyyy8523 很短,整列只有 96pt;推荐理由那一行要放「Friends with」+ 共同好友头像,大约要 100pt,放不下。放不下时布局先压缩优先级最低的元素 —— 推荐理由的文字(横向抗压缩 defaultLow),头像不缩,于是文字被一路压窄。\n对照:同页 handle 长的那张卡片(@chihiro_test_the_first_t)整列 238pt,推荐理由正常;同一账号在 Following list 里「Friends with」是正常的 77pt 一行。\n未确认:为什么压到 16pt 而不是只少几 pt,要看这一行的具体约束,没追到;macCatalyst 字体度量与真机可能差 1–2pt,但触发条件是数据,不依赖环境。代码:Modules/TikTokUserRecommend/…/UserSuggestion/View/Card/UserSuggestionCard.swift(labelsStackView 左对齐,ttkswift_userSuggestionReasonLabel)。" } as Note);
|
||||
if (!q.has("real")) {
|
||||
// 再铺满其余各档,挑 P2/P3(P0/P1 留着未处置,好让「下一步」第一条出现)。
|
||||
const pool = issues.filter((x) => x !== real && (x.i.sev === "P2" || x.i.sev === "P3"));
|
||||
const seeded: [string, string, string | null, number][] = [
|
||||
["待确认执行", "pending_confirmation", null, 3], ["修复中", "fixing", null, 5], ["修复中", "awaiting_fix", null, 2],
|
||||
["待复核", "manual_review", null, 6], ["未修好", "fix_failed", null, 30], ["修复完成", "fix_succeeded", null, 20],
|
||||
["MR 已合入", "fix_succeeded", "merged", 40], ["MR 已合入", "fix_succeeded", "merged", 44],
|
||||
];
|
||||
seeded.forEach(([label, status, mr, agoH], k) => {
|
||||
const hit = pool[k * 7];
|
||||
if (!hit) return;
|
||||
const tid = `seed-${k}`;
|
||||
tasks.set(tid, { id: tid, title: `[UI] ${hit.p.id.split("/")[1]} · 演示单(${label})`, status, mrState: mr,
|
||||
mrUrl: mr ? "https://bits.bytedance.net/" : null, createdAt: now - agoH * H, statusChangedAt: now - agoH * H });
|
||||
notes.push({ pageId: hit.p.id, issueN: hit.i.n, lang: lang(hit.i), note: null, filedTaskId: tid });
|
||||
});
|
||||
// 一张修好了一部分的合并单:待复核,单里各条结论不一样。
|
||||
const mixed = pool.slice(60, 65);
|
||||
if (mixed.length === 5) {
|
||||
const tid = "seed-mixed";
|
||||
const ids = auditIssueIds(data.report);
|
||||
tasks.set(tid, { id: tid, title: `[UI] ${mixed[0].p.id.split("/")[1]}… 等 5 个问题 · 演示合并单(部分修好)`, status: "manual_review", mrState: null,
|
||||
mrUrl: "https://bits.bytedance.net/", createdAt: now - 5 * H, statusChangedAt: now - H });
|
||||
const rows: [AuditVerdictRow["verdict"], string][] = [
|
||||
["已修复", "evidence/before-1-x.png → evidence/after-1-x.png;热区 28×28pt → 44×44pt"],
|
||||
["已修复", "evidence/after-1-y.png;间距 8 → 12dp"],
|
||||
["未修复", "改成 TuxButton 后 de 下文案截断,回退了;试过缩字号和两行,都不符合规范"],
|
||||
["不成立", "实测头像距弹窗左缘 16dp、距标题 22dp,符合规范;走查量的是距屏幕左缘(12dp)。evidence/mech-1-spacing-measured.png"],
|
||||
["不在本仓", "页面是 gecko 下发的 Lynx 模板,本仓没有布局源码"],
|
||||
];
|
||||
demoVerdicts.set(tid, new Map(mixed.map((x, i) => [auditIssueNum(ids.get(`${x.p.id}#${x.i.n}`) ?? ""), { verdict: rows[i][0], evidence: rows[i][1] }])));
|
||||
for (const x of mixed) notes.push({ pageId: x.p.id, issueN: x.i.n, lang: lang(x.i), note: null, filedTaskId: tid });
|
||||
}
|
||||
for (const k of [3, 10, 17]) {
|
||||
const hit = pool[k * 5 + 1];
|
||||
if (hit) notes.push({ pageId: hit.p.id, issueN: hit.i.n, lang: lang(hit.i), note: null, filedTaskId: null, dismissedAt: now - 2 * H });
|
||||
}
|
||||
}
|
||||
if (!q.has("fixtures")) {
|
||||
const saved = await readNotes(id).catch(() => ({ notes: [] }));
|
||||
notes.splice(0, notes.length, ...saved.notes);
|
||||
tasks.clear();
|
||||
await Promise.all([...new Set(saved.notes.flatMap((n) => n.filedTaskId ? [n.filedTaskId] : []))].map(async (tid) => {
|
||||
try {
|
||||
const task = await readTask(tid);
|
||||
realSnapshots.set(tid, task);
|
||||
tasks.set(tid, task as unknown as DemoTask);
|
||||
} catch { /* Deleted or inaccessible linked work orders retain their error state when opened. */ }
|
||||
}));
|
||||
}
|
||||
const snapshot = await api.getVerification(id).catch(() => null);
|
||||
const item = { ...snapshot, kind: "verify", id, title: snapshot?.title ?? data.report.title,
|
||||
platform: snapshot?.platform ?? "ios", watchers: snapshot?.watchers ?? [], clusters: snapshot?.clusters ?? [],
|
||||
status: "report_ready", hasAuditReport: true, readableReportGeneratedAt: 1 };
|
||||
// The real drawer is reused, but all demo actions remain local.
|
||||
for (const action of ["acceptVerification", "archiveVerification", "reopenVerification", "abortVerification", "pinVerification", "unpinVerification", "deleteVerification", "saveVerificationDescription", "setVerificationWatchers", "regenVerificationReport"]) {
|
||||
a[action] = async () => ({ ok: true });
|
||||
}
|
||||
for (const action of ["pin", "unpin", "delete", "abort", "revertPlan", "evalRetry", "submitMr", "remark", "saveDescription", "setWatchers", "saveReviewFeedback", "remind", "confirmWontFix", "reopenReview", "setArchiveCategory", "fillArchiveFeedback"]) {
|
||||
a[action] = async () => ({ ok: true });
|
||||
}
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<><AuditDemoWorkspace report={item as unknown as Extract<BoardItem, { kind: "verify" }>} tasks={[...tasks.values()]} sharedIssue={q.get("issue")} /><Toaster /><DialogHost /></>,
|
||||
);
|
||||
}
|
||||
void main();
|
||||
@@ -0,0 +1,218 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { setLang, useI18n } from "../lib/i18n";
|
||||
import { api, type MeegoViewCheckJob, type MeegoViewImportJob } from "../lib/api";
|
||||
import BatchCreate from "../components/BatchCreate";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
import { assignBuckets, type CheckItem, type CheckMr } from "@bbbug/shared/batch_import_check";
|
||||
import type { BatchRoute } from "../components/BatchCenter";
|
||||
|
||||
/**
|
||||
* 本地演示:新建批量任务的「导入前检查」。不连任何接口——api 上用到的几个方法换成假数据,
|
||||
* 一个 320 张单的假视图按设定的速度逐条「检查」完。工单标题、人名、MR 号全是编的。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-batch-import.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const TOTAL = 320;
|
||||
const LISTING_MS = 2500;
|
||||
let msPerItem = 60; // 「快」:约 20 秒查完;「真实」约 200 ms/张(6 路并发下每分钟 300 张)
|
||||
let bitsFlaky = false;
|
||||
// 视图里眼下一条单都没有:照样能建项目,建好直接进托管。
|
||||
let viewEmpty = false;
|
||||
// 个人 Meego 授权:插件读不了视图时要发起人自己授权(真实情况就是这样,所以默认开)。
|
||||
let needsAuth = true;
|
||||
let authorized = false;
|
||||
let approval: "none" | "self" | "other" = "none";
|
||||
|
||||
// ── 假数据 ───────────────────────────────────────────────────────────────────
|
||||
|
||||
let seed = 7;
|
||||
const rnd = () => ((seed = (seed * 1103515245 + 12345) % 2147483648) / 2147483648);
|
||||
const pick = <T,>(xs: T[]) => xs[Math.floor(rnd() * xs.length)];
|
||||
|
||||
const PLAT = ["【iOS】", "【Android】", "[iOS]", "[Android]", "【双端】"];
|
||||
const PAGE = ["个人主页", "关注列表", "粉丝列表", "好友推荐", "私信会话", "通讯录好友", "共同关注", "资料编辑页", "访客记录", "搜索用户结果页"];
|
||||
const BUG = ["头像偶现不显示", "下拉刷新后列表重复", "关注按钮状态和实际不一致", "深色模式下文字看不清", "切到后台再回来白屏",
|
||||
"长昵称把按钮挤出屏幕", "阿拉伯语下箭头方向反了", "点返回后输入框内容丢失", "空态插画位置偏移", "快速连点出现两个弹窗",
|
||||
"折叠屏展开后布局错乱", "横竖屏切换后红点消失", "网络慢时 loading 不消失", "取消关注后计数没减"];
|
||||
const AUTHORS = ["chen.ming", "lisa.zhao", "wang.hao", "omnifix-bot", "kevin.li", "sun.yue"];
|
||||
|
||||
function fakeItems(): CheckItem[] {
|
||||
seed = 7;
|
||||
const items: CheckItem[] = [];
|
||||
const titles: string[] = [];
|
||||
for (let n = 0; n < TOTAL; n++) {
|
||||
const id = String(7_310_000_000 + Math.floor(rnd() * 90_000_000));
|
||||
const r = rnd();
|
||||
let title = `${pick(PLAT)}${pick(PAGE)}${pick(BUG)}(v${40 + Math.floor(rnd() * 8)}.${Math.floor(rnd() * 10)},第 ${n + 1} 号)`;
|
||||
if (r < 0.04 && titles.length) title = pick(titles); // 重复单
|
||||
if (r > 0.98) title = "该反馈为话题分享,无法提取 bug name";
|
||||
titles.push(title);
|
||||
const it: CheckItem = {
|
||||
meegoId: id, url: `https://meego.larkoffice.com/tiktok/issue/detail/${id}`, checked: false,
|
||||
title, meegoState: "OPEN", meegoOpen: true, mrs: [], existing: null, bucket: "ready", warnings: [],
|
||||
};
|
||||
const k = rnd();
|
||||
if (k < 0.06) it.existing = { taskId: `t-${n}`, status: pick(["fix_succeeded", "unreproducible", "awaiting_review", "executing"]), clusters: [], tags: pick([[], ["social_q3"]]) };
|
||||
else if (k < 0.17) {
|
||||
const st = pick(["merged", "merged", "opened", "opened", "closed"]);
|
||||
const mrs: CheckMr[] = [{ mrId: 8_400_000 + Math.floor(rnd() * 90_000), title: `[Bug Fix] ${title}`, author: pick(AUTHORS), state: st, url: "#" }];
|
||||
if (rnd() < 0.3) mrs.push({ mrId: 8_400_000 + Math.floor(rnd() * 90_000), title: `WIP: [Bug Fix] ${title}`, author: "omnifix-bot", state: "opened", url: "#" });
|
||||
it.mrs = mrs;
|
||||
} else if (k < 0.25) { it.meegoState = pick(["RESOLVED", "CLOSED", "CLOSED", "FIX IN FUTURE"]); it.meegoOpen = false; }
|
||||
else if (k < 0.28) { it.mrs = null; it.warnings.push("Bits 的 MR 查询失败,没法确认有没有人在修"); }
|
||||
else if (k < 0.29) { it.meegoState = null; it.meegoOpen = null; it.warnings.push("Meego 没查到这张单的状态"); }
|
||||
items.push(it);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
let checkJob: { job: MeegoViewCheckJob; truth: CheckItem[]; t0: number; authFail: boolean } | null = null;
|
||||
|
||||
function snapshot(): MeegoViewCheckJob {
|
||||
if (!checkJob) throw new Error("not found");
|
||||
const { job, truth, t0, authFail } = checkJob;
|
||||
if (authFail) {
|
||||
return Date.now() - t0 < 1200 ? { ...job, phase: "listing" }
|
||||
: { ...job, phase: "done", finishedAt: t0 + 1200, needsMeegoAuth: true, error: "控制面的 Meego 插件没有读视图的权限,要用你本人的 Meego 授权来读" };
|
||||
}
|
||||
const el = Date.now() - t0;
|
||||
if (el < LISTING_MS) return { ...job, phase: "listing", total: 0, done: 0, items: [] };
|
||||
if (viewEmpty) return { ...job, phase: "done", total: 0, done: 0, items: [], finishedAt: t0 + LISTING_MS };
|
||||
const done = Math.min(TOTAL, Math.floor((el - LISTING_MS) / msPerItem));
|
||||
const items = truth.map((it, i): CheckItem => {
|
||||
if (i >= done) return { ...it, checked: false, title: null, meegoState: null, meegoOpen: null, mrs: null, existing: null, warnings: [] };
|
||||
if (bitsFlaky && it.mrs && it.mrs.length === 0 && i % 5 === 0) return { ...it, checked: true, mrs: null, warnings: ["Bits 的 MR 查询失败,没法确认有没有人在修"] };
|
||||
return { ...it, checked: true };
|
||||
});
|
||||
assignBuckets(items);
|
||||
const finished = done >= TOTAL;
|
||||
// 以个人授权读的视图拿不到视图名(meegle 的 view get 不返回),名称留给人填。
|
||||
return { ...job, name: authorized ? null : "Social Relation 存量 bug(演示)", phase: finished ? "done" : "checking", total: TOTAL, done, items,
|
||||
finishedAt: finished ? t0 + LISTING_MS + TOTAL * msPerItem : null };
|
||||
}
|
||||
|
||||
let importJob: { job: MeegoViewImportJob; links: string[]; t0: number } | null = null;
|
||||
|
||||
Object.assign(api, {
|
||||
clustersList: async () => ({ clusters: ["default", "evaluator", "social"] }),
|
||||
startMeegoViewCheck: async (url: string) => {
|
||||
await new Promise((r) => setTimeout(r, 400));
|
||||
if (!/meego/.test(url)) throw new Error("没有识别到视图链接或工单链接(工单链接形如 …/<项目>/<类型>/detail/<id>)");
|
||||
checkJob = {
|
||||
job: { id: `demo-${Date.now().toString(36)}`, startedAt: Date.now(), finishedAt: null, phase: "listing", name: null, source: url, total: 0, done: 0, items: [], error: null },
|
||||
truth: fakeItems(), t0: Date.now(), authFail: needsAuth && !authorized && /View\//.test(url),
|
||||
};
|
||||
return snapshot();
|
||||
},
|
||||
meegoAuth: {
|
||||
status: async () => ({ state: "authorized", account: "you@example.com", refreshExpiresAt: null }),
|
||||
begin: async () => {
|
||||
await new Promise((r) => setTimeout(r, 700));
|
||||
approval = "none";
|
||||
return { url: "about:blank", completeToken: "demo", reused: false };
|
||||
},
|
||||
complete: async () => {
|
||||
if (approval === "self") { authorized = true; return { state: "authorized", account: "you@example.com", refreshExpiresAt: null }; }
|
||||
if (approval === "other") { approval = "none"; return { state: "mismatch", account: "someone.else@example.com" }; }
|
||||
return { state: "pending" };
|
||||
},
|
||||
},
|
||||
meegoViewCheckJob: async (id: string) => {
|
||||
if (!checkJob || checkJob.job.id !== id) throw new Error("not found");
|
||||
return snapshot();
|
||||
},
|
||||
startMeegoViewImport: async (body: { links: { meegoId: string }[] }) => {
|
||||
importJob = {
|
||||
job: { id: "imp", startedAt: Date.now(), finishedAt: null, total: body.links.length, done: 0, added: [], retagged: [], skipped: [], error: null },
|
||||
links: body.links.map((l) => l.meegoId), t0: Date.now(),
|
||||
};
|
||||
return importJob.job;
|
||||
},
|
||||
meegoViewImportJob: async () => {
|
||||
if (!importJob) throw new Error("not found");
|
||||
const { job, links, t0 } = importJob;
|
||||
const done = Math.min(links.length, Math.floor((Date.now() - t0) / 40));
|
||||
const existing = new Set(checkJob?.truth.filter((i) => i.existing).map((i) => i.meegoId));
|
||||
const slice = links.slice(0, done);
|
||||
return {
|
||||
...job, done,
|
||||
added: slice.filter((id) => !existing.has(id)).map((id) => ({ meegoId: id, taskId: id, title: "" })),
|
||||
retagged: slice.filter((id) => existing.has(id)).map((id) => ({ meegoId: id, taskId: id })),
|
||||
skipped: done >= links.length ? [{ meegoId: links[0] ?? "-", reason: "duplicate" }] : [],
|
||||
finishedAt: done >= links.length ? Date.now() : null,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
// ── 外壳 ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
function Demo() {
|
||||
const { lang } = useI18n();
|
||||
const L = (zh: string, en: string) => (lang === "en" ? en : zh);
|
||||
const [route, setRoute] = useState<BatchRoute>({ view: "batches", create: true });
|
||||
const [speed, setSpeed] = useState<"fast" | "real">("fast");
|
||||
const [flaky, setFlaky] = useState(false);
|
||||
const [empty, setEmpty] = useState(viewEmpty);
|
||||
const [authOn, setAuthOn] = useState(needsAuth);
|
||||
const [mount, setMount] = useState(0);
|
||||
|
||||
const navigate = (r: BatchRoute) => setRoute(r);
|
||||
const restart = () => { checkJob = null; importJob = null; authorized = false; approval = "none"; setRoute({ view: "batches", create: true }); setMount((m) => m + 1); };
|
||||
const loseJob = () => { checkJob = null; setMount((m) => m + 1); };
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="demo-bar">
|
||||
<div className="demo-step">
|
||||
<b>新建批量任务 · 导入前检查(假数据)</b>
|
||||
<span>贴一个视图链接(形如 …/tiktok/issueView/xxx),点「开始检查」。先会要你授权自己的 Meego 账号:点「去 Meego 授权」(演示里打开空白页),再点右边「模拟:批准授权」,就会自动接着读。检查跑着的时候可以填右边设置;查完在底栏导入。</span>
|
||||
</div>
|
||||
<div className="demo-actions">
|
||||
<div className="filter-seg" role="group" aria-label="速度">
|
||||
<button type="button" className={speed === "fast" ? "on" : ""} onClick={() => { setSpeed("fast"); msPerItem = 60; }}>快(20 秒)</button>
|
||||
<button type="button" className={speed === "real" ? "on" : ""} onClick={() => { setSpeed("real"); msPerItem = 200; }}>接近真实(约 1 分钟 / 300 张)</button>
|
||||
</div>
|
||||
<label className="demo-check"><input type="checkbox" checked={authOn} onChange={(e) => { needsAuth = e.target.checked; setAuthOn(e.target.checked); }} /> 插件读不了视图(要个人授权)</label>
|
||||
<button type="button" className="bc-btn" onClick={() => { approval = "self"; }}>模拟:批准授权</button>
|
||||
<button type="button" className="bc-btn" onClick={() => { approval = "other"; }}>模拟:用别人账号批准</button>
|
||||
<label className="demo-check"><input type="checkbox" checked={empty} onChange={(e) => { viewEmpty = e.target.checked; setEmpty(e.target.checked); }} /> 视图是空的</label>
|
||||
<label className="demo-check"><input type="checkbox" checked={flaky} onChange={(e) => { bitsFlaky = e.target.checked; setFlaky(e.target.checked); }} /> Bits 查询部分失败</label>
|
||||
<button type="button" className="bc-btn" onClick={loseJob} disabled={!route.check}>模拟控制面重启</button>
|
||||
<div className="filter-seg" role="group" aria-label="语言">
|
||||
<button type="button" className={lang === "zh" ? "on" : ""} onClick={() => setLang("zh")}>中</button>
|
||||
<button type="button" className={lang === "en" ? "on" : ""} onClick={() => setLang("en")}>EN</button>
|
||||
</div>
|
||||
<button type="button" className="bc-btn" onClick={restart}>重来</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bc">
|
||||
{route.create
|
||||
? <BatchCreate key={mount} checkId={route.check ?? null} navigate={navigate} L={L} isAdmin />
|
||||
: <div className="bc-page"><div className="bc-empty"><b>(演示)这里会进入批次详情:{route.tag}</b><button type="button" className="bc-btn" onClick={restart}>重来</button></div></div>}
|
||||
</div>
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.demo-bar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--elev, #fff); border-bottom: 1px solid var(--border, #e5e7eb); box-shadow: 0 2px 10px rgba(0,0,0,.05); flex-wrap: wrap; }
|
||||
.demo-step { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2, #444); }
|
||||
.demo-step b { font-size: 15px; color: var(--text, #111); }
|
||||
.demo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.demo-check { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2, #444); }
|
||||
.bc { padding: 24px 16px; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
setLang("zh");
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,178 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { setLang, useI18n } from "../lib/i18n";
|
||||
import { api, type MeegoViewImportJob } from "../lib/api";
|
||||
import BatchImportPanel from "../components/BatchImportPanel";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
import type { CheckMr } from "@bbbug/shared/batch_import_check";
|
||||
import type { ImportItem, ImportLog, ImportRun } from "@bbbug/shared/batch_import_log";
|
||||
|
||||
/**
|
||||
* 本地演示:批次详情 →「导入记录」(BatchImportPanel)。不连任何接口,api 上用到的几个方法换成假数据。
|
||||
* 比例照 2026-10-21 那次真实导入:视图 143 张,新建 117、补标签 8、摘掉 18(已有 MR 13、Meego 已解决 5)。
|
||||
* 工单号、标题、人名、MR 号全是编的。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-batch-import-log.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
type Scenario = "real" | "failures" | "legacy";
|
||||
|
||||
let seed = 11;
|
||||
const rnd = () => ((seed = (seed * 1103515245 + 12345) % 2147483648) / 2147483648);
|
||||
const pick = <T,>(xs: T[]) => xs[Math.floor(rnd() * xs.length)];
|
||||
const PLAT = ["【iOS】", "【Android】", "[iOS]", "[Android]"];
|
||||
const PAGE = ["图文详情页", "发布页", "编辑页", "探索页", "双列 Feed", "模板选择页", "相册选择页", "评论面板"];
|
||||
const BUG = ["多图切换偶现白屏", "文案回填错误", "清屏按钮样式不对", "横屏后子 Tab 消失", "指示器响应上下滑", "埋点缺字段", "RTL 下标题对齐反了", "Live 图封面闪一下"];
|
||||
const AUTHORS = ["chen.ming", "lisa.zhao", "wang.hao", "kevin.li"];
|
||||
// 真实视图里常有中英双语的长标题(「… / Decorative cards are still displayed …」),专门用来看表格会不会被撑开。
|
||||
const LONG = " / Decorative cards are still displayed in the text editing page background after switching templates";
|
||||
const title = (n: number) => `${pick(PLAT)}${pick(PAGE)}${pick(BUG)}(演示 #${n})${n % 3 === 0 ? LONG : ""}`;
|
||||
const mr = (state: string): CheckMr => ({ mrId: 8_400_000 + Math.floor(rnd() * 90_000), title: "[Bug Fix] …", author: pick(AUTHORS), state, url: "#" });
|
||||
|
||||
const T0 = Date.now() - 3 * 3_600_000;
|
||||
let log: ImportLog;
|
||||
let failingIds = new Set<string>();
|
||||
|
||||
function build(s: Scenario) {
|
||||
seed = 11;
|
||||
const items: ImportItem[] = [];
|
||||
const base = (n: number, over: Partial<ImportItem>): ImportItem => {
|
||||
const id = String(7_300_000_000 + Math.floor(rnd() * 90_000_000));
|
||||
return { meegoId: id, url: `https://meego.larkoffice.com/tiktok/issue/detail/${id}`, title: title(n), outcome: "created", reason: null, evidence: null,
|
||||
taskId: `t-${n}`, runId: "r1", attempts: 1, updatedAt: T0 + n * 900, ignoredAt: null, ignoredBy: null, ...over };
|
||||
};
|
||||
let n = 0;
|
||||
const failN = s === "failures" ? 4 : 0;
|
||||
const pendN = s === "failures" ? 3 : 0;
|
||||
for (let i = 0; i < 117 - failN - pendN; i++) items.push(base(++n, {}));
|
||||
for (let i = 0; i < 8; i++) items.push(base(++n, { outcome: "retagged" }));
|
||||
const errs = ["Meego 接口超时(30s):GET /open_api/tiktok/work_item/issue/…", "Product profile is unavailable", "fetch failed: ECONNRESET", "Meego 返回 403:Check Token Perm Failed"];
|
||||
for (let i = 0; i < failN; i++) items.push(base(++n, { outcome: "failed", reason: errs[i], taskId: null }));
|
||||
for (let i = 0; i < pendN; i++) items.push(base(++n, { outcome: "pending", taskId: null, attempts: 0 }));
|
||||
const rechecked = s === "legacy" ? { recheckedAt: Date.now() } : {};
|
||||
const mrStates = ["opened", "opened", "opened", "opened", "merged", "closed", "closed", "closed", "closed", "closed", "closed", "closed", "closed"];
|
||||
for (const st of mrStates) items.push(base(++n, { outcome: "set_aside", reason: s === "legacy" ? "unknown" : "mr", taskId: null, attempts: 0,
|
||||
evidence: { meegoState: "OPEN", mrs: st === "closed" && rnd() < 0.3 ? [mr("closed"), mr("closed")] : [mr(st)], ...rechecked } }));
|
||||
for (let i = 0; i < 5; i++) items.push(base(++n, { outcome: "set_aside", reason: s === "legacy" ? "unknown" : "closed", taskId: null, attempts: 0,
|
||||
evidence: { meegoState: "FIX IN FUTURE", mrs: [], ...rechecked } }));
|
||||
const runs: ImportRun[] = [{
|
||||
id: "r1", tag: "photo_mode_demo", kind: s === "legacy" ? "legacy" : "import", startedBy: "you@example.com", startedAt: T0, finishedAt: T0 + 140_000,
|
||||
source: "https://meego.larkoffice.com/tiktok/issueView/DEMO", total: 117 + 8, created: 117 - failN - pendN, retagged: 8, setAside: 18, failed: failN,
|
||||
error: pendN ? "控制面重启,导入中断" : null,
|
||||
}];
|
||||
log = { runs, items, activeJobId: null };
|
||||
failingIds = new Set(items.filter((i) => i.outcome === "failed").slice(0, 1).map((i) => i.meegoId)); // 重试时这一张还会失败
|
||||
// 旧批次:原因在后台补查,3 秒后补上。
|
||||
if (s === "legacy") {
|
||||
window.setTimeout(() => {
|
||||
const now = Date.now();
|
||||
let k = 0;
|
||||
log = { ...log, items: log.items.map((it) => it.reason === "unknown" ? { ...it, reason: k++ < 13 ? "mr" : "closed", evidence: { ...it.evidence, recheckedAt: now } } : it) };
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
let job: { job: MeegoViewImportJob; ids: string[]; t0: number } | null = null;
|
||||
const snapshotJob = (): MeegoViewImportJob => {
|
||||
if (!job) throw new Error("not found");
|
||||
const done = Math.min(job.ids.length, Math.floor((Date.now() - job.t0) / 500));
|
||||
const slice = job.ids.slice(0, done);
|
||||
const finished = done >= job.ids.length;
|
||||
if (finished && job.job.finishedAt == null) {
|
||||
// 落到「库」里:和服务端一样逐张写结果,补一行导入历史。
|
||||
const now = Date.now();
|
||||
const failed = slice.filter((id) => failingIds.has(id));
|
||||
log = {
|
||||
...log,
|
||||
items: log.items.map((it) => !slice.includes(it.meegoId) ? it : failingIds.has(it.meegoId)
|
||||
? { ...it, outcome: "failed", reason: "Meego 接口超时(30s):GET /open_api/tiktok/work_item/issue/…", attempts: it.attempts + 1, updatedAt: now, runId: "r-retry" }
|
||||
: { ...it, outcome: "created", reason: null, taskId: `t-${it.meegoId}`, attempts: it.attempts + 1, updatedAt: now, ignoredAt: null, ignoredBy: null, runId: "r-retry" }),
|
||||
runs: [{ id: `r-${now}`, tag: "photo_mode_demo", kind: "retry", startedBy: "you@example.com", startedAt: job.t0, finishedAt: now, source: `重试 ${job.ids.length} 张`,
|
||||
total: job.ids.length, created: job.ids.length - failed.length, retagged: 0, setAside: 0, failed: failed.length, error: null }, ...log.runs],
|
||||
activeJobId: null,
|
||||
};
|
||||
job.job = { ...job.job, finishedAt: now };
|
||||
}
|
||||
return {
|
||||
...job.job, done,
|
||||
added: slice.filter((id) => !failingIds.has(id)).map((id) => ({ meegoId: id, taskId: id, title: "" })),
|
||||
skipped: slice.filter((id) => failingIds.has(id)).map((id) => ({ meegoId: id, reason: "Meego 接口超时" })),
|
||||
};
|
||||
};
|
||||
|
||||
Object.assign(api, {
|
||||
batchImports: async () => { await new Promise((r) => setTimeout(r, 200)); return { ...log, activeJobId: job && job.job.finishedAt == null ? job.job.id : null }; },
|
||||
batchImportRetry: async (_tag: string, ids: string[]) => {
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
const j: MeegoViewImportJob = { id: `j-${Date.now()}`, startedAt: Date.now(), finishedAt: null, total: ids.length, done: 0, added: [], retagged: [], skipped: [], error: null, tag: "photo_mode_demo" };
|
||||
job = { job: j, ids, t0: Date.now() };
|
||||
return j;
|
||||
},
|
||||
batchImportJob: async () => snapshotJob(),
|
||||
batchImportIgnore: async (_tag: string, ids: string[], ignored: boolean) => {
|
||||
const now = Date.now();
|
||||
log = { ...log, items: log.items.map((it) => ids.includes(it.meegoId) ? { ...it, ignoredAt: ignored ? now : null, ignoredBy: ignored ? "you@example.com" : null } : it) };
|
||||
return { changed: ids.length };
|
||||
},
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const { lang } = useI18n();
|
||||
const L = (zh: string, en: string) => (lang === "en" ? en : zh);
|
||||
const [scenario, setScenario] = useState<Scenario>("real");
|
||||
const [mount, setMount] = useState(0);
|
||||
const go = (s: Scenario) => { build(s); job = null; setScenario(s); setMount((m) => m + 1); };
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="demo-bar">
|
||||
<div className="demo-step">
|
||||
<b>批次详情 · 导入记录(假数据)</b>
|
||||
<span>
|
||||
{scenario === "real" && "照 photo_mode_mobile 那次:143 张进来 125 张,18 张被导入前检查摘掉(已有 MR 13、Meego 已解决 5)。点「照样导入」或勾几张批量导入;点「忽略」移到已忽略。"}
|
||||
{scenario === "failures" && "导入时有 4 张失败(错误原文)、3 张因控制面重启没跑完。重试时会有 1 张仍然失败。"}
|
||||
{scenario === "legacy" && "留痕上线前导入的批次:第一次打开时按库里的任务补记,没进来的原因后台补查(约 3 秒后出现,标「事后补查」)。"}
|
||||
</span>
|
||||
</div>
|
||||
<div className="demo-actions">
|
||||
<div className="filter-seg" role="group" aria-label="场景">
|
||||
<button type="button" className={scenario === "real" ? "on" : ""} onClick={() => go("real")}>只有摘掉的</button>
|
||||
<button type="button" className={scenario === "failures" ? "on" : ""} onClick={() => go("failures")}>有导入失败</button>
|
||||
<button type="button" className={scenario === "legacy" ? "on" : ""} onClick={() => go("legacy")}>旧批次补记</button>
|
||||
</div>
|
||||
<div className="filter-seg" role="group" aria-label="语言">
|
||||
<button type="button" className={lang === "zh" ? "on" : ""} onClick={() => setLang("zh")}>中</button>
|
||||
<button type="button" className={lang === "en" ? "on" : ""} onClick={() => setLang("en")}>EN</button>
|
||||
</div>
|
||||
<button type="button" className="bc-btn" onClick={() => go(scenario)}>重来</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bc">
|
||||
<div className="bc-page">
|
||||
<BatchImportPanel key={mount} tag="photo_mode_demo" L={L} />
|
||||
</div>
|
||||
</div>
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.demo-bar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--elev, #fff); border-bottom: 1px solid var(--border, #e5e7eb); box-shadow: 0 2px 10px rgba(0,0,0,.05); flex-wrap: wrap; }
|
||||
.demo-step { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2, #444); }
|
||||
.demo-step b { font-size: 15px; color: var(--text, #111); }
|
||||
.demo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.demo-check { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2, #444); }
|
||||
.bc { padding: 24px 16px; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
build("real");
|
||||
setLang("zh");
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,370 @@
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import BatchDetail from "../components/BatchDetail";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
import DrawerBatchCard from "../components/DrawerBatchCard";
|
||||
import { showBatchPulse } from "../lib/batchPulse";
|
||||
import { clearConfetti } from "../lib/confetti";
|
||||
import {
|
||||
buildEfficiency, buildProgress, fixBucketOf, stageOf,
|
||||
landingGroupOf, mrLandingOf, qaStateOf,
|
||||
type BatchArchivedRow, type BatchLandingRow, type BatchLeaderboard, type BatchMeta, type BatchOverview, type BatchPulse, type ProgressTask,
|
||||
} from "@bbbug/shared/batch_center";
|
||||
import type { BatchReport } from "../lib/api";
|
||||
import type { ReopenTriageAction, ReopenTriageRecord, ReopenVerdict } from "@bbbug/shared/reopen_triage";
|
||||
|
||||
/**
|
||||
* 本地演示:用假数据把一批单子从导入走到存量完成,看批次页的三个阶段和完成、动效(batchJoy.tsx)、
|
||||
* 复核通过之后的落地看板、分享战报,和任务抽屉「复核通过」的进度卡(batchPulse.tsx)。不连任何
|
||||
* 接口——api 上用到的几个方法全换成假数据。
|
||||
*
|
||||
* 「重新打开」= 把详情页卸掉再挂上,等于负责人离开后再进来(上次看到的数字在 localStorage 里);
|
||||
* 「停在页面上」= 点页面右上角的刷新,等于 60 秒一次的自动刷新拿到了新数字。
|
||||
*
|
||||
* 「视角」切换负责人和经办人(只读,从任务抽屉点进来);「抽屉」那一步是
|
||||
* 一个模拟的任务抽屉,里面的「所在批次」和「复核通过」用的是真组件。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-batch-joy.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const TAG = "demo_batch";
|
||||
const H = 3_600_000;
|
||||
|
||||
/**
|
||||
* reopened:复核通过后被 QA 在 Meego 上重新打开的条数(不含在 fixed 里)。
|
||||
* land:fixed 里复核通过之后走到哪了——landed QA 验过且 MR 已合入、merge QA 验过 MR 待合入、
|
||||
* mrClosed MR 关了没合入;其余是待 QA 验证。不写就按 10% / 25% 估一个。
|
||||
*/
|
||||
interface State {
|
||||
fixed: number; review: number; running: number; closed: number; recall: number; reopened?: number;
|
||||
land?: { landed: number; merge: number; mrClosed?: number };
|
||||
/** 进这一步时已经核实过的 QA 打回(k 是第几条打回)。 */
|
||||
triaged?: { k: number; verdict: ReopenVerdict; reason: string; note?: string; action?: ReopenTriageAction }[];
|
||||
}
|
||||
type Who = "admin" | "owner" | "viewer";
|
||||
interface Step {
|
||||
title: string;
|
||||
desc: string;
|
||||
/** open 重新打开;live 停在页面上刷新;drawer 打开模拟的任务抽屉;share 点右上角「分享」。 */
|
||||
kind: "open" | "live" | "drawer" | "share";
|
||||
/** 这一步用谁的视角(不写就沿用上一步的)。 */
|
||||
who?: Who;
|
||||
s: State;
|
||||
board: Record<string, number>;
|
||||
}
|
||||
|
||||
const STEPS: Step[] = [
|
||||
{ kind: "open", title: "① 刚导入,第一次打开", desc: "平台执行期:头条是平台执行进度。第一次打开没有记录,从 24 小时前滚起,不出横幅。",
|
||||
s: { fixed: 4, review: 6, running: 50, closed: 0, recall: 0 }, board: { "binzhang": 3, "andrew.tong": 2, "lisa.chen": 1 } },
|
||||
{ kind: "live", title: "② 停在页面上,机器出结果", desc: "自动刷新拿到新数字:数字滚动、进度条生长,冒「+4 修复」,从进度条喷一小股礼花。",
|
||||
s: { fixed: 8, review: 22, running: 30, closed: 0, recall: 0 }, board: { "binzhang": 8, "andrew.tong": 6, "lisa.chen": 4, "jiangdingkui": 4 } },
|
||||
{ kind: "open", title: "③ 第二天再打开:升级", desc: "机器基本跑完,进入「人工复核」:横幅「升级」,阶段条扫光,从阶段条放礼花。",
|
||||
s: { fixed: 24, review: 25, running: 8, closed: 2, recall: 1 }, board: { "binzhang": 9, "andrew.tong": 7, "lisa.chen": 5, "jiangdingkui": 4, "wei.zhou": 1 } },
|
||||
{ kind: "open", title: "④ 离开一晚再打开:突破 50%", desc: "「你离开的 N 小时里」横幅;50% 刻度点亮并闪,从刻度喷礼花;排行旁出现绿色 −N,wei.zhou 清零。",
|
||||
s: { fixed: 34, review: 17, running: 4, closed: 4, recall: 1 }, board: { "binzhang": 6, "andrew.tong": 5, "lisa.chen": 4, "jiangdingkui": 3 } },
|
||||
{ kind: "live", title: "⑤ 停在页面上:连续修复(1)", desc: "又修好一条。", s: { fixed: 35, review: 16, running: 4, closed: 4, recall: 1 }, board: { "binzhang": 5, "andrew.tong": 5, "lisa.chen": 4, "jiangdingkui": 3 } },
|
||||
{ kind: "live", title: "⑥ 停在页面上:连续修复(2)", desc: "5 分钟内第二次:「连击 ×2」。", s: { fixed: 36, review: 15, running: 4, closed: 4, recall: 1 }, board: { "binzhang": 4, "andrew.tong": 5, "lisa.chen": 4, "jiangdingkui": 3 } },
|
||||
{ kind: "live", title: "⑦ 停在页面上:连续修复(3)", desc: "「连击 ×3」。", s: { fixed: 37, review: 14, running: 4, closed: 4, recall: 1 }, board: { "binzhang": 4, "andrew.tong": 4, "lisa.chen": 4, "jiangdingkui": 3 } },
|
||||
{ kind: "open", title: "⑧ 再打开:突破 75%", desc: "75% 刻度点亮,jiangdingkui 清零。", s: { fixed: 43, review: 8, running: 2, closed: 5, recall: 2 }, board: { "binzhang": 4, "andrew.tong": 3, "lisa.chen": 3 } },
|
||||
{ kind: "open", title: "⑧½ QA 打回了 2 条", desc: "QA 在 Meego 上把 2 条复核通过的单重新打开:它们退出「已修复」、算回剩余,进度往回掉;修复构成上方的「QA 打回」卡片列出这 2 条(打回率、Meego 状态、MR、谁点的通过);排行里经办人名下多了这 2 条。",
|
||||
s: { fixed: 41, reopened: 2, review: 8, running: 2, closed: 5, recall: 2 }, board: { "binzhang": 5, "andrew.tong": 4, "lisa.chen": 3 } },
|
||||
{ kind: "drawer", who: "viewer", title: "⑨ 经办人视角:任务抽屉", desc: "经办人一般只在抽屉里干活。标签下面多了「所在批次」:整批走到哪了。点「复核通过」——底部弹「这一单 ✓ 通过 · 90% → 92%」,从按钮喷礼花,「所在批次」跟着更新。",
|
||||
s: { fixed: 49, review: 3, running: 0, closed: 6, recall: 2 }, board: { "binzhang": 2, "andrew.tong": 2, "lisa.chen": 1 } },
|
||||
{ kind: "open", who: "viewer", title: "⑩ 经办人点「所在批次」:只读批次页", desc: "同一个页面的只读版:页头「只读」;看不到运行与节点、通知、设置;第四张卡换成「你名下 N 条待处理」,排行里自己那行标「你」;归档类别不能改。进度已过 90%,但还有单等复核,阶段仍是「人工复核」。",
|
||||
s: { fixed: 49, review: 3, running: 0, closed: 6, recall: 2 }, board: { "binzhang": 2, "andrew.tong": 2, "lisa.chen": 1 } },
|
||||
{ kind: "open", who: "owner", title: "⑪ 复核完成 80%:存量完成", desc: "复核完成 ≥ 80%,存量算完成(「存量完成!」横幅 + 礼炮),接着进入完成之后的落地验收。指标卡换成真正落地、QA 验证、MR 合入、QA 打回;概览头一张是「复核通过之后」看板:五组下一步等谁、QA × MR 交叉表、每一条。页头右上角多了一个小小的分享按钮。",
|
||||
s: { fixed: 53, review: 0, running: 0, closed: 6, recall: 1, land: { landed: 6, merge: 18, mrClosed: 1 } }, board: { "lisa.chen": 1 } },
|
||||
{ kind: "share", who: "owner", title: "⑫ 点右上角「分享」", desc: "弹出战报图,可以下载 / 复制;头条下面写上 QA 已验证、MR 已合入的条数。存量完成之后才有这个按钮,谁都能点。",
|
||||
s: { fixed: 53, review: 0, running: 0, closed: 6, recall: 1, land: { landed: 6, merge: 18, mrClosed: 1 } }, board: { "lisa.chen": 1 } },
|
||||
{ kind: "open", who: "owner", title: "⑬ QA 打回了 3 条", desc: "QA 在 Meego 上把 3 条重新打开:它们退出已修复,进度往回掉,但阶段不退——打回正是这一段要盯的。「QA 打回」卡红色、排到最前,指标卡上也标红,点「去处理 ↓」跳过去。每条右边有「核实」,可以点开看看。",
|
||||
s: { fixed: 50, reopened: 3, review: 0, running: 0, closed: 6, recall: 1, land: { landed: 8, merge: 17, mrClosed: 1 } }, board: { "binzhang": 2, "andrew.tong": 1, "lisa.chen": 1 } },
|
||||
{ kind: "open", who: "owner", title: "⑭ 逐条核实打回", desc: "每条打回右边一个「核实」:确实修错了就标注原因,单子留在打回里;是误报就记下原因、选流转到哪(改回已解决 / 归档),单子随即离开打回。这一步预置了两条核实:一条修错了、一条误报已改回已解决——看卡片底部的核实记录。剩下那条你自己点「核实」试试。",
|
||||
s: { fixed: 50, reopened: 3, review: 0, running: 0, closed: 6, recall: 1, land: { landed: 8, merge: 17, mrClosed: 1 },
|
||||
triaged: [{ k: 0, verdict: "fix_wrong", reason: "incomplete", note: "弱网下还会回滚一次,QA 附了录屏" }, { k: 1, verdict: "false_alarm", reason: "wrong_build", note: "QA 验的是 47.1.0,修复在 47.2.0", action: "resolved" }] },
|
||||
board: { "andrew.tong": 1, "lisa.chen": 1 } },
|
||||
{ kind: "open", who: "owner", title: "⑮ 一周后:QA 验完、MR 陆续合入", desc: "打回的单重跑后又通过了,最后一条也有了结论(烟花);QA 验得差不多,MR 大半合入:真正落地从 15% 涨到 70%,数字从上次看到的滚上来。还没到 90%,仍是落地验收。",
|
||||
s: { fixed: 54, review: 0, running: 0, closed: 6, recall: 0, land: { landed: 38, merge: 13, mrClosed: 1 } }, board: {} },
|
||||
{ kind: "open", who: "owner", title: "⑯ 两周后:落地过 90%,全部落地", desc: "复核通过的单 91% 已真正落地(「全部落地!」横幅 + 礼炮),阶段条全勾,左卡「已完成 · 已落地」。节省人日、R0 修复率在页头下面第三张卡「效率结算」里,和增量合起来看。日报到这里停发。",
|
||||
s: { fixed: 54, review: 0, running: 0, closed: 6, recall: 0, land: { landed: 49, merge: 4, mrClosed: 1 } }, board: {} },
|
||||
{ kind: "share", who: "owner", title: "⑰ 结算后分享", desc: "战报里的数字是打开那一刻的:QA 已验证、MR 已合入都涨了。",
|
||||
s: { fixed: 54, review: 0, running: 0, closed: 6, recall: 0, land: { landed: 49, merge: 4, mrClosed: 1 } }, board: {} },
|
||||
];
|
||||
|
||||
// ── 假数据 ───────────────────────────────────────────────────────────────────
|
||||
|
||||
let cur: State = STEPS[0].s;
|
||||
let who: Who = "owner";
|
||||
/** QA 打回的核实:记录,以及被核实成误报、已经流转走的打回(第几条 → 改回已解决 / 归档)。每一步重置。 */
|
||||
const triage = { records: [] as ReopenTriageRecord[], gone: new Map<number, ReopenTriageAction>() };
|
||||
function addTriage(k: number, v: { verdict: ReopenVerdict; reason: string; note?: string | null; action?: ReopenTriageAction | null }, at = Date.now()) {
|
||||
triage.records.unshift({ id: `tr${triage.records.length}`, taskId: `ro${k}`, verdict: v.verdict, reason: v.reason, note: v.note ?? null, action: v.action ?? null, meegoState: "REOPENED", by: "jingyuan.yi@bytedance.com", at });
|
||||
if (v.verdict === "false_alarm" && v.action) triage.gone.set(k, v.action);
|
||||
}
|
||||
let board: Record<string, number> = STEPS[0].board;
|
||||
const start = Date.now() - 6 * 24 * H;
|
||||
|
||||
function tasksOf(s: State): (ProgressTask & { platform: string })[] {
|
||||
const out: (ProgressTask & { platform: string })[] = [];
|
||||
const add = (n: number, status: string, meegoState: string | null = null, mrState: string | null = null) => {
|
||||
for (let i = 0; i < n; i++) out.push({ id: `t${out.length}`, status, meegoState, mrState, mrUrl: mrState ? "https://example.invalid/mr" : null, platform: out.length % 9 < 5 ? "ios" : "android" } as ProgressTask & { platform: string });
|
||||
};
|
||||
const land = s.land ?? { landed: Math.floor(s.fixed * 0.1), merge: Math.floor(s.fixed * 0.25) };
|
||||
const mrClosed = land.mrClosed ?? 0;
|
||||
add(land.landed, "fix_succeeded", "CLOSED", "merged");
|
||||
add(land.merge, "fix_succeeded", "CLOSED", "opened");
|
||||
add(mrClosed, "fix_succeeded", "CLOSED", "closed");
|
||||
add(s.fixed - land.landed - land.merge - mrClosed, "fix_succeeded", "RESOLVED", "opened");
|
||||
// QA 打回的单 id 固定为 ro<k>:核实成误报之后它变成已解决或归档,标题和 id 都不变。
|
||||
for (let k = 0; k < (s.reopened ?? 0); k++) {
|
||||
const gone = triage.gone.get(k);
|
||||
out.push({
|
||||
id: `ro${k}`, status: gone === "archived" ? "archived" : "fix_succeeded", meegoState: gone === "resolved" ? "RESOLVED" : "REOPENED",
|
||||
mrState: "opened", mrUrl: "https://example.invalid/mr", archiveReason: gone === "archived" ? "server_bug" : null, platform: k % 2 ? "ios" : "android",
|
||||
} as ProgressTask & { platform: string });
|
||||
}
|
||||
add(s.review, "manual_review"); add(s.running, "fixing"); add(s.closed, "archived"); add(s.recall, "fix_failed");
|
||||
return out;
|
||||
}
|
||||
|
||||
function overview(): BatchOverview {
|
||||
const tasks = tasksOf(cur);
|
||||
// 过去 24 小时:让最近修好的 3 条落在 24 小时内。
|
||||
const settledAt = new Map(tasks.map((t, i) => [t.id, Date.now() - (i < 3 ? 2 * H : 48 * H)] as [string, number]));
|
||||
const progress = buildProgress(tasks, settledAt, Date.now());
|
||||
const efficiency = buildEfficiency(tasks.map((t, i) => ({ bucket: fixBucketOf(t), sendbacks: i % 6 === 5 ? 1 : i % 13 === 12 ? 3 : 0 })), 1);
|
||||
const days = Array.from({ length: 7 }, (_, i) => {
|
||||
const d = new Date(start + i * 24 * H);
|
||||
return { day: d.toISOString().slice(0, 10), fixed: Math.round((cur.fixed * (i + 1)) / 7), added: 0 };
|
||||
});
|
||||
const archived: BatchArchivedRow[] = Array.from({ length: cur.closed }, (_, i) => ({
|
||||
id: `a${i}`, title: `演示归档单 ${i + 1}`, archivedAt: Date.now() - i * 5 * H, by: "binzhang",
|
||||
reason: ["ai_fix_wrong", "fixed_elsewhere", "cant_verify"][i % 3], note: null, source: "manual", classifiedBy: "binzhang",
|
||||
} as BatchArchivedRow));
|
||||
// 再加几条平台本来就不该修的(服务端 bug、不是问题)和一条没分类的,看归档原因的分组。
|
||||
if (cur.closed) archived.push(
|
||||
...(["server_bug", "server_bug", "not_a_bug", "not_a_bug", null] as const).map((reason, i) => ({
|
||||
id: `x${i}`, title: `演示归档单(${reason ?? "未分类"})`, archivedAt: Date.now() - (i + 9) * 5 * H, by: "andrew.tong",
|
||||
reason, note: null, source: reason ? "manual" : null, classifiedBy: reason ? "andrew.tong" : null,
|
||||
} as BatchArchivedRow)),
|
||||
);
|
||||
const plat = (p: string) => ({ platform: p, total: tasks.filter((t) => t.platform === p).length, fixed: tasks.filter((t) => t.platform === p && t.status === "fix_succeeded").length });
|
||||
return {
|
||||
meta: metaOf(),
|
||||
startedAt: start, progress, series: days, platforms: [plat("ios"), plat("android")], archived, efficiency,
|
||||
landing: tasks.filter((t) => t.status === "fix_succeeded").map((t, i): BatchLandingRow => {
|
||||
const qa = qaStateOf(t.meegoState);
|
||||
const mr = mrLandingOf(t);
|
||||
return {
|
||||
id: t.id, title: titleOf(t.id, i), platform: t.platform,
|
||||
meegoId: `680${i}000`, meegoUrl: "https://example.invalid/meego", meegoState: t.meegoState ?? "", mrUrl: t.mrUrl ?? null, mrState: t.mrState ?? null,
|
||||
mergedAt: mr === "merged" ? Date.now() - (i % 5) * 24 * H : null,
|
||||
approvedAt: Date.now() - (2 + (i % 9)) * 24 * H - i * H, approvedBy: ["binzhang@bytedance.com", "andrew.tong@bytedance.com", null][i % 3],
|
||||
qa, mr, group: landingGroupOf(qa, mr),
|
||||
triage: (qa === "reopened" && triage.records.find((r) => r.taskId === t.id && r.verdict === "fix_wrong")) || null,
|
||||
};
|
||||
}).sort((a, b) => LANDING_ORDER.indexOf(a.group) - LANDING_ORDER.indexOf(b.group) || (a.approvedAt ?? 0) - (b.approvedAt ?? 0)),
|
||||
reopenTriage: triage.records.map((r) => ({ ...r, title: titleOf(r.taskId, 0) })),
|
||||
last24h: { steps: 5, people: 3, unrecorded: 0 }, digestHistory: [],
|
||||
nextDigestAt: stageOf(progress) === "review" ? Date.now() + 5 * H : null,
|
||||
access: { admin: who === "admin", owner: who === "owner", me: who === "viewer" ? "binzhang" : who === "admin" ? "jingyuan.yi" : "xiaoxiang.wu" },
|
||||
};
|
||||
}
|
||||
|
||||
const titleOf = (id: string, i: number) => (id.startsWith("ro") ? REOPENED_TITLES[Number(id.slice(2)) % REOPENED_TITLES.length] : `【演示】复核通过的单 ${i + 1}`);
|
||||
const REOPENED_TITLES = ["【演示】私信列表下拉刷新后未读数不清零", "【演示】关注按钮在弱网下状态回滚", "【演示】粉丝列表滑到底重复加载"];
|
||||
const LANDING_ORDER = ["reopened", "mr_closed", "qa", "merge", "landed"];
|
||||
|
||||
function metaOf(): BatchMeta {
|
||||
return {
|
||||
tag: TAG, name: "演示批次 · social_relation", owners: ["xiaoxiang.wu@bytedance.com"], description: "假数据,只用来看动效。",
|
||||
createdBy: null, createdAt: start, digestEnabled: true, lastDigestAt: null, digestTz: "America/Los_Angeles", remindDaily: false, lastRemindAt: null, saved: true,
|
||||
};
|
||||
}
|
||||
|
||||
function leaderboard(): BatchLeaderboard {
|
||||
const rows = Object.entries(board).filter(([, n]) => n > 0).sort((a, b) => b[1] - a[1])
|
||||
.map(([prefix, total]) => ({ prefix, total, counts: { qa_reopened: 0, review_nomr: total, review_mr: 0, recall: 0, confirm: 0 } }));
|
||||
return { generatedAt: Date.now(), rows, unassigned: 0, importer: "jingyuan.yi@bytedance.com" };
|
||||
}
|
||||
|
||||
function report(): BatchReport {
|
||||
const s = cur;
|
||||
const ev = Math.round(s.running * 0.3), q = Math.round(s.running * 0.3), run = s.running - ev - q;
|
||||
const phases = { evaluating: ev, waiting_human: s.review + s.recall, queued: q, running: run, settled: s.fixed + s.closed };
|
||||
const half = (n: number) => Math.ceil(n / 2);
|
||||
const platRow = (platform: string, k: number) => ({
|
||||
platform, total: 30, fixSlots: 2, remaining: half(s.running) * k + 0, etaHours: s.running ? s.running * 0.4 : 0,
|
||||
phases: { evaluating: half(ev), waiting_human: half(s.review), queued: half(q), running: half(run), settled: half(s.fixed + s.closed) },
|
||||
outcomes: {},
|
||||
});
|
||||
return {
|
||||
tag: TAG, generatedAt: Date.now(), total: 60, settled: s.fixed + s.closed, settledRatio: (s.fixed + s.closed) / 60,
|
||||
phases, outcomes: {}, effectiveSuccessRate: null, infraRate: null,
|
||||
durations: { eval: { n: 0, p50Min: null, p90Min: null }, queue: { n: 0, p50Min: null, p90Min: null }, exec: { n: 20, p50Min: 42, p90Min: 95 } },
|
||||
settledLast24h: 3, attemptsHistogram: {}, failureReasons: [],
|
||||
platforms: [platRow("ios", 1), platRow("android", 1)],
|
||||
nodes: [
|
||||
{ id: "fei-ios-01", platform: "ios", live: true, alerts: [], evalInFlight: 1, evalCapacity: 1, fixInFlight: 1, fixCapacity: 1, runningTaskIds: [], settled: 8, infraFailed: 0, backlog: half(s.running), etaHours: s.running * 0.4 },
|
||||
{ id: "fei-android-01", platform: "android", live: true, alerts: [], evalInFlight: 1, evalCapacity: 1, fixInFlight: 1, fixCapacity: 1, runningTaskIds: [], settled: 6, infraFailed: 1, backlog: half(s.running), etaHours: s.running * 0.4 },
|
||||
],
|
||||
issues: s.running ? [{ kind: "stuck", severity: "warn", message: "演示:一条单在排队里等了 3 小时" }] : [],
|
||||
tasks: [],
|
||||
} as unknown as BatchReport;
|
||||
}
|
||||
|
||||
const pulseOf = (s: State): BatchPulse[] => {
|
||||
const p = buildProgress(tasksOf(s), new Map(), Date.now());
|
||||
return [{ tag: TAG, name: "演示批次 · social_relation", total: p.total, fixed: p.fixed, settled: p.settled, settledRate: p.settledRate, stage: stageOf(p) }];
|
||||
};
|
||||
|
||||
Object.assign(api, {
|
||||
batchOverview: async () => overview(),
|
||||
batchLeaderboard: async () => leaderboard(),
|
||||
batchReport: async () => report(),
|
||||
batchFlow: async () => { throw new Error("演示页没有「人员与推进」的假数据"); },
|
||||
batchReopenTriage: async (_tag: string, body: { taskId: string; verdict: ReopenVerdict; reason: string; note: string | null; action: ReopenTriageAction | null }) => {
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
addTriage(Number(body.taskId.slice(2)), body);
|
||||
return triage.records[0];
|
||||
},
|
||||
});
|
||||
|
||||
// ── 演示控制栏 ───────────────────────────────────────────────────────────────
|
||||
|
||||
const L = (zh: string) => zh;
|
||||
/** 模拟的任务抽屉:真组件 DrawerBatchCard + 真的 showBatchPulse;「所在批次」点了切到只读批次页。 */
|
||||
function FakeDrawer({ before, after, onOpenBatch, onClose }: { before: BatchPulse[]; after: BatchPulse[]; onOpenBatch: () => void; onClose: () => void }) {
|
||||
const [now, setNow] = useState(before);
|
||||
const [done, setDone] = useState(false);
|
||||
const btn = useRef<HTMLButtonElement>(null);
|
||||
const approve = () => {
|
||||
if (done) return;
|
||||
setDone(true);
|
||||
showBatchPulse(before, after, "zh", btn.current);
|
||||
setNow(after);
|
||||
};
|
||||
useEffect(() => {
|
||||
const t = window.setTimeout(() => { if (document.querySelector(".demo-bar")?.getAttribute("data-auto") === "1") approve(); }, 1800);
|
||||
return () => window.clearTimeout(t);
|
||||
}); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
return (
|
||||
<div className="demo-drawer-back" onClick={onClose}>
|
||||
<aside className="demo-drawer" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="demo-drawer-kicker">MEEGO-6801234 · Bug · 待复核</div>
|
||||
<h2>【演示】个人主页关注按钮状态和关注列表不同步</h2>
|
||||
<div className="classifier-chips"><span className="chip">iOS</span><span className="chip"># social_relation</span></div>
|
||||
<div onClickCapture={(e) => { e.preventDefault(); onOpenBatch(); }}><DrawerBatchCard batches={now} lang="zh" /></div>
|
||||
<p className="demo-drawer-body">(这里是抽屉里原有的修复报告、MR、证据……演示省略。)</p>
|
||||
<div className="demo-drawer-actions">
|
||||
<button ref={btn} type="button" className="bc-btn bc-btn--primary" onClick={approve} disabled={done}>{done ? "已通过 ✓" : "复核通过"}</button>
|
||||
<button type="button" className="bc-btn" disabled>打回</button>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const clearSeen = () => { try { localStorage.removeItem(`batchSeen:${TAG}`); localStorage.removeItem(`batchSeenBoard:${TAG}`); } catch { /* */ } };
|
||||
|
||||
function Demo() {
|
||||
const [i, setI] = useState(0);
|
||||
const [mount, setMount] = useState(0);
|
||||
const [auto, setAuto] = useState(false);
|
||||
const [view, setView] = useState<Who>("owner");
|
||||
const [drawer, setDrawer] = useState<{ before: BatchPulse[]; after: BatchPulse[] } | null>(null);
|
||||
const step = STEPS[i];
|
||||
|
||||
const setWho = (w: Who) => { who = w; setView(w); setMount((m) => m + 1); };
|
||||
|
||||
const go = useCallback((n: number) => {
|
||||
if (n >= STEPS.length) { setAuto(false); return; }
|
||||
const st = STEPS[n];
|
||||
const before = cur;
|
||||
clearConfetti(); // 上一步还在飘的礼花不带进这一步(比如突破 75% 的礼花飘进 QA 打回)
|
||||
cur = st.s;
|
||||
board = st.board;
|
||||
triage.records = []; triage.gone.clear();
|
||||
(st.s.triaged ?? []).forEach((x, j) => addTriage(x.k, x, Date.now() - (j + 1) * 3 * H));
|
||||
setI(n);
|
||||
setDrawer(null);
|
||||
if (st.who && st.who !== who) { who = st.who; setView(st.who); }
|
||||
if (st.kind === "open") setMount((m) => m + 1);
|
||||
else if (st.kind === "live") (document.querySelector(".bc-head-actions [aria-label='刷新']") as HTMLButtonElement | null)?.click();
|
||||
else if (st.kind === "drawer") setDrawer({ before: pulseOf(before), after: pulseOf(st.s) });
|
||||
else if (st.kind === "share") {
|
||||
setMount((m) => m + 1);
|
||||
window.setTimeout(() => (document.querySelector(".bc-head-actions [aria-label='分享战报']") as HTMLButtonElement | null)?.click(), 900);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const restart = () => {
|
||||
setAuto(false); clearSeen(); who = "owner"; triage.records = []; triage.gone.clear(); setView("owner"); setDrawer(null);
|
||||
cur = STEPS[0].s; board = STEPS[0].board; setI(0); setMount((m) => m + 1);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!auto) return;
|
||||
const k = STEPS[i].kind;
|
||||
const t = window.setTimeout(() => go(i + 1), k === "live" ? 3500 : k === "drawer" ? 7000 : k === "share" ? 7000 : 6500);
|
||||
return () => window.clearTimeout(t);
|
||||
}, [auto, i, go]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="demo-bar" data-auto={auto ? "1" : "0"}>
|
||||
<div className="demo-step">
|
||||
<b>{step.title}</b>
|
||||
<span>{step.desc}</span>
|
||||
</div>
|
||||
<div className="demo-actions">
|
||||
<div className="filter-seg demo-who" role="group" aria-label="视角">
|
||||
<button type="button" className={view === "admin" ? "on" : ""} onClick={() => setWho("admin")}>管理员</button>
|
||||
<button type="button" className={view === "owner" ? "on" : ""} onClick={() => setWho("owner")}>负责人</button>
|
||||
<button type="button" className={view === "viewer" ? "on" : ""} onClick={() => setWho("viewer")}>经办人(只读)</button>
|
||||
</div>
|
||||
<span className="demo-count">{i + 1} / {STEPS.length}</span>
|
||||
<button type="button" className="bc-btn" onClick={restart}>重来</button>
|
||||
<button type="button" className="bc-btn" onClick={() => setAuto((a) => !a)}>{auto ? "暂停" : "自动播放"}</button>
|
||||
<button type="button" className="bc-btn bc-btn--primary" onClick={() => go(i + 1)} disabled={i >= STEPS.length - 1}>
|
||||
{i >= STEPS.length - 1 ? "完" : `下一步:${STEPS[i + 1].title.replace(/^.\s*/, "")}`}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bc">
|
||||
<BatchDetail key={mount} tag={TAG} navigate={() => {}} L={L} />
|
||||
</div>
|
||||
{drawer && (
|
||||
<FakeDrawer before={drawer.before} after={drawer.after} onClose={() => setDrawer(null)}
|
||||
onOpenBatch={() => { setDrawer(null); if (i + 1 < STEPS.length && STEPS[i + 1].who === "viewer") go(i + 1); else setWho("viewer"); }} />
|
||||
)}
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.demo-bar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--elev, #fff); border-bottom: 1px solid var(--border, #e5e7eb); box-shadow: 0 2px 10px rgba(0,0,0,.05); flex-wrap: wrap; }
|
||||
.demo-step { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2, #444); }
|
||||
.demo-step b { font-size: 15px; color: var(--text, #111); }
|
||||
.demo-actions { display: flex; align-items: center; gap: 8px; }
|
||||
.demo-count { font-size: 12px; color: var(--muted, #888); font-variant-numeric: tabular-nums; }
|
||||
.demo-actions { flex-wrap: wrap; }
|
||||
.demo-drawer-back { position: fixed; inset: 0; z-index: 60; }
|
||||
.demo-drawer-back { top: var(--demo-bar-h, 64px); background: rgba(15, 18, 40, 0.28); }
|
||||
.demo-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); padding: 24px; background: var(--elev, #fff); box-shadow: var(--shadow-lg); overflow: auto; animation: bc-drop .3s ease-out; }
|
||||
.demo-drawer-kicker { font-size: 12px; color: var(--muted, #888); }
|
||||
.demo-drawer h2 { margin: 6px 0 10px; font-size: 18px; color: var(--text, #111); }
|
||||
.demo-drawer-body { margin: 18px 0; font-size: 13px; color: var(--muted, #888); }
|
||||
.demo-drawer-actions { display: flex; gap: 8px; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
clearSeen();
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,69 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import BatchList from "../components/BatchList";
|
||||
import { buildProgress, stageOf, type BatchSummary, type ProgressTask } from "@bbbug/shared/batch_center";
|
||||
|
||||
/**
|
||||
* 本地演示:Bug 治理列表页。治理项目和 UI 走查修复批次拆成两个标签页,默认停在治理项目。
|
||||
* 治理项目的名字、标签照生产上的四个项目摆,走查批次照生产上的 `audit-*` 摆,进度是假数据。
|
||||
* 不连任何接口——api.batches 换成假数据。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-batch-list.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const H = 3_600_000;
|
||||
const now = Date.now();
|
||||
|
||||
interface Shape { landed: number; merge: number; qa: number; review: number; running: number; closed: number; recall: number; day: number }
|
||||
function summary(tag: string, name: string, owners: string[], daysAgo: number, platforms: string[], s: Shape): BatchSummary {
|
||||
const tasks: ProgressTask[] = [];
|
||||
const add = (n: number, status: ProgressTask["status"], meegoState: string | null = null, mrState: string | null = null) => {
|
||||
for (let i = 0; i < n; i++) tasks.push({ id: `${tag}-${tasks.length}`, status, meegoState, mrState, mrUrl: mrState ? "https://example.invalid/mr" : null });
|
||||
};
|
||||
add(s.landed, "fix_succeeded", "CLOSED", "merged");
|
||||
add(s.merge, "fix_succeeded", "CLOSED", "opened");
|
||||
add(s.qa, "fix_succeeded", "RESOLVED", "opened");
|
||||
add(s.review, "manual_review"); add(s.running, "fixing"); add(s.closed, "archived"); add(s.recall, "fix_failed");
|
||||
// 最近修好的 day 条落在 24 小时内,其余在一周前。
|
||||
const settledAt = new Map(tasks.filter((t) => t.status === "fix_succeeded").map((t, i) => [t.id, i < s.day ? now - (i + 1) * H : now - 7 * 24 * H]));
|
||||
const progress = buildProgress(tasks, settledAt, now);
|
||||
return {
|
||||
meta: { tag, name, owners, description: null, createdBy: null, createdAt: now - daysAgo * 24 * H, digestEnabled: true, lastDigestAt: null, digestTz: "America/Los_Angeles", remindDaily: false, lastRemindAt: null, saved: true },
|
||||
progress, platforms, startedAt: now - daysAgo * 24 * H, lastFixedAt: s.day ? now - H : null, stage: stageOf(progress),
|
||||
};
|
||||
}
|
||||
|
||||
const hosted = (resolved: number, resolved7d: number): BatchSummary["watch"] =>
|
||||
({ enabled: true, healthy: true, resolved, resolved7d, decide: 0 }) as BatchSummary["watch"];
|
||||
|
||||
const ROWS: BatchSummary[] = [
|
||||
summary("audit-b2e6bdb9", "走查修复 · 聊天页问题走查", ["janice.wang@bytedance.com"], 1, ["ios"], { landed: 0, merge: 0, qa: 0, review: 2, running: 5, closed: 0, recall: 0, day: 2 }),
|
||||
summary("audit-6fafc1eb", "走查修复 · 聊天页功能卡走查", ["janice.wang@bytedance.com"], 2, ["android"], { landed: 0, merge: 0, qa: 1, review: 3, running: 2, closed: 0, recall: 1, day: 1 }),
|
||||
summary("audit-e1e28a58", "走查修复 · 多语言走查 iOS", ["ruyiliu@bytedance.com"], 5, ["ios"], { landed: 1, merge: 1, qa: 3, review: 6, running: 0, closed: 1, recall: 1, day: 0 }),
|
||||
summary("audit-553ebfef", "走查修复 · 【UI 走查】安卓导航栏返回", ["ruyiliu@bytedance.com"], 6, ["android"], { landed: 2, merge: 2, qa: 4, review: 0, running: 0, closed: 0, recall: 0, day: 0 }),
|
||||
summary("audit-00889383", "走查修复 · [UI 走查] TikTok 社交主场景 · 空态与异常态 · TUX 规范七项 · Android", ["ruyiliu@bytedance.com"], 8, ["android"], { landed: 0, merge: 3, qa: 5, review: 8, running: 3, closed: 0, recall: 2, day: 0 }),
|
||||
summary("audit-4e911372", "走查修复 · 【UI 走查】iOS 社交场景", ["ruyiliu@bytedance.com"], 9, ["ios"], { landed: 1, merge: 2, qa: 4, review: 7, running: 1, closed: 0, recall: 1, day: 0 }),
|
||||
summary("friending_ei_sa", "Friending EI SA", ["daizheng.l@bytedance.com", "jingyuan.yi@bytedance.com", "ruyiliu@bytedance.com"], 3, ["android", "ios"], { landed: 0, merge: 0, qa: 1, review: 3, running: 0, closed: 2, recall: 0, day: 0 }),
|
||||
{ ...summary("fcc_mobile", "FCC Mobile", ["liang.tong@bytedance.com", "liuli.nil@bytedance.com", "a@bytedance.com", "b@bytedance.com"], 4, ["android", "ios"], { landed: 1, merge: 2, qa: 4, review: 9, running: 4, closed: 2, recall: 0, day: 1 }), watch: hosted(11, 11) },
|
||||
{ ...summary("photo_mode_mobile", "Photo Mode Mobile", ["wudi.1995@bytedance.com", "leon.liu@bytedance.com", "a@bytedance.com", "b@bytedance.com", "c@bytedance.com"], 7, ["android", "ios"], { landed: 8, merge: 10, qa: 30, review: 30, running: 8, closed: 20, recall: 0, day: 1 }), watch: hosted(9, 9) },
|
||||
{ ...summary("social_relation", "social_relation", ["xiaoxiang.wu@bytedance.com"], 30, ["android", "ios"], { landed: 6, merge: 18, qa: 27, review: 11, running: 0, closed: 8, recall: 0, day: 0 }), watch: hosted(8, 5) },
|
||||
].sort((a, b) => (b.startedAt ?? 0) - (a.startedAt ?? 0));
|
||||
|
||||
// ?member:没有负责任何项目的普通用户看到的样子(空列表 + 新建入口)。
|
||||
const asMember = new URLSearchParams(location.search).has("member");
|
||||
Object.assign(api, { batches: async () => (asMember ? { batches: [], admin: false } : { batches: ROWS, admin: true }) });
|
||||
|
||||
/** 地址栏不动,只把标签页状态接上,切换手感和线上一致。 */
|
||||
function Demo() {
|
||||
const [track, setTrack] = useState<"audit" | "hosting" | undefined>(undefined);
|
||||
return (
|
||||
<div className="bc">
|
||||
<BatchList track={track} navigate={(r) => setTrack(r.track)} L={(zh) => zh} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,233 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { setLang, useI18n } from "../lib/i18n";
|
||||
import { api, type MeegoViewCheckJob, type MeegoViewImportJob } from "../lib/api";
|
||||
import BatchCreate from "../components/BatchCreate";
|
||||
import { IntakeCard } from "../components/BatchWatchPanel";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
import { assignBuckets, type CheckItem, type CheckMr } from "@bbbug/shared/batch_import_check";
|
||||
import type { ViewSwitchContext } from "@bbbug/shared/batch_import_log";
|
||||
import type { BatchWatchConfig, BatchWatchOverview } from "@bbbug/shared/batch_watch";
|
||||
import type { BatchRoute } from "../components/BatchCenter";
|
||||
|
||||
/**
|
||||
* 本地演示:已立项的治理项目换视图(BatchCreate 的换视图模式,/batches/new?tag=…)。不连任何接口——
|
||||
* api 上用到的几个方法换成假数据。假项目里已有 67 张单,新视图 84 张:28 张已在本项目、其余按真实比例
|
||||
* 落进可导入 / 已有 MR / 已在别的项目等桶,项目里 39 张不在新视图。工单标题、人名、MR 号全是编的。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-batch-view-switch.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const TAG = "social_comment";
|
||||
const NAME = "social comment";
|
||||
const OLD_VIEW = "https://meego.larkoffice.com/tiktok/issueView/05Mpjx3Dg?scope=workspaces&node=67313098";
|
||||
const VIEW_N = 84;
|
||||
const MINE_N = 28;
|
||||
const STAY_N = 39;
|
||||
const LISTING_MS = 1800;
|
||||
let msPerItem = 90;
|
||||
let authorized = true;
|
||||
let approval: "none" | "self" = "none";
|
||||
type WatchState = "on" | "paused" | "never";
|
||||
let watchState: WatchState = "never";
|
||||
|
||||
// ── 假数据 ───────────────────────────────────────────────────────────────────
|
||||
|
||||
let seed = 11;
|
||||
const rnd = () => ((seed = (seed * 1103515245 + 12345) % 2147483648) / 2147483648);
|
||||
const pick = <T,>(xs: T[]) => xs[Math.floor(rnd() * xs.length)];
|
||||
const PLAT = ["【iOS】", "【Android】", "[iOS]", "[Android]"];
|
||||
const PAGE = ["评论面板", "图评内流", "快捷评论", "评论输入框", "折叠屏详情页", "分屏评论", "sticker 面板", "评论长按菜单"];
|
||||
const BUG = ["键盘弹起后输入框被遮挡", "表情面板重复拉起", "埋点 enter_from 取值不对", "大字模式下文字截断", "横屏模式下布局错乱",
|
||||
"回复后列表跳到顶部", "阿拉伯语下排序按钮不显示", "点赞数偶现不刷新", "图片缩略图和文案重叠"];
|
||||
|
||||
const projectIds: string[] = [];
|
||||
function fakeItems(): CheckItem[] {
|
||||
seed = 11;
|
||||
projectIds.length = 0;
|
||||
const items: CheckItem[] = [];
|
||||
for (let n = 0; n < VIEW_N; n++) {
|
||||
const id = String(7_380_000_000 + Math.floor(rnd() * 20_000_000));
|
||||
const title = `${pick(PLAT)}${pick(PAGE)}${pick(BUG)}(第 ${n + 1} 号)`;
|
||||
const it: CheckItem = {
|
||||
meegoId: id, url: `https://meego.larkoffice.com/tiktok/issue/detail/${id}`, checked: false,
|
||||
title, meegoState: n % 28 === 3 ? "REOPENED" : "OPEN", meegoOpen: true, mrs: [], existing: null, bucket: "ready", warnings: [],
|
||||
};
|
||||
if (n < MINE_N) {
|
||||
it.existing = { taskId: `t-${n}`, status: pick(["manual_review", "manual_review", "fix_succeeded", "unreproducible", "archived"]), clusters: [], tags: [TAG] };
|
||||
projectIds.push(id);
|
||||
} else {
|
||||
const k = rnd();
|
||||
if (k < 0.08) it.existing = { taskId: `t-${n}`, status: pick(["fix_succeeded", "manual_review"]), clusters: [], tags: ["social_relation"] };
|
||||
else if (k < 0.2) {
|
||||
const mrs: CheckMr[] = [{ mrId: 8_560_000 + Math.floor(rnd() * 20_000), title: `[Bug Fix] ${title}`, author: pick(["lijian.9211", "sunhaotian.mua", "omnifix-bot"]), state: pick(["opened", "merged"]), url: "#" }];
|
||||
it.mrs = mrs;
|
||||
} else if (k < 0.3) it.requirement = { storyId: pick(["7384240555", "7386747092", "7385843657"]), template: pick(["业务需求-TT", "业务需求-TT", "技术需求-TT"]) };
|
||||
else if (k < 0.33) { it.mrs = null; it.warnings.push("Bits 的 MR 查询失败,没法确认有没有人在修"); }
|
||||
}
|
||||
items.push(it);
|
||||
}
|
||||
// 打散,免得「已在本项目」全挤在前面。
|
||||
for (let i = items.length - 1; i > 0; i--) { const j = Math.floor(rnd() * (i + 1)); [items[i], items[j]] = [items[j], items[i]]; }
|
||||
for (let n = 0; n < STAY_N; n++) projectIds.push(String(6_700_000_000 + n * 7919));
|
||||
return items;
|
||||
}
|
||||
fakeItems();
|
||||
|
||||
function watchConfig(): BatchWatchConfig {
|
||||
const on = watchState === "on";
|
||||
return {
|
||||
enabled: on, viewUrl: OLD_VIEW, viewName: null, identity: watchState === "never" ? null : "jingyuan.yi@example.com", auth: watchState === "never" ? null : "ok",
|
||||
dailyCap: 30, extraStates: [], alphaForP1: false, schedule: { kind: "interval" },
|
||||
enabledAt: watchState === "never" ? null : Date.now() - 6 * 86_400_000, enabledBy: null,
|
||||
syncedAt: watchState === "never" ? null : Date.now() - 6 * 86_400_000, lastScanAt: on ? Date.now() - 12 * 60_000 : null, lastScanError: null,
|
||||
};
|
||||
}
|
||||
const ctx = (): ViewSwitchContext => ({
|
||||
name: NAME, viewUrl: OLD_VIEW, inProject: [...projectIds],
|
||||
settings: { clusters: ["default"], notifyChats: ["oc_3f9a1d2c7b"], unattended: true, lang: "zh" },
|
||||
watch: watchConfig(),
|
||||
});
|
||||
|
||||
let checkJob: { job: MeegoViewCheckJob; truth: CheckItem[]; t0: number } | null = null;
|
||||
function snapshot(): MeegoViewCheckJob {
|
||||
if (!checkJob) throw new Error("not found");
|
||||
const { job, truth, t0 } = checkJob;
|
||||
const el = Date.now() - t0;
|
||||
if (el < LISTING_MS) return { ...job, phase: "listing", total: 0, done: 0, items: [] };
|
||||
const done = Math.min(truth.length, Math.floor((el - LISTING_MS) / msPerItem));
|
||||
const items = truth.map((it, i): CheckItem => i >= done
|
||||
? { ...it, checked: false, title: null, meegoState: null, meegoOpen: null, mrs: null, existing: null, warnings: [] }
|
||||
: { ...it, checked: true });
|
||||
assignBuckets(items);
|
||||
const finished = done >= truth.length;
|
||||
return { ...job, phase: finished ? "done" : "checking", total: truth.length, done, items, finishedAt: finished ? t0 + LISTING_MS + truth.length * msPerItem : null };
|
||||
}
|
||||
|
||||
let importJob: { job: MeegoViewImportJob; links: string[]; t0: number } | null = null;
|
||||
let lastSwitch: string | null = null;
|
||||
|
||||
Object.assign(api, {
|
||||
clustersList: async () => ({ clusters: ["default", "evaluator", "social"] }),
|
||||
batchViewSwitch: async () => { await new Promise((r) => setTimeout(r, 300)); return ctx(); },
|
||||
startMeegoViewCheck: async (url: string) => {
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
if (!/meego/.test(url)) throw new Error("没有识别到视图链接或工单链接(工单链接形如 …/<项目>/<类型>/detail/<id>)");
|
||||
checkJob = {
|
||||
job: { id: `demo-${Date.now().toString(36)}`, startedAt: Date.now(), finishedAt: null, phase: "listing", name: null, source: url, total: 0, done: 0, items: [], error: null },
|
||||
truth: fakeItems(), t0: Date.now(),
|
||||
};
|
||||
return snapshot();
|
||||
},
|
||||
meegoViewCheckJob: async (id: string) => {
|
||||
if (!checkJob || checkJob.job.id !== id) throw new Error("not found");
|
||||
return snapshot();
|
||||
},
|
||||
meegoAuth: {
|
||||
status: async () => (authorized ? { state: "authorized", account: "you@example.com" } : { state: "none" }),
|
||||
begin: async () => { await new Promise((r) => setTimeout(r, 500)); approval = "none"; return { url: "about:blank", completeToken: "demo", reused: false }; },
|
||||
complete: async () => {
|
||||
if (approval === "self") { authorized = true; return { state: "authorized", account: "you@example.com", refreshExpiresAt: null }; }
|
||||
return { state: "pending" };
|
||||
},
|
||||
},
|
||||
startBatchViewSwitch: async (_tag: string, body: { viewUrl: string; links: { meegoId: string }[]; watch: unknown }) => {
|
||||
lastSwitch = `${body.viewUrl}${body.watch ? "(导完开自动接新单)" : "(不接新单)"}`;
|
||||
importJob = {
|
||||
job: { id: "imp", startedAt: Date.now(), finishedAt: null, total: body.links.length, done: 0, added: [], retagged: [], skipped: [], error: null, tag: TAG },
|
||||
links: body.links.map((l) => l.meegoId), t0: Date.now(),
|
||||
};
|
||||
return importJob.job;
|
||||
},
|
||||
meegoViewImportJob: async () => {
|
||||
if (!importJob) throw new Error("not found");
|
||||
const { job, links, t0 } = importJob;
|
||||
const done = Math.min(links.length, Math.floor((Date.now() - t0) / 60));
|
||||
const existing = new Set(checkJob?.truth.filter((i) => i.existing).map((i) => i.meegoId));
|
||||
const slice = links.slice(0, done);
|
||||
return {
|
||||
...job, done,
|
||||
added: slice.filter((id) => !existing.has(id)).map((id) => ({ meegoId: id, taskId: id, title: "" })),
|
||||
retagged: slice.filter((id) => existing.has(id)).map((id) => ({ meegoId: id, taskId: id })),
|
||||
finishedAt: done >= links.length ? Date.now() : null,
|
||||
};
|
||||
},
|
||||
batchWatchSave: async () => watchConfig(),
|
||||
});
|
||||
|
||||
const fakeOverview = (): BatchWatchOverview => ({
|
||||
config: watchConfig(),
|
||||
stats: { incoming: 0, incoming7d: 0, counts: { hosting: 0, handed: 0, decide: 0, withdrawn: 0, recorded: 0 }, handedFixed: 0, handedUnrepro: 0, handedManual: 0, resolved: 0, resolved7d: 0, after: { accepted: 0, waiting: 0, other: 0 } },
|
||||
rows: [], view: [], scans: [], createdToday: 2, queued: 0, nextScanAt: watchState === "on" ? Date.now() + 18 * 60_000 : null,
|
||||
access: { admin: true, owner: false, me: "jingyuan.yi" },
|
||||
} as unknown as BatchWatchOverview);
|
||||
|
||||
// ── 外壳 ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
function Demo() {
|
||||
const { lang } = useI18n();
|
||||
const L = (zh: string, en: string) => (lang === "en" ? en : zh);
|
||||
const [route, setRoute] = useState<BatchRoute>({ view: "batches", tag: TAG, section: "imports" });
|
||||
const [ws, setWs] = useState<WatchState>(watchState);
|
||||
const [authOn, setAuthOn] = useState(!authorized);
|
||||
const [mount, setMount] = useState(0);
|
||||
|
||||
const navigate = (r: BatchRoute) => { setRoute(r); if (!r.create) setMount((m) => m + 1); };
|
||||
const restart = () => { checkJob = null; importJob = null; lastSwitch = null; setRoute({ view: "batches", tag: TAG, section: "imports" }); setMount((m) => m + 1); };
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="demo-bar">
|
||||
<div className="demo-step">
|
||||
<b>已立项的项目换视图(假数据)</b>
|
||||
<span>从项目「导入记录」顶上的卡片点「换视图」进来;贴任意 meego 视图链接(例如 https://meego.larkoffice.com/tiktok/issueView/9Q3o-GeDg),点「开始检查」。查完看「需求 bug」(关联业务 / 技术需求-TT,默认摘掉)、最后一格「已在本项目」和底栏「项目里另有 39 条不在新视图」,再点底栏按钮(会先弹确认)。</span>
|
||||
</div>
|
||||
<div className="demo-actions">
|
||||
<div className="filter-seg" role="group" aria-label="项目现在的自动接新单">
|
||||
{([["never", "从没开过"], ["on", "开着"], ["paused", "已暂停"]] as const).map(([k, label]) => (
|
||||
<button key={k} type="button" className={ws === k ? "on" : ""} onClick={() => { watchState = k; setWs(k); setMount((m) => m + 1); }}>接新单:{label}</button>
|
||||
))}
|
||||
</div>
|
||||
<label className="demo-check"><input type="checkbox" checked={authOn} onChange={(e) => { authorized = !e.target.checked; setAuthOn(e.target.checked); }} /> 我还没授权 Meego</label>
|
||||
<button type="button" className="bc-btn" onClick={() => { approval = "self"; }}>模拟:批准授权</button>
|
||||
<div className="filter-seg" role="group" aria-label="语言">
|
||||
<button type="button" className={lang === "zh" ? "on" : ""} onClick={() => setLang("zh")}>中</button>
|
||||
<button type="button" className={lang === "en" ? "on" : ""} onClick={() => setLang("en")}>EN</button>
|
||||
</div>
|
||||
<button type="button" className="bc-btn" onClick={restart}>重来</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bc">
|
||||
{route.create
|
||||
? <BatchCreate key={`${mount}-${ws}`} checkId={route.check ?? null} projectTag={route.tag ?? null} navigate={navigate} L={L} isAdmin />
|
||||
: (
|
||||
<div className="bc-page">
|
||||
<h1 className="bc-h1">{NAME}<span className="bc-dim"> ·(演示)项目页 › 导入记录</span></h1>
|
||||
{lastSwitch && <p className="bc-hint">(演示)刚才提交了换视图:{lastSwitch}</p>}
|
||||
<IntakeCard key={`${mount}-${ws}`} tag={TAG} ov={fakeOverview()} L={L} onChanged={() => {}} onSwitchView={() => setRoute({ view: "batches", create: true, tag: TAG })} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.demo-bar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--elev, #fff); border-bottom: 1px solid var(--border, #e5e7eb); box-shadow: 0 2px 10px rgba(0,0,0,.05); flex-wrap: wrap; }
|
||||
.demo-step { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2, #444); }
|
||||
.demo-step b { font-size: 15px; color: var(--text, #111); }
|
||||
.demo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.demo-check { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2, #444); }
|
||||
.bc { padding: 24px 16px; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
setLang("zh");
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,590 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import BatchDetail from "../components/BatchDetail";
|
||||
import BatchList from "../components/BatchList";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
import { clearConfetti } from "../lib/confetti";
|
||||
import {
|
||||
DIGEST_TZ, buildEfficiency, buildProgress, digestDue, nextDigestAt, stageOf, fixBucketOf, landingGroupOf, mrLandingOf, qaStateOf,
|
||||
type BatchLandingRow, type BatchLeaderboard, type BatchMeta, type BatchOverview, type BatchSummary, type DigestTz, type ProgressTask,
|
||||
} from "@bbbug/shared/batch_center";
|
||||
import { REMIND_KINDS, type RemindKind, type RemindPreview, type RemindRecipient } from "@bbbug/shared/batch_remind";
|
||||
import {
|
||||
WATCH_DAILY_CAP, WATCH_SCHEDULE_DEFAULT, buildWatchStats, nextWatchScanAt, watchBriefOf,
|
||||
type AfterHandover, type WatchSchedule, type BatchWatchConfig, type BatchWatchOverview, type RecordReason, type ViewItem, type WatchRow, type WatchScan, type WatchState, type WithdrawReason,
|
||||
} from "@bbbug/shared/batch_watch";
|
||||
import type { BatchReport } from "../lib/api";
|
||||
import { DEFAULT_REVIEW_POLICY, type ReviewPolicyConfig } from "@bbbug/shared/review_policy";
|
||||
|
||||
/**
|
||||
* 本地演示:Bug 治理 · 存量和增量合成一个项目页(2026-11-02)。一个视图就是一个项目:建项目时视图里的单全部导入,
|
||||
* 之后的新单按设定的频率拉进来;页面不再分「存量治理 / 增量托管」两条线,同一组指标卡和标签页,任务清单也不分来源。页面结构见 BatchDetail.tsx 文件头。不连任何接口,api 上用到的方法全换成
|
||||
* 假数据;待定夺的「重跑 / 移交 / 归档」、照样导入、暂停、改频率都能点,改的是内存里的假数据。
|
||||
*
|
||||
* 新建向导里新加的「之后的新单」在另一张演示页:/demo-batch-import.html。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-batch-watch.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const TAG = "social_relation";
|
||||
const H = 3_600_000;
|
||||
const D = 24 * H;
|
||||
const VIEW = "https://meego.larkoffice.com/tiktok/storyView/Ab3kQ9xZ";
|
||||
/** 视图里的单(存量 60 + 开启导入时的那些)。 */
|
||||
const VIEW_BASE = 91;
|
||||
|
||||
const TITLES = [
|
||||
"关注列表滑到底重复加载同一页", "私信会话置顶后未读角标不消失", "个人页粉丝数和列表条数对不上", "好友推荐卡片关闭后下拉刷新又出现",
|
||||
"互关标识在弱网下闪烁", "拉黑后对方主页仍能看到关注按钮", "通讯录好友授权弹窗重复弹出", "@好友面板搜索拼音首字母无结果",
|
||||
"分享到私信选人列表头像错位", "关注按钮连点两次变回未关注", "共同好友入口在 iPad 横屏下被截断", "粉丝列表移除粉丝后计数不刷新",
|
||||
"新朋友页红点清不掉", "可能认识的人卡片曝光埋点重复上报", "Story 圈好友可见范围设置不生效", "备注名在评论区不显示",
|
||||
];
|
||||
const ASSIGNEES = ["binzhang", "andrew.tong", "lisa.chen", "jiangdingkui", "wei.zhou", "xinzhao.li"];
|
||||
const FAILURES = [
|
||||
"修复后真机仍复现:滑到底第 3 页又出现重复项", "环境故障:iOS 节点构建超时(远程构建排队 40 分钟)", "定位到 RelationListViewModel,但两种改法都没让检查点通过",
|
||||
"测试账号缺少互关关系,评估判信息不足",
|
||||
];
|
||||
|
||||
/** 一个场景:存量停在哪、托管的配置、增量单每种状态几条、巡检记录。 */
|
||||
interface Scene {
|
||||
title: string;
|
||||
desc: string;
|
||||
/** list = 治理列表;detail = 项目详情。 */
|
||||
view: "detail" | "list";
|
||||
/** 打开详情页后替人点一下:某个标签页、某张指标卡(第几张),或页头的通知 / 设置。不写 = 停在概览。 */
|
||||
click?: `tab:${string}` | `kpi:${number}` | "notify" | "settings";
|
||||
/** 经办人从抽屉点进来的只读视角。 */
|
||||
readOnly?: boolean;
|
||||
/** 存量停在哪:人工复核期 / 已完成 / 没导存量。 */
|
||||
stock: "review" | "wrapup" | "empty";
|
||||
name?: string;
|
||||
config: Partial<BatchWatchConfig>;
|
||||
rows: {
|
||||
hosting: number; handedFixed: number; handedUnrepro: number; decide: number; withdrawn: Partial<Record<WithdrawReason, number>>; after?: Partial<Record<AfterHandover, number>>;
|
||||
/** 移交后被 QA 打回、回到待定夺的。 */
|
||||
reopened?: number;
|
||||
/** 只建记录(已绑 MR / 已关 / 重名……)的。 */
|
||||
recorded?: Partial<Record<RecordReason, number>>;
|
||||
};
|
||||
days: number;
|
||||
scans: number;
|
||||
createdToday?: number;
|
||||
queued?: number;
|
||||
/** 开启导入那一次:新建几条、已在平台上补标签几条、只建记录(已绑 MR / 已关)几条。 */
|
||||
sync?: { created: number; tagged: number; mr: number; closed: number };
|
||||
/** 最近一次巡检的对账:补回标签几条、只建记录转成托管几条(不写 = 平常的巡检)。 */
|
||||
reconcile?: { retagged: number; promoted: number; rebuilt: number };
|
||||
scanError?: string;
|
||||
/** 进这一幕时把巡检时间设成这个(不写 = 沿用上一幕留下的)。 */
|
||||
schedule?: WatchSchedule;
|
||||
/** 进这一幕时把复核策略设成这个(不写 = 沿用上一幕留下的,设置页里改了也算)。 */
|
||||
policy?: ReviewPolicyConfig;
|
||||
}
|
||||
|
||||
const BASE_CONFIG: BatchWatchConfig = {
|
||||
enabled: false, viewUrl: null, viewName: null, identity: null, auth: null, dailyCap: WATCH_DAILY_CAP, extraStates: [], alphaForP1: false, schedule: WATCH_SCHEDULE_DEFAULT,
|
||||
enabledAt: null, enabledBy: null, syncedAt: null, lastScanAt: null, lastScanError: null,
|
||||
};
|
||||
const ON: Partial<BatchWatchConfig> = {
|
||||
enabled: true, viewUrl: VIEW, viewName: "社交关系链 · 客户端 Bug", identity: "jingyuan.yi@bytedance.com", auth: "ok",
|
||||
enabledBy: "jingyuan.yi@bytedance.com",
|
||||
};
|
||||
const NO_ROWS = { hosting: 0, handedFixed: 0, handedUnrepro: 0, decide: 0, withdrawn: {} };
|
||||
|
||||
const ON_ROWS = { hosting: 6, handedFixed: 21, handedUnrepro: 6, decide: 3, reopened: 1, withdrawn: { meego_closed: 3, mr_bound: 1, owner_archived: 1 }, after: { accepted: 16, waiting: 9, other: 2 }, recorded: { mr: 3, closed: 1 } };
|
||||
|
||||
const SCENES: Scene[] = [
|
||||
{ view: "list", stock: "review", title: "① Bug 治理列表", desc: "列表本身没动。点「社交关系链」进去:项目页不再分存量、增量两条线。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", title: "② 项目页:一组指标卡、一套标签页", desc: "三张线路卡和阶段条都没了。页头下一行是增量拉取(频率、上次 / 下次、今天新建几条),点它去导入记录。下面四张卡固定不变、存量和新进合起来算:已解决 / 等人处理 / 机器处理中 / 近 7 天新进,点卡片直接进对应的清单。阶段只剩页头一个小徽标。概览最下面是原来的「效率结算」。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", click: "tab:任务清单", title: "③ 任务清单:存量和新进一张表", desc: "原来存量的任务清单和增量的「Meego 任务状态」合成一张表,视图里每张单一行。「来源」一列写首次导入或新进(带日期),状态用同一套词——新进的单托管中就是「机器处理中」,旁边标「未通知经办人」。筛选按要谁动来分;右上角可以只看新进。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", click: "kpi:1", title: "④ 等人处理:待定夺就地处理", desc: "点第二张卡「等人处理」直接进清单的这个筛选:存量的待复核、复现不了,和新进里等你定夺的混在一起,待定夺排最前。行上就能重跑 / 移交 / 归档;QA 打回的是「重新复核」。点一下试试。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", click: "tab:导入记录", title: "⑤ 导入记录:拉取卡 + 一条时间线", desc: "顶上是增量拉取卡:频率、视图、巡检身份、上次 / 下次、今天新建,能立即拉取、改频率、暂停。下面是没导进来的单。最下面的「导入历史」把建项目时的导入、重试和每一次拉取排成一条时间线,连续没有新单的拉取折成一行。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", click: "tab:导入记录", title: "⑥ 改成每周五、日、一拉一次", desc: "这一幕的频率已经是周五、周日、周一 09:00(太平洋时间)。点「改频率」可以再改,负责人也能改;页头那一行和第四张卡的「下次拉取」跟着变。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336, schedule: { kind: "weekly", days: [0, 1, 5], hour: 9, tz: "America/Los_Angeles" } },
|
||||
{ view: "detail", stock: "review", title: "⑦ Meego 授权失效:页头那一行变红", desc: "新单断流是这个项目唯一需要马上管的故障,所以不管停在哪个标签页,页头那一行都会变红,直接给「用我的 Meego 重新授权」。第四张卡也标红。",
|
||||
config: { ...ON, auth: "expired" }, rows: { ...ON_ROWS, decide: 0, reopened: 0 }, days: 10, scans: 420, scanError: "meegle: token expired (profile jingyuan.yi)", schedule: WATCH_SCHEDULE_DEFAULT },
|
||||
{ view: "detail", stock: "wrapup", title: "⑧ 存量清完了,新单还在接", desc: "首次导入的单全部落地,页头徽标是「效率结算」,概览先看落地看板;新进的单照样在指标卡和清单里,不用切到别的地方看。",
|
||||
config: { ...ON }, rows: { hosting: 3, handedFixed: 52, handedUnrepro: 11, decide: 0, withdrawn: { meego_closed: 6, mr_bound: 2, owner_archived: 2 }, after: { accepted: 55, waiting: 6, other: 2 }, recorded: { mr: 3, closed: 1 } }, days: 24, scans: 900 },
|
||||
{ view: "detail", stock: "empty", name: "Feed 卡片样式", title: "⑨ 只接新单、没导存量的老项目", desc: "早期只开了增量托管的项目:概览里存量那部分换成一句说明,指标卡、任务清单照常只有新进的单。",
|
||||
config: { ...ON }, rows: { hosting: 4, handedFixed: 9, handedUnrepro: 2, decide: 1, withdrawn: { meego_closed: 1 }, after: { accepted: 6, waiting: 5 }, recorded: { mr: 2 } }, days: 6, scans: 290, sync: { created: 16, tagged: 0, mr: 2, closed: 0 } },
|
||||
{ view: "detail", stock: "review", name: "IM 推送 Q4 存量", click: "tab:导入记录", title: "⑩ 建的时候没开增量的老项目", desc: "页头那一行写「未开启」。导入记录顶上换成开启表单:视图链接预填导入时用的那个,频率、上限填好就能开;负责人也能开(换视图只有管理员能做)。新建的项目默认就是开着的。",
|
||||
config: {}, rows: { hosting: 0, handedFixed: 0, handedUnrepro: 0, decide: 0, withdrawn: {} }, days: 0, scans: 0 },
|
||||
{ view: "detail", stock: "review", readOnly: true, title: "⑪ 经办人的只读视角", desc: "经办人从任务抽屉点进来:没有增量拉取那一行,指标卡只看存量加「你名下」,任务清单只有存量——还没交给经办人的新单不该让经办人看到。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", click: "settings", policy: DEFAULT_REVIEW_POLICY, title: "⑫ 复核策略:改成「QA 先验收」",
|
||||
desc: "项目设置里新加「复核策略」(只有管理员能改)。选「QA 先验收」会出现「直接交 QA 的改动上限」,默认 5:改动的方法数 + 解析不了的文件数不超过它,才跳过 RD 直接交 QA。保存时弹窗说清楚会发生什么,可以点保存看看弹窗(演示页里不会改任何真实数据)。下一幕直接按「QA 先验收、上限 5」展示。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", policy: { id: "qa_first", maxChangedUnits: 5 }, title: "⑬ QA 先验收生效:已解决按 QA 关单算",
|
||||
desc: "同一批单:复核通过、Meego 还停在「已解决」的 30 条,和置了「无法复现」等 QA 判断的 3 条,都不再算已解决,挪进「等人处理」,所以第一张卡的已解决数降下来了。概览最下面「效率结算」后面多了一张「QA 先验收 · 打回轮次」:直接交 QA 几次、功能一次通过、代码一次通过。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
{ view: "detail", stock: "review", click: "kpi:1", policy: { id: "qa_first", maxChangedUnits: 5 }, title: "⑭ 等人处理里的「已交 QA 验收」",
|
||||
desc: "点「等人处理」进清单:等 QA 验收的单状态下面写「平台已修好,已交 QA 验收;QA 在 Meego 上关单才算解决」,复现不了的写「平台没复现出来,已交 QA 判断」。QA 在 Meego 上打回并写明原因后,平台自动按原因重修,不需要在这里点任何按钮。",
|
||||
config: { ...ON }, rows: ON_ROWS, days: 7, scans: 336 },
|
||||
];
|
||||
|
||||
// ── 假数据 ───────────────────────────────────────────────────────────────────
|
||||
|
||||
let scene = SCENES[0];
|
||||
/** 复核策略:设置页改的是这一份,跨幕保留(场景写了 policy 就以场景为准)。 */
|
||||
let policy: ReviewPolicyConfig = DEFAULT_REVIEW_POLICY;
|
||||
let reviewGroup = false;
|
||||
/** 按当前策略给单打标,和服务端 batch_center.ts::loadTasks 一样:默认策略不标。 */
|
||||
const withPolicy = <T extends object>(t: T): T => (policy.id === "rd_review" ? t : { ...t, reviewPolicy: policy.id });
|
||||
/** 通知设置(时区、每天提醒经办人):设置页和通知页改的是这一份,跨幕保留。 */
|
||||
let notify: Pick<BatchMeta, "digestTz" | "remindDaily" | "lastRemindAt"> = { digestTz: DIGEST_TZ, remindDaily: false, lastRemindAt: null };
|
||||
let digestOn = true;
|
||||
/** 巡检时间:设置页和开启表单改的是这一份,跨幕保留。 */
|
||||
let schedule: WatchSchedule = WATCH_SCHEDULE_DEFAULT;
|
||||
let config: BatchWatchConfig = { ...BASE_CONFIG };
|
||||
let rows: WatchRow[] = [];
|
||||
/** 这一幕里点了「照样导入」的单:已经不是增量单,在「Meego 任务状态」里按存量显示。 */
|
||||
let importedAnyway: ViewItem[] = [];
|
||||
let scans: WatchScan[] = [];
|
||||
|
||||
function makeRows(s: Scene): WatchRow[] {
|
||||
const now = Date.now();
|
||||
const span = Math.max(s.days, 0.2) * D;
|
||||
const out: WatchRow[] = [];
|
||||
let k = 0;
|
||||
const after: AfterHandover[] = [];
|
||||
(["accepted", "waiting", "other"] as AfterHandover[]).forEach((a) => { for (let i = 0; i < (s.rows.after?.[a] ?? 0); i++) after.push(a); });
|
||||
const add = (state: WatchState, extra: Partial<WatchRow> = {}) => {
|
||||
const i = k++;
|
||||
const seenAt = state === "hosting" ? now - ((i * 37) % 10) * H * 0.4 - 10 * 60_000 : now - span * (0.15 + ((i * 53) % 80) / 100);
|
||||
out.push({
|
||||
id: `w${i}`, title: `【演示】${TITLES[i % TITLES.length]}`, platform: i % 3 ? "ios" : "android",
|
||||
meegoId: `${6812000 + i * 7}`, meegoUrl: "https://example.invalid/meego", assignee: ASSIGNEES[i % ASSIGNEES.length],
|
||||
seenAt, status: "fixing", meegoState: "OPEN", state, handedOverAt: null, handoverKind: null, after: null, resolvedAt: null, withdrawnReason: null, recordReason: null, reopened: false, failure: null,
|
||||
...extra,
|
||||
});
|
||||
};
|
||||
for (let i = 0; i < s.rows.hosting; i++) add("hosting", { status: ["initializing", "awaiting_fix", "fixing"][i % 3] });
|
||||
for (let i = 0; i < s.rows.handedFixed + s.rows.handedUnrepro; i++) {
|
||||
const unrepro = i >= s.rows.handedFixed;
|
||||
const a = after.shift() ?? "waiting";
|
||||
add("handed", {
|
||||
handoverKind: unrepro ? "unrepro" : "fixed", after: a,
|
||||
status: a === "accepted" ? (unrepro ? "unreproducible" : "fix_succeeded") : a === "other" ? "fixing" : unrepro ? "unreproducible" : "manual_review",
|
||||
meegoState: a === "accepted" ? "RESOLVED" : "OPEN",
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < s.rows.decide; i++) add("decide", { status: i === 1 ? "info_required" : "fix_failed", failure: FAILURES[i % FAILURES.length] });
|
||||
for (let i = 0; i < (s.rows.reopened ?? 0); i++) {
|
||||
add("decide", { status: "fix_succeeded", meegoState: "REOPENED", reopened: true, handoverKind: "fixed", failure: "QA 在 Meego 上重新打开了" });
|
||||
out[out.length - 1].handedOverAt = out[out.length - 1].seenAt + 3 * H;
|
||||
}
|
||||
(Object.entries(s.rows.recorded ?? {}) as [RecordReason, number][]).forEach(([r, n]) => {
|
||||
for (let i = 0; i < n; i++) add("recorded", { recordReason: r, status: "cancelled", meegoState: r === "closed" ? "CLOSED" : "OPEN" });
|
||||
});
|
||||
(Object.entries(s.rows.withdrawn) as [WithdrawReason, number][]).forEach(([r, n]) => {
|
||||
for (let i = 0; i < n; i++) add("withdrawn", { withdrawnReason: r, status: r === "owner_archived" ? "archived" : "cancelled", meegoState: r === "meego_closed" ? "CLOSED" : "OPEN" });
|
||||
});
|
||||
// 移交时刻:进视图后 1.5–9 小时(复现不了的更快一些)。
|
||||
for (const r of out) if (r.state === "handed" && !r.handedOverAt) r.handedOverAt = Math.min(now - 5 * 60_000, r.seenAt + (r.handoverKind === "unrepro" ? 1.5 : 3) * H + ((Number(r.id.slice(1)) * 47) % 6) * H);
|
||||
// 解决:移交后 4–28 小时经办人复核通过 / 确认复现不了。
|
||||
for (const r of out) if (r.after === "accepted" && r.handedOverAt) r.resolvedAt = Math.min(now - 2 * 60_000, r.handedOverAt + (4 + ((Number(r.id.slice(1)) * 31) % 25)) * H);
|
||||
const order: WatchState[] = ["decide", "hosting", "handed", "withdrawn", "recorded"];
|
||||
return out.sort((a, b) => order.indexOf(a.state) - order.indexOf(b.state) || b.seenAt - a.seenAt);
|
||||
}
|
||||
|
||||
function makeScans(s: Scene): WatchScan[] {
|
||||
const now = Date.now();
|
||||
const out: WatchScan[] = [];
|
||||
const n = Math.min(s.scans, 24);
|
||||
const created = rows.filter((r) => r.state !== "recorded").length;
|
||||
for (let i = 0; i < n; i++) {
|
||||
const at = now - (i + 1) * 30 * 60_000 + 4 * 60_000;
|
||||
const busy = i % 7 === 2 || i % 11 === 5;
|
||||
const fresh = busy ? 1 + (i % 3) : 0;
|
||||
out.push({
|
||||
at, inView: VIEW_BASE + Math.max(0, created - i), fresh, created: busy ? Math.max(0, fresh - (i % 4 === 0 ? 1 : 0)) : 0, queued: 0,
|
||||
skipped: busy && i % 4 === 0 ? { mr: 1 } : {}, error: null,
|
||||
});
|
||||
}
|
||||
if (s.reconcile) {
|
||||
const y = s.reconcile;
|
||||
out.unshift({ at: now - 4 * 60_000, inView: VIEW_BASE + created, fresh: 0, created: y.promoted + y.rebuilt, queued: 0, skipped: { existing: y.retagged }, error: null });
|
||||
}
|
||||
if (s.queued) out.unshift({ at: now - 6 * 60_000, inView: VIEW_BASE + created + s.queued, fresh: 37, created: 30 - (s.createdToday! - 30), queued: s.queued, skipped: { existing: 2, closed: 1 }, error: null });
|
||||
// 最早那一条:开启导入。
|
||||
if (config.syncedAt) {
|
||||
const y = s.sync ?? { created: 20, tagged: 1, mr: 2, closed: 1 };
|
||||
const sk: WatchScan["skipped"] = {};
|
||||
if (y.tagged) sk.existing = y.tagged;
|
||||
if (y.mr) sk.mr = y.mr;
|
||||
if (y.closed) sk.closed = y.closed;
|
||||
const stock = s.stock === "empty" ? 0 : 60;
|
||||
out.push({ at: config.syncedAt, inView: stock + y.created + y.tagged + y.mr + y.closed, fresh: stock + y.created + y.tagged + y.mr + y.closed, created: y.created, queued: 0, skipped: sk, error: null });
|
||||
}
|
||||
if (s.scanError) {
|
||||
for (let i = 0; i < 3; i++) out.unshift({ at: now - (i * 30 + 3) * 60_000, inView: 0, fresh: 0, created: 0, queued: 0, skipped: {}, error: s.scanError });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function load(s: Scene) {
|
||||
importedAnyway = [];
|
||||
scene = s;
|
||||
const now = Date.now();
|
||||
if (s.schedule) schedule = s.schedule;
|
||||
if (s.policy) policy = s.policy;
|
||||
config = { ...BASE_CONFIG, ...s.config, schedule };
|
||||
if (config.enabled) {
|
||||
config.enabledAt = now - s.days * D;
|
||||
config.syncedAt = config.enabledAt + 3 * 60_000;
|
||||
config.lastScanAt = s.scanError ? now - 95 * 60_000 : now - 4 * 60_000;
|
||||
config.lastScanError = s.scanError ?? null;
|
||||
}
|
||||
rows = makeRows(s);
|
||||
scans = makeScans(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 「Meego 任务状态」:增量单跟着 rows 走(待定夺的处理改了 rows,这里跟着变);存量里还没关单的在视图里、
|
||||
* Meego 已关的离开了视图;已绑 MR / 已关的是「只建记录」的增量单(在 rows 里),没有任务的只剩今天排队的。
|
||||
*/
|
||||
function viewItems(): ViewItem[] {
|
||||
if (!config.enabledAt) return [];
|
||||
const hosted: ViewItem[] = rows.map((r) => ({
|
||||
meegoId: r.meegoId, meegoUrl: r.meegoUrl, title: r.title, firstSeenAt: r.seenAt,
|
||||
inView: !(r.state === "withdrawn" && r.withdrawnReason === "meego_closed") && !(r.state === "recorded" && r.recordReason === "closed") && r.after !== "accepted",
|
||||
line: "hosted", task: { id: r.id, status: r.status, platform: r.platform, meegoState: r.meegoState }, watch: r.state, skip: null,
|
||||
}));
|
||||
const synced = config.syncedAt ?? config.enabledAt;
|
||||
const stock: ViewItem[] = stockTasks().map((t, i) => ({
|
||||
meegoId: `${6790000 + i * 11}`, meegoUrl: "https://example.invalid/meego", title: `【演示】${TITLES[(i + 5) % TITLES.length]}`, firstSeenAt: synced,
|
||||
inView: t.meegoState !== "CLOSED" && t.status !== "archived", line: "stock",
|
||||
task: { id: t.id, status: t.status, platform: t.platform, meegoState: t.meegoState ?? null }, watch: null, skip: null,
|
||||
}));
|
||||
const none = (n: number, skip: string, at: number, inView = true): ViewItem[] => Array.from({ length: n }, (_, i) => ({
|
||||
meegoId: `${6850000 + skip.length * 1000 + i * 13}`, meegoUrl: "https://example.invalid/meego", title: `【演示】${TITLES[(i * 3 + skip.length) % TITLES.length]}`,
|
||||
firstSeenAt: at, inView, line: "none" as const, task: null, watch: null, skip,
|
||||
}));
|
||||
const out = [...hosted, ...importedAnyway, ...stock, ...none(scene.queued ?? 0, "queued", Date.now() - 6 * 60_000)];
|
||||
const rank = (x: ViewItem) => x.watch === "withdrawn" || x.watch === "recorded" ? 6 : x.watch ? ["decide", "hosting", "handed"].indexOf(x.watch) : { stock: 3, other: 4, none: 5, hosted: 6 }[x.line];
|
||||
return out.sort((a, b) => Number(b.inView !== false) - Number(a.inView !== false) || rank(a) - rank(b) || b.firstSeenAt - a.firstSeenAt);
|
||||
}
|
||||
|
||||
function watchOverview(): BatchWatchOverview {
|
||||
const now = Date.now();
|
||||
return {
|
||||
config, stats: buildWatchStats(rows, now), rows, view: viewItems(), scans,
|
||||
createdToday: scene.createdToday ?? Math.min(rows.filter((r) => now - r.seenAt < D).length, config.dailyCap),
|
||||
queued: scene.queued ?? 0,
|
||||
nextScanAt: config.enabled && config.lastScanAt ? nextWatchScanAt(config.schedule, config.lastScanAt, config.syncedAt, now) : null,
|
||||
access: { admin: true, owner: false },
|
||||
};
|
||||
}
|
||||
|
||||
const brief = () => (config.enabled || config.enabledAt ? watchBriefOf(config, rows, Date.now()) : null);
|
||||
|
||||
/** 存量:人工复核期 60 条 / 已完成 / 没导存量。托管开着也不变,增量单不进这里的任何数字。 */
|
||||
function stockTasks(): (ProgressTask & { platform: string })[] {
|
||||
const out: (ProgressTask & { platform: string })[] = [];
|
||||
const add = (n: number, status: string, meegoState: string | null = null, mrState: string | null = null) => {
|
||||
for (let i = 0; i < n; i++) out.push({ id: `s${out.length}`, status, meegoState, mrState, mrUrl: mrState ? "https://example.invalid/mr" : null, platform: out.length % 9 < 5 ? "ios" : "android" } as ProgressTask & { platform: string });
|
||||
};
|
||||
if (scene.stock === "review") { add(30, "fix_succeeded", "RESOLVED", "opened"); add(6, "fix_succeeded", "CLOSED", "merged"); add(12, "manual_review"); add(4, "fixing"); add(5, "archived"); add(3, "fix_failed"); add(3, "unreproducible", "RESOLVED"); }
|
||||
if (scene.stock === "wrapup") { add(49, "fix_succeeded", "CLOSED", "merged"); add(3, "fix_succeeded", "CLOSED", "opened"); add(2, "fix_succeeded", "RESOLVED", "opened"); add(6, "archived"); }
|
||||
return out.map(withPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目里全部的单(和服务端 batch_center.ts::projectTasks 同口径):首次导入的 + 接进来的;只建记录的不在项目里,
|
||||
* 托管期间撤回的(经办人关了 / 绑了 MR)标 notOurs、不进总数,负责人归档的照归档算。
|
||||
*/
|
||||
function projectTasks(): (ProgressTask & { platform: string })[] {
|
||||
const hosted = rows.filter((r) => r.state !== "recorded").map((r) => ({
|
||||
id: r.id, status: r.state === "withdrawn" ? (r.withdrawnReason === "owner_archived" ? "archived" : "cancelled") : r.status,
|
||||
meegoState: r.meegoState, mrState: null, mrUrl: null, platform: r.platform,
|
||||
notOurs: r.state === "withdrawn" && r.withdrawnReason !== "owner_archived",
|
||||
}) as unknown as ProgressTask & { platform: string }).map(withPolicy);
|
||||
return [...stockTasks(), ...hosted];
|
||||
}
|
||||
|
||||
function overview(): BatchOverview {
|
||||
const tasks = projectTasks();
|
||||
const now = Date.now();
|
||||
const progress = buildProgress(tasks, new Map(tasks.map((t, i) => [t.id, now - (i < 4 && scene.stock === "review" ? 3 * H : 3 * D)])), now);
|
||||
const stock = stockTasks();
|
||||
const digestStage = stageOf(buildProgress(stock, new Map(), now));
|
||||
const start = now - (scene.stock === "wrapup" ? 30 : 12) * D;
|
||||
const counted = tasks.filter((t) => fixBucketOf(t) !== "excluded");
|
||||
const plat = (p: string) => ({ platform: p, total: counted.filter((t) => t.platform === p).length, fixed: counted.filter((t) => t.platform === p && fixBucketOf(t) === "fixed").length });
|
||||
return {
|
||||
meta: { tag: TAG, name: scene.name ?? "社交关系链", owners: ["xiaoxiang.wu@bytedance.com"], description: null, createdBy: null, createdAt: start, digestEnabled: digestOn, lastDigestAt: null, ...notify, saved: true },
|
||||
startedAt: tasks.length ? start : null, progress,
|
||||
series: tasks.length ? Array.from({ length: 7 }, (_, i) => ({ day: new Date(start + i * 2 * D).toISOString().slice(0, 10), fixed: Math.round((progress.fixed * (i + 1)) / 7), added: 0 })) : [],
|
||||
platforms: tasks.length ? [plat("ios"), plat("android")] : [], archived: [], reopenTriage: [],
|
||||
landing: tasks.filter((t) => t.status === "fix_succeeded").map((t, i): BatchLandingRow => {
|
||||
const qa = qaStateOf(t.meegoState);
|
||||
const mr = mrLandingOf(t);
|
||||
return {
|
||||
id: t.id, title: `【演示】${TITLES[i % TITLES.length]}`, platform: t.platform, meegoId: `680${i}000`, meegoUrl: "https://example.invalid/meego",
|
||||
meegoState: t.meegoState ?? "", mrUrl: t.mrUrl ?? null, mrState: t.mrState ?? null, mergedAt: mr === "merged" ? now - (i % 5) * D : null,
|
||||
approvedAt: now - (2 + (i % 9)) * D, approvedBy: ["binzhang@bytedance.com", "andrew.tong@bytedance.com", null][i % 3], qa, mr, group: landingGroupOf(qa, mr), triage: null,
|
||||
};
|
||||
}),
|
||||
efficiency: buildEfficiency(tasks.map((t, i) => ({ bucket: fixBucketOf(t), sendbacks: i % 5 === 4 ? 1 : 0 })), 1),
|
||||
last24h: { steps: 6, people: 3, unrecorded: 0 }, digestHistory: [], nextDigestAt: digestOn && digestStage === "review" ? nextDigestAt(now, null, notify.digestTz) : null,
|
||||
digestStage, intakeOn: config.enabled,
|
||||
nextRemindAt: notify.remindDaily ? nextDigestAt(now, notify.lastRemindAt, notify.digestTz) : null,
|
||||
access: scene.readOnly ? { admin: false, owner: false, me: "binzhang" } : { admin: true, owner: false, me: "jingyuan.yi" },
|
||||
watch: brief(),
|
||||
reviewPolicy: policy,
|
||||
reviewGroup,
|
||||
reviewRounds: policy.id === "qa_first" ? { fixed: progress.fixed, qaFirstPass: Math.round(progress.fixed * 0.8), rdFirstPass: Math.round(progress.fixed * 0.9), handedToQa: 24 } : null,
|
||||
};
|
||||
}
|
||||
|
||||
function summaries(): BatchSummary[] {
|
||||
const now = Date.now();
|
||||
const W = (enabled: boolean, healthy: boolean, hosting: number, decide: number, incoming7d: number, resolved: number, resolved7d: number) => ({ enabled, healthy, hosting, decide, incoming7d, resolved, resolved7d });
|
||||
const mk = (tag: string, name: string, owner: string, days: number, watch: BatchSummary["watch"], shape: [number, number, number, number]): BatchSummary => {
|
||||
const ts: ProgressTask[] = [];
|
||||
const add = (n: number, status: string, meegoState: string | null = null, mrState: string | null = null) => { for (let i = 0; i < n; i++) ts.push({ id: `${tag}${ts.length}`, status, meegoState, mrState, mrUrl: mrState ? "x" : null } as ProgressTask); };
|
||||
add(shape[0], "fix_succeeded", "CLOSED", "merged"); add(shape[1], "fix_succeeded", "RESOLVED", "opened"); add(shape[2], "manual_review"); add(shape[3], "fixing");
|
||||
const progress = buildProgress(ts, new Map(), now);
|
||||
return { meta: { tag, name, owners: [owner], description: null, createdBy: null, createdAt: now - days * D, digestEnabled: true, lastDigestAt: null, digestTz: "America/Los_Angeles", remindDaily: false, lastRemindAt: null, saved: true }, progress, platforms: ["android", "ios"], startedAt: now - days * D, lastFixedAt: now - H, stage: stageOf(progress), watch };
|
||||
};
|
||||
return [
|
||||
mk("im_push", "IM 推送 Q4 存量", "lisa.chen@bytedance.com", 1, null, [0, 4, 10, 40]),
|
||||
mk("social_relation", "社交关系链", "xiaoxiang.wu@bytedance.com", 12, W(true, true, 6, 3, 9, 18, 6), [6, 30, 12, 4]),
|
||||
mk("live_gift", "直播礼物面板", "andrew.tong@bytedance.com", 20, W(true, false, 2, 0, 4, 15, 2), [33, 2, 0, 0]),
|
||||
mk("profile_v2", "个人页改版遗留", "binzhang@bytedance.com", 30, W(false, true, 0, 0, 0, 12, 0), [36, 2, 0, 0]),
|
||||
mk("feed_card", "Feed 卡片样式", "wei.zhou@bytedance.com", 6, W(true, true, 4, 0, 11, 6, 4), [0, 0, 0, 0]),
|
||||
];
|
||||
}
|
||||
|
||||
/** 提醒经办人的名单:六位经办人,每人几条待处理;发送记录里有一次手动、一次定时。 */
|
||||
function remindPreview(): RemindPreview {
|
||||
const now = Date.now();
|
||||
const kinds: RemindKind[] = ["review_nomr", "review_mr", "recall", "qa_reopened", "confirm"];
|
||||
const recipients: RemindRecipient[] = ASSIGNEES.map((prefix, a) => {
|
||||
const n = [5, 4, 3, 3, 2, 1][a];
|
||||
const items = Array.from({ length: n }, (_, i) => ({
|
||||
id: `r${a}-${i}`, title: `【演示】${TITLES[(a * 3 + i) % TITLES.length]}`, platform: (i % 2 ? "android" : "ios") as RemindRecipient["items"][number]["platform"],
|
||||
kind: kinds[(a + i) % kinds.length], round: 1 + (i % 3 === 2 ? 1 : 0), status: "manual_review", since: now - (1 + i) * D,
|
||||
}));
|
||||
const counts = Object.fromEntries(REMIND_KINDS.map((k) => [k, items.filter((x) => x.kind === k).length])) as Record<RemindKind, number>;
|
||||
return {
|
||||
prefix, email: `${prefix}@bytedance.com`, items, counts, late: items.filter((x) => x.round >= 2).length,
|
||||
hasBitsToken: a % 3 !== 1, decisions: { approve: 2 + a, reject: a % 2 }, savedLang: a === 1 ? "en" : null,
|
||||
lastSentAt: notify.lastRemindAt ?? now - 2 * D,
|
||||
};
|
||||
});
|
||||
return {
|
||||
tag: TAG, generatedAt: now, repeatGuardMs: 12 * H, importer: "jingyuan.yi@bytedance.com", recipients,
|
||||
unassigned: [{ id: "u1", title: "【演示】通讯录好友授权弹窗重复弹出", kind: "review_nomr" }],
|
||||
history: [
|
||||
...(notify.lastRemindAt ? [{ at: notify.lastRemindAt, by: "schedule", test: false, results: recipients.map((r) => ({ prefix: r.prefix, ok: true, lang: r.savedLang ?? "zh" as const, items: r.items.length })) }] : []),
|
||||
{ at: now - 2 * D, by: "jingyuan.yi", test: false, results: recipients.map((r) => ({ prefix: r.prefix, ok: true, lang: r.savedLang ?? "zh" as const, items: r.items.length })) },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const wait = (ms = 400) => new Promise((r) => setTimeout(r, ms));
|
||||
// 开启 / 重新授权前要看点按钮的人有没有 Meego 授权:演示里一律当已授权。
|
||||
Object.assign(api.meegoAuth, { status: async () => ({ state: "authorized" }) });
|
||||
Object.assign(api, {
|
||||
batchOverview: async () => overview(),
|
||||
batchLeaderboard: async (): Promise<BatchLeaderboard> => ({ generatedAt: Date.now(), rows: [{ prefix: "larry.guo", role: "qa", total: 6, counts: { qa_reopened: 0, review_nomr: 0, review_mr: 0, recall: 0, confirm: 0 } }, { prefix: "binzhang", total: 5, counts: { qa_reopened: 0, review_nomr: 5, review_mr: 0, recall: 0, confirm: 0 } }, { prefix: "lisa.chen", total: 4, counts: { qa_reopened: 0, review_nomr: 3, review_mr: 0, recall: 1, confirm: 0 } }, { prefix: "lisa.chen", role: "qa", total: 1, counts: { qa_reopened: 0, review_nomr: 0, review_mr: 0, recall: 0, confirm: 0 } }], unassigned: 0, importer: "jingyuan.yi@bytedance.com" }),
|
||||
batchReport: async () => {
|
||||
const now = Date.now();
|
||||
const tasks = stockTasks().map((t, i) => ({
|
||||
id: t.id, title: `【演示】${TITLES[(i + 5) % TITLES.length]}`, meegoId: `${6790000 + i * 11}`, meegoUrl: "https://example.invalid/meego", platform: t.platform,
|
||||
status: t.status, phase: "settled", outcome: "fixed", basis: "", nodeId: null, attempts: 1 + (i % 5 === 4 ? 1 : 0) + (i % 11 === 3 ? 1 : 0), unattended: true,
|
||||
mrUrl: t.mrUrl ?? null, mrState: t.mrState ?? null, meegoState: t.meegoState ?? null, since: now - ((i * 7) % 60 + 2) * H,
|
||||
assignee: ASSIGNEES[(i * 5) % ASSIGNEES.length], qa: i % 3 === 0 ? "larry.guo" as string | null : null,
|
||||
}));
|
||||
// 负责人看的报告也含接进来的单(只建记录的除外),和服务端 batchReport({ all: true }) 一样。
|
||||
for (const r of rows) {
|
||||
if (r.state === "recorded") continue;
|
||||
tasks.push({
|
||||
id: r.id, title: r.title, meegoId: r.meegoId, meegoUrl: r.meegoUrl, platform: r.platform as "ios" | "android",
|
||||
status: r.state === "withdrawn" ? (r.withdrawnReason === "owner_archived" ? "archived" : "cancelled") : r.status as typeof tasks[number]["status"],
|
||||
phase: "settled", outcome: "fixed", basis: "", nodeId: null, attempts: 1, unattended: true,
|
||||
mrUrl: null, mrState: r.after === "accepted" ? "opened" : null, meegoState: r.meegoState, since: r.seenAt,
|
||||
assignee: r.assignee, qa: null, hosted: true, watchWithdrawn: r.state === "withdrawn" ? r.withdrawnReason : null,
|
||||
} as typeof tasks[number]);
|
||||
}
|
||||
return { tag: TAG, generatedAt: now, total: tasks.length, tasks, nodes: [], platforms: [], issues: [], phases: {}, outcomes: {}, durations: {}, failureReasons: [], attemptsHistogram: {} } as unknown as BatchReport;
|
||||
},
|
||||
batchFlow: async () => { throw new Error("演示页没有「人员与推进」的假数据"); },
|
||||
batches: async () => ({ batches: summaries(), admin: true }),
|
||||
batchRemindPreview: async () => { await wait(700); return remindPreview(); },
|
||||
batchRemindTest: async (_tag: string, body: { as: string }) => { await wait(); return { ok: true, sentTo: "jingyuan.yi@bytedance.com", as: body.as, lang: "zh" }; },
|
||||
batchRemindSend: async (_tag: string, body: { prefixes: string[] }) => {
|
||||
await wait(900);
|
||||
return { at: Date.now(), by: "jingyuan.yi", test: false, results: body.prefixes.map((prefix) => ({ prefix, ok: true, lang: "zh", items: 1 })) };
|
||||
},
|
||||
batchDigestEnabled: async (_tag: string, enabled: boolean) => { await wait(); digestOn = enabled; return overview().meta; },
|
||||
batchDigestPreview: async () => { await wait(); return { at: Date.now(), by: "jingyuan.yi", test: true, to: ["jingyuan.yi"], ok: 1 }; },
|
||||
saveBatch: async (_tag: string, body: { digestEnabled?: boolean; digestTz?: DigestTz; remindDaily?: boolean; reviewPolicy?: ReviewPolicyConfig; reviewGroup?: boolean }) => {
|
||||
await wait();
|
||||
if (body.reviewPolicy) policy = body.reviewPolicy;
|
||||
if (body.reviewGroup !== undefined) reviewGroup = body.reviewGroup;
|
||||
const now = Date.now();
|
||||
const tz = body.digestTz ?? notify.digestTz;
|
||||
const remindDaily = body.remindDaily ?? notify.remindDaily;
|
||||
// 和服务端一样:刚打开时今天的 14:00 已过,从明天开始。
|
||||
const lastRemindAt = remindDaily && !notify.remindDaily && digestDue(now, null, tz) ? now : notify.lastRemindAt;
|
||||
notify = { digestTz: tz, remindDaily, lastRemindAt };
|
||||
if (body.digestEnabled !== undefined) digestOn = body.digestEnabled;
|
||||
return overview().meta;
|
||||
},
|
||||
// 导入记录:建项目时那一次导入(60 张新建、2 张补标签),被检查摘掉的 4 张里 1 张已经忽略;没导存量的项目没有导入留痕。
|
||||
batchImports: async () => {
|
||||
if (scene.stock === "empty") return { runs: [], items: [], activeJobId: null };
|
||||
const at = Date.now() - (scene.stock === "wrapup" ? 30 : 12) * D;
|
||||
const runs = [{ id: "run1", tag: TAG, kind: "import", startedBy: "jingyuan.yi@bytedance.com", startedAt: at, finishedAt: at + 4 * 60_000, source: VIEW, total: 66, created: 60, retagged: 2, setAside: 4, failed: 0, error: null }];
|
||||
const item = (i: number, outcome: string, reason: string | null, extra: Record<string, unknown> = {}) => ({
|
||||
meegoId: `${6790000 + i * 11}`, url: "https://example.invalid/meego", title: `【演示】${TITLES[(i + 5) % TITLES.length]}`, outcome, reason, evidence: null,
|
||||
taskId: outcome === "created" || outcome === "retagged" ? `s${i}` : null, runId: "run1", attempts: outcome === "set_aside" ? 0 : 1, updatedAt: at, ignoredAt: null, ignoredBy: null, ...extra,
|
||||
});
|
||||
const items = [
|
||||
...Array.from({ length: 60 }, (_, i) => item(i, i < 58 ? "created" : "retagged", null)),
|
||||
item(70, "set_aside", "mr"), item(71, "set_aside", "closed"), item(72, "set_aside", "duplicate"),
|
||||
item(73, "set_aside", "manual", { ignoredAt: at + 3600_000, ignoredBy: "xiaoxiang.wu@bytedance.com" }),
|
||||
];
|
||||
return { runs, items, activeJobId: null };
|
||||
},
|
||||
batchImportIgnore: async () => { await wait(); return { changed: 1 }; },
|
||||
batchWatch: async () => watchOverview(),
|
||||
batchWatchStates: async (_tag: string, extraStates: string[], alphaForP1?: boolean, next?: WatchSchedule) => {
|
||||
if (next) schedule = next;
|
||||
config = { ...config, extraStates, alphaForP1: alphaForP1 ?? config.alphaForP1, schedule };
|
||||
return config;
|
||||
},
|
||||
batchWatchSave: async (_tag: string, body: { enabled: boolean; viewUrl?: string; dailyCap?: number; schedule?: WatchSchedule }) => {
|
||||
await wait(700);
|
||||
if (body.schedule) schedule = body.schedule;
|
||||
if (body.enabled && !config.enabledAt) {
|
||||
// 第一次开启(第 ⑩ 幕):先演几秒「正在对一遍视图」,再记一次开启对账,留在这一幕。
|
||||
const now = Date.now();
|
||||
config = { ...config, ...ON, viewUrl: body.viewUrl ?? VIEW, dailyCap: body.dailyCap ?? config.dailyCap, schedule, enabledAt: now, syncedAt: null, lastScanAt: null, lastScanError: null };
|
||||
rows = [];
|
||||
scans = [];
|
||||
window.setTimeout(() => {
|
||||
const at = Date.now();
|
||||
config = { ...config, syncedAt: at, lastScanAt: at };
|
||||
scans = [{ at, inView: VIEW_BASE, fresh: VIEW_BASE, created: 0, queued: 0, skipped: { existing: 2 }, error: null }];
|
||||
window.dispatchEvent(new CustomEvent("demo-refresh"));
|
||||
}, 4000);
|
||||
} else {
|
||||
config = { ...config, enabled: body.enabled, auth: body.enabled ? "ok" : config.auth, lastScanError: null };
|
||||
if (body.enabled) config.lastScanAt = Date.now();
|
||||
}
|
||||
return config;
|
||||
},
|
||||
batchWatchScanNow: async () => {
|
||||
await wait(900);
|
||||
scans = [{ at: Date.now(), inView: VIEW_BASE + rows.length, fresh: 0, created: 0, queued: 0, skipped: {}, error: null }, ...scans];
|
||||
config = { ...config, lastScanAt: Date.now() };
|
||||
return { ok: true };
|
||||
},
|
||||
batchWatchDecide: async (_tag: string, body: { taskId: string; action: "rerun" | "handover" | "archive" | "review" | "import" }) => {
|
||||
await wait();
|
||||
if (body.action === "import") {
|
||||
const r = rows.find((x) => x.id === body.taskId);
|
||||
if (r) importedAnyway = [{ meegoId: r.meegoId, meegoUrl: r.meegoUrl, title: r.title, firstSeenAt: r.seenAt, inView: true, line: "stock", task: { id: r.id, status: "initializing", platform: r.platform, meegoState: r.meegoState }, watch: null, skip: null }, ...importedAnyway];
|
||||
rows = rows.filter((x) => x.id !== body.taskId);
|
||||
return { ok: true };
|
||||
}
|
||||
rows = rows.map((r) => r.id !== body.taskId ? r
|
||||
: body.action === "rerun" ? { ...r, state: "hosting", status: "queued", failure: null }
|
||||
: body.action === "handover" ? { ...r, state: "handed", handedOverAt: Date.now(), handoverKind: "manual", after: "waiting" }
|
||||
: body.action === "review" ? { ...r, state: "handed", status: "manual_review", reopened: false, failure: null, after: "waiting" }
|
||||
: r.reopened ? { ...r, state: "handed", status: "archived", reopened: false, failure: null, after: "other" }
|
||||
: { ...r, state: "withdrawn", withdrawnReason: "owner_archived", status: "archived" });
|
||||
return { ok: true };
|
||||
},
|
||||
});
|
||||
|
||||
// ── 演示控制栏 ───────────────────────────────────────────────────────────────
|
||||
|
||||
const L = (zh: string) => zh;
|
||||
|
||||
function Demo() {
|
||||
const [i, setI] = useState(0);
|
||||
const [mount, setMount] = useState(0);
|
||||
const s = SCENES[i];
|
||||
|
||||
const go = useCallback((n: number, remount = true) => {
|
||||
// 上一幕的礼花不带进这一幕;「上次看到的数字」也清掉,每一幕都当第一次打开(不出「你离开的 N 小时里」)。
|
||||
clearConfetti();
|
||||
try { localStorage.removeItem(`batchSeen:${TAG}`); localStorage.removeItem(`batchSeenBoard:${TAG}`); } catch { /* */ }
|
||||
load(SCENES[n]);
|
||||
setI(n);
|
||||
if (remount) setMount((m) => m + 1);
|
||||
}, []);
|
||||
|
||||
// 开启表单提交几秒后「对账跑完」:重新挂上页面,看开着的样子。
|
||||
useEffect(() => {
|
||||
const h = () => setMount((m) => m + 1);
|
||||
window.addEventListener("demo-refresh", h);
|
||||
return () => window.removeEventListener("demo-refresh", h);
|
||||
}, []);
|
||||
|
||||
// 挂上详情页之后替人点这一幕要点的东西;不写 click 的幕看默认打开哪条线。
|
||||
useEffect(() => {
|
||||
if (s.view === "list" || !s.click) return;
|
||||
const click = s.click;
|
||||
const find = (): HTMLButtonElement | null => {
|
||||
if (click.startsWith("tab:")) return [...document.querySelectorAll<HTMLButtonElement>(".bc-tabs [role='tab']")].find((b) => b.textContent?.includes(click.slice(4))) ?? null;
|
||||
if (click.startsWith("kpi:")) return document.querySelectorAll<HTMLButtonElement>(".bc-kpis .bc-kpi--btn")[Number(click.slice(4))] ?? null;
|
||||
return document.querySelector<HTMLButtonElement>(click === "settings" ? ".bc-head-actions [aria-label='设置']" : ".bc-head-actions [aria-label='通知']");
|
||||
};
|
||||
const t = window.setInterval(() => {
|
||||
const btn = find();
|
||||
if (btn) { btn.click(); window.clearInterval(t); }
|
||||
}, 60);
|
||||
return () => window.clearInterval(t);
|
||||
}, [mount, s.view, s.click]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="demo-bar">
|
||||
<div className="demo-step"><b>{s.title}</b><span>{s.desc}</span></div>
|
||||
<div className="demo-actions">
|
||||
<div className="filter-seg" role="group" aria-label="场景">
|
||||
{SCENES.map((x, n) => <button key={n} type="button" className={n === i ? "on" : ""} onClick={() => go(n)} title={x.title}>{x.title.slice(0, 1)}</button>)}
|
||||
</div>
|
||||
<button type="button" className="bc-btn bc-btn--primary" onClick={() => go(i + 1)} disabled={i >= SCENES.length - 1}>
|
||||
{i >= SCENES.length - 1 ? "完" : `下一步:${SCENES[i + 1].title.replace(/^.\s*/, "")}`}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="bc">
|
||||
{s.view === "list"
|
||||
? <BatchList key={mount} navigate={(r) => { if (r.tag) go(1); }} L={L} />
|
||||
: <BatchDetail key={mount} tag={TAG} navigate={() => go(0)} L={L} />}
|
||||
</div>
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.demo-bar { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--elev, #fff); border-bottom: 1px solid var(--border, #e5e7eb); box-shadow: 0 2px 10px rgba(0,0,0,.05); flex-wrap: wrap; }
|
||||
.demo-step { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-2, #444); }
|
||||
.demo-step b { font-size: 15px; color: var(--text, #111); }
|
||||
.demo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
load(SCENES[0]);
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,130 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import type { BoardItem } from "../types";
|
||||
import BitsTokenModal from "../components/BitsTokenModal";
|
||||
import Toaster from "../components/Toaster";
|
||||
import { reviewItemsAwaitingMyToken } from "../lib/bitsTokenNudge";
|
||||
import { setLang } from "../lib/i18n";
|
||||
import { api } from "../lib/api";
|
||||
|
||||
/**
|
||||
* 本地演示:打开面板时,名下有待复核、没 MR 的单而本人没绑 Bits Token,直接弹出绑定界面
|
||||
* (顶上一行说明为什么弹)。弹窗是真组件,判定是真函数,喂假看板;体检和保存两个接口
|
||||
* 在这页里换成了假的(体检全绿、保存成功并回带后台交接的张数),粘任意 32 位十六进制就能看到
|
||||
* 保存后的提示,不会碰到任何真实服务。
|
||||
*
|
||||
* 「头像菜单进来」两个按钮演示主动打开:已绑定的人看到「已绑定 · 保存于昨天」,能重新检测 /
|
||||
* 更换;没绑的人看到捕获流程(不带顶上那行说明)。重新检测可切「已存的失效」看红色结果。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-bits-nudge.html。给文档截图用 `?shot`(可带 `&n=3` 指定张数、`&lang=zh|en` 指定语言):去掉说明和开关,只剩弹窗。
|
||||
*/
|
||||
|
||||
const ME = "demo.user@bytedance.com";
|
||||
const mk = (id: string, kind: "bug" | "feature", title: string, over: Record<string, unknown> = {}): BoardItem =>
|
||||
({ id, kind, title, status: "manual_review", mrUrl: null, watchers: [ME], ...over } as unknown as BoardItem);
|
||||
|
||||
const BOARD: BoardItem[] = [
|
||||
mk("b1", "bug", "视频详情页评论数在 999+ 时被截断"),
|
||||
mk("b2", "bug", "横屏播放时双击点赞动画位置错误"),
|
||||
mk("f1", "feature", "DM 输入框支持粘贴图片直接发送"),
|
||||
mk("f2", "feature", "Friends 动态卡片新增「一起看」入口,点击后拉起共享播放面板,并在面板顶部显示同看人数"),
|
||||
mk("b3", "bug", "个人主页编辑资料页字段顺序错乱"),
|
||||
mk("b4", "bug", "搜索页清空历史后空态插画不居中"),
|
||||
mk("b5", "bug", "已有 MR 的单(不应出现)", { mrUrl: "https://bits.bytedance.net/x/1" }),
|
||||
mk("b6", "bug", "别人名下的单(不应出现)", { watchers: ["someone@bytedance.com"] }),
|
||||
mk("b7", "bug", "还在修的单(不应出现)", { status: "fixing" }),
|
||||
];
|
||||
|
||||
let demoHandover = 0;
|
||||
let demoBound = true;
|
||||
let demoStoredInvalid = false;
|
||||
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
api.meBitsToken = async () => {
|
||||
await wait(300);
|
||||
return demoBound ? { hasToken: true, savedAt: Date.now() - 26 * 3600_000 } : { hasToken: false, savedAt: null };
|
||||
};
|
||||
api.probeMyBitsToken = async (token?: string) => {
|
||||
await wait(600);
|
||||
if (token === undefined && demoStoredInvalid) return { auth: "invalid", repos: [] };
|
||||
return {
|
||||
auth: "valid",
|
||||
repos: [
|
||||
{ key: "android", label: "TikTok Android", result: "ok", message: "", spaceUrl: null, permissionUrl: null },
|
||||
{ key: "ios", label: "TikTok iOS", result: "ok", message: "", spaceUrl: null, permissionUrl: null },
|
||||
],
|
||||
} as Awaited<ReturnType<typeof api.probeMyBitsToken>>;
|
||||
};
|
||||
api.saveMyBitsToken = async () => ({ ok: true, hasToken: true, savedAt: Date.now(), handover: demoHandover });
|
||||
|
||||
const params = new URLSearchParams(location.search);
|
||||
const SHOT = params.has("shot");
|
||||
const LANG = params.get("lang");
|
||||
if (LANG === "zh" || LANG === "en") setLang(LANG);
|
||||
|
||||
function Demo() {
|
||||
const [count, setCount] = useState(() => Math.min(6, Math.max(1, Number(params.get("n")) || 6)));
|
||||
const [open, setOpen] = useState(!params.has("menu"));
|
||||
const [menu, setMenu] = useState<null | "bound" | "unbound">(params.get("menu") === "unbound" ? "unbound" : params.has("menu") ? "bound" : null);
|
||||
const [storedInvalid, setStoredInvalid] = useState(false);
|
||||
demoStoredInvalid = storedInvalid;
|
||||
const [log, setLog] = useState<string[]>([]);
|
||||
// 前 6 张是该提醒的,后 3 张是干扰项;按选中的数量截前面的。
|
||||
const board = [...BOARD.slice(0, count), ...BOARD.slice(6)];
|
||||
const items = reviewItemsAwaitingMyToken(board, ME);
|
||||
demoHandover = items.length;
|
||||
const note = (s: string) => setLog((l) => [s, ...l].slice(0, 6));
|
||||
return (
|
||||
<div className="nd-demo">
|
||||
{!SHOT && <>
|
||||
<h1>未绑 Bits Token 提醒</h1>
|
||||
<p className="nd-sub">打开面板时判一次:名下(关注人里有我)有待复核、还没 MR 的 Bug / Feature,且我没绑 Token → 直接弹绑定界面。点 ✕ / 取消 / 遮罩都能关,本标签页内不再弹,新开网页再弹。</p>
|
||||
<div className="nd-ctl">
|
||||
名下待复核单数:
|
||||
{[1, 3, 6].map((n) => (
|
||||
<button key={n} className={n === count ? "primary" : "ghost"} onClick={() => { setCount(n); setOpen(true); }}>{n}</button>
|
||||
))}
|
||||
<button className="ghost" onClick={() => setOpen(true)}>重新打开网页</button>
|
||||
</div>
|
||||
<div className="nd-ctl" style={{ marginTop: 10 }}>
|
||||
头像菜单进来:
|
||||
<button className="ghost" onClick={() => { demoBound = true; setOpen(false); setMenu("bound"); }}>已绑定的人</button>
|
||||
<button className="ghost" onClick={() => { demoBound = false; setOpen(false); setMenu("unbound"); }}>没绑的人</button>
|
||||
<label style={{ display: "inline-flex", gap: 4, alignItems: "center" }}>
|
||||
<input type="checkbox" checked={storedInvalid} onChange={(e) => setStoredInvalid(e.target.checked)} /> 已存的那把失效
|
||||
</label>
|
||||
</div>
|
||||
<ul className="nd-log">{log.map((s, i) => <li key={i}>{s}</li>)}</ul>
|
||||
</>}
|
||||
{menu && (
|
||||
<BitsTokenModal
|
||||
key={menu}
|
||||
onClose={() => { if (!SHOT) { setMenu(null); note("关闭头像菜单的绑定界面"); } }}
|
||||
onSaved={() => note("已保存")}
|
||||
/>
|
||||
)}
|
||||
{open && !menu && items.length > 0 && (
|
||||
<BitsTokenModal
|
||||
pending={items.length}
|
||||
onClose={() => { if (!SHOT) { setOpen(false); note("关闭(本标签页不再弹)"); } }}
|
||||
/>
|
||||
)}
|
||||
<Toaster />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.nd-demo { padding: 24px 32px 64px; max-width: 960px; color: var(--text); }
|
||||
.nd-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.nd-sub { font-size: 13px; color: var(--muted); margin: 0 0 20px; line-height: 1.6; }
|
||||
.nd-ctl { display: flex; gap: 8px; align-items: center; font-size: 13px; }
|
||||
.nd-log { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,64 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import CaseRunReportPanel from "../components/CaseRunReportPanel";
|
||||
import Toaster from "../components/Toaster";
|
||||
import type { CaseRunData } from "@bbbug/shared/case_run_report";
|
||||
|
||||
/**
|
||||
* 本地演示:改动验证报告里「检查点转 Bug」。不连任何接口 —— 建单、读写「已转」都换成内存假数据。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8093`,访问 /demo-case-run-filing.html。
|
||||
* `?dark=1` 看深色。点「转 Bug」→ 写一句期望 → 建单,下方会打印将要建出的 bug 单正文。
|
||||
*/
|
||||
if (new URLSearchParams(location.search).has("dark")) document.documentElement.dataset.theme = "dark";
|
||||
|
||||
const shot = (no: number) => `data:image/svg+xml;utf8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="180" height="320"><rect width="100%" height="100%" fill="#1f2430"/><text x="50%" y="50%" fill="#9aa3b2" font-size="20" text-anchor="middle">cp${no}</text></svg>`)}`;
|
||||
|
||||
const data: CaseRunData = {
|
||||
v: 1, format: "case-run", title: "Add to Story 草稿恢复 @ 不重复(改动验证试跑)",
|
||||
meta: [
|
||||
{ label: "被测提交", value: "5f856ef24f56 · p/jingyuan.yi/addtostory-draft-duplicate-mention" },
|
||||
{ label: "被测包", value: "com.zhiliaoapp.musically 47.6.0(2024706123),远程 clean 构建" },
|
||||
{ label: "设备", value: "Pixel 7 · Android 14" },
|
||||
],
|
||||
source: { kind: "agent-session", url: null, submittedBy: "jingyuan.yi@bytedance.com", agent: "claude-code", fetchedAt: Date.now() },
|
||||
cases: [
|
||||
{ id: "C01", path: ["冒烟:从本提交编出的包能正常启动"], pre: "已安装本次编出的包", step: "冷启动 App", videos: [],
|
||||
checkpoints: [{ no: 1, expect: "App 正常进入首页推荐流,没有崩溃或白屏", verdict: "pass", actual: "进入推荐流", detail: "", shot: "c01.png" }] },
|
||||
{ id: "C02", path: ["Add to Story 的草稿恢复后 @ 只显示一个"], pre: "两个互相关注的账号 A、B;用 B 发一条 @A 的快拍", step: "1. 用 A 登录,Add to Story\n2. 保存草稿后重新打开\n3. 冷启动后再打开",
|
||||
videos: [], blocked: { caseId: "C02", where: "节点上没有两个互相关注的账号", progress: "只有一个测试账号;需要提供第二个互关账号才能造前置条件" },
|
||||
checkpoints: [
|
||||
{ no: 2, expect: "重新打开后 @A 只显示一个", verdict: "blocked", actual: "", detail: "", shot: null },
|
||||
{ no: 3, expect: "再次保存并打开后 @A 仍然只显示一个", verdict: "blocked", actual: "", detail: "", shot: null },
|
||||
{ no: 4, expect: "冷启动后打开草稿 @A 仍然只显示一个", verdict: "blocked", actual: "", detail: "", shot: null },
|
||||
] },
|
||||
{ id: "C03", path: ["普通快拍草稿里的 @ 贴纸不受影响"], pre: "登录任意账号", step: "1. 进入快拍编辑页\n2. 添加 @ 贴纸\n3. 保存草稿再打开", videos: [],
|
||||
checkpoints: [{ no: 5, expect: "重新打开后 @ 贴纸仍在、只有一个,内容和保存前一致", verdict: "fail", actual: "@ 贴纸位置往左上偏了约 40px", detail: "复现 2 次,两次都偏", shot: "c05.png" }] },
|
||||
],
|
||||
extra: [{ heading: "3. 建议", body: "C03 的偏移可能来自草稿恢复时贴纸坐标按旧画布尺寸换算,建议看 checkAndConvertMentionStickerDraft 附近的坐标转换。" }],
|
||||
health: [], totals: { pass: 1, fail: 1, blocked: 3, judge: 0, missing: 0 }, generatedAt: Date.now(), model: "demo",
|
||||
};
|
||||
|
||||
const filed: { pageId: string; issueN: number; lang: string; note: string | null; filedTaskId: string | null }[] = [];
|
||||
const out = document.createElement("pre");
|
||||
out.style.cssText = "max-width:980px;margin:16px auto;padding:12px;white-space:pre-wrap;font-size:12px;border:1px dashed var(--border);border-radius:8px;color:var(--text-2)";
|
||||
const a = api as unknown as Record<string, unknown>;
|
||||
a.verificationAuditNotes = async () => ({ notes: filed });
|
||||
a.saveVerificationAuditNote = async (_id: string, body: (typeof filed)[number]) => { filed.push(body); return { ok: true }; };
|
||||
a.import = async (text: string) => {
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
out.textContent = `将要建出的 Bug 单正文:\n\n${text}`;
|
||||
return { added: [{ id: `demo-${Math.random().toString(16).slice(2, 10)}`, title: text.split("\n")[0] }], skipped: [] };
|
||||
};
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<div style={{ height: "100vh", overflow: "auto" }}>
|
||||
<div style={{ maxWidth: 980, margin: "24px auto", padding: "0 16px" }}>
|
||||
<CaseRunReportPanel data={data} resolveUrl={(n) => shot(Number(n.replace(/\D/g, "")) || 0)}
|
||||
source={{ id: "5a9c7764-6f98-47c2-b3e0-f2599143d471", title: "Add to Story 草稿恢复 @ 不重复(改动验证试跑)", platform: "android", clusters: [] }} />
|
||||
</div>
|
||||
<div ref={(el) => { if (el && !el.contains(out)) el.appendChild(out); }} />
|
||||
<Toaster />
|
||||
</div>,
|
||||
);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,180 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import CaseRunReportPanel from "../components/CaseRunReportPanel";
|
||||
import type { CaseRunData } from "@bbbug/shared/case_run_report";
|
||||
import type { VerdictSummary } from "@bbbug/shared/case_run_verdict";
|
||||
import snapshot from "./caseRunVerdictDemo.data.json";
|
||||
|
||||
/**
|
||||
* 本地演示:用例验证报告顶上加「结论卡」,两单真实数据(1c965adb Kids 重启弹窗、7bca8ceb Canvas Emoji)
|
||||
* 改版前后对照。数据是 10-24 从线上拉的快照,截图 / 录像直接走 CDN;不连任何接口。
|
||||
*
|
||||
* 结论卡的内容是照着两份报告原文手写的「目标样子」;线上由报告生成时的模型写
|
||||
* (shared/case_run_verdict.ts),形状相同。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8093`,访问 /demo-case-run-verdict.html。
|
||||
* `?task=7bca8ceb` 切单,`?view=old` 看现在的样子,`?dark=1` 看深色。
|
||||
*/
|
||||
const q = new URLSearchParams(location.search);
|
||||
if (q.has("dark")) document.documentElement.dataset.theme = "dark";
|
||||
|
||||
type Snap = { id: string; title: string; platform: string; node: string; minutes: number; data: CaseRunData; urls: Record<string, string> };
|
||||
const SNAP = snapshot as unknown as Record<string, Snap>;
|
||||
|
||||
const SUMMARY: Record<string, VerdictSummary> = {
|
||||
"1c965adb": {
|
||||
status: "partial",
|
||||
headline: "按返回键不会再关掉 Kids 重启弹窗",
|
||||
sub: "改动要修的问题在真机上已修好,普通账号也不受影响。「点重启后进 Kids 首页」那一半因为没有 Kids 测试账号没走到。另外从代码里看出一处可能让修复失效的场景,建议提交人看一下。",
|
||||
env: "Android · Pixel 10 Pro 真机 · 从提交 dea7b6f1 现编的包 · 执行 61 分钟",
|
||||
problems: [],
|
||||
proven: [
|
||||
{
|
||||
text: "按两次系统返回,弹窗还在 —— 没有掉回普通首页,也没有一直转圈",
|
||||
cps: ["C01 #1", "C01 #2"],
|
||||
why: "不只是两张截图一样:系统页面栈显示前后是同一个页面实例、一直在最前,说明返回键被拦下了,而不是关掉又重新打开。",
|
||||
shots: [{ file: "case-C01-r1-cp01.png", cap: "按返回前" }, { file: "case-C01-r1-cp02.png", cap: "按两次返回后" }],
|
||||
},
|
||||
{
|
||||
text: "普通账号冷启不会弹这个窗,首页视频正常播,返回键行为照旧",
|
||||
cps: ["C04 #8", "C04 #9"],
|
||||
why: "登录日志里没有任何进入 Kids 流程的事件。",
|
||||
shots: [{ file: "case-C04-r1-cp09.png", cap: "普通账号首页" }],
|
||||
},
|
||||
{
|
||||
text: "手机上装的就是这次提交编出来的包",
|
||||
cps: [],
|
||||
why: "安装包 md5 和本次构建产物一致,并且能读到这次提交新加的字段。",
|
||||
},
|
||||
],
|
||||
gaps: [
|
||||
{
|
||||
cause: "没有 Kids 测试账号",
|
||||
cps: ["C02 #3", "C02 #4", "C02 #5", "C03 #6", "C03 #7"],
|
||||
what: "用普通账号模拟 Kids 登录能把弹窗调出来(上面的证实就是这么做的),但点「重启应用」后,App 认出这不是儿童账号,退回普通模式、弹窗重新出现,Kids 首页始终没出现。",
|
||||
unblock: "给一个还没完成 Kids 重启的儿童测试账号(手机号 + 固定验证码),C02、C03 原样重跑即可。",
|
||||
owner: "提交人 / QA",
|
||||
shot: { file: "case-C02-r1-cp03.navfail.png", cap: "点重启后又弹回来" },
|
||||
},
|
||||
],
|
||||
findings: [
|
||||
{
|
||||
kind: "risk",
|
||||
text: "弹窗被盖住后「重新打开」的那段代码,在 App 整体退到后台时可能被 Android 拦掉,结果回到修复前:弹窗没了,网络却已经按 Kids 规则拦截。建议加一个「只在前台时重开」的判断,或重开失败时兜底。",
|
||||
tag: "从代码看出 · 本次未复现",
|
||||
},
|
||||
{
|
||||
kind: "suggest",
|
||||
text: "补两条用例:在弹窗上按 Home 再回来(这次顺手试过,表现正确,但不在用例里);点了「重启应用」、进程还没重启前按返回。",
|
||||
},
|
||||
],
|
||||
trust: [
|
||||
"C01 的录像被判无效:画面本来就该静止,但执行时没声明静态场景。结论靠截图 + 系统页面栈,不受影响。",
|
||||
"C02 的录像 124 秒,超过上限,只是过程记录,不承载结论。",
|
||||
],
|
||||
},
|
||||
"7bca8ceb": {
|
||||
status: "unproven",
|
||||
headline: "Emoji ID 的写出和回包,这次没验到",
|
||||
sub: "标题里的「ID 协议」—— 发出去的消息有没有带 Emoji ID、回来时有没有被剥掉 —— 抓不到数据,判不了。新旧架构切换、Remix 显示、退出释放这些外围行为都正常。跑在 macCatalyst 模拟器上,不是 iPhone 真机。",
|
||||
env: "iOS · macCatalyst DeviceSim 模拟器(非真机)· 从提交 d58ea35f 远端编译 · 执行 156 分钟",
|
||||
problems: [],
|
||||
proven: [
|
||||
{
|
||||
text: "实验关闭时走旧流程,打开才走新输入框",
|
||||
cps: ["C01 #1", "C01 #2", "C01 #3"],
|
||||
why: "按界面结构树里的具体组件判断新旧,不是看长得像;旧流程涉及的文件和架构基线逐字节一致。",
|
||||
},
|
||||
{
|
||||
text: "Remix 后三个 Emoji 各自独立显示,原文和位置都保留,没被放大成大图",
|
||||
cps: ["C02 #4", "C02 #5"],
|
||||
shots: [{ file: "case-C02-r1-cp04.png", cap: "Remix 后的提示" }],
|
||||
},
|
||||
{
|
||||
text: "Remix 提示不是可编辑内容:一敲字就整体消失",
|
||||
cps: ["C05 #15"],
|
||||
},
|
||||
{
|
||||
text: "不带 ID 的历史消息只显示文字,不会冒充还原;退出后视图正确释放",
|
||||
cps: ["C04 #11", "C04 #12", "C07 #21"],
|
||||
},
|
||||
],
|
||||
gaps: [
|
||||
{
|
||||
cause: "抓不到发出去的数据",
|
||||
cps: ["C03 #7", "C03 #8", "C03 #9"],
|
||||
what: "新架构的编码代码是纯 Swift,外部挂钩在 3 次真实发送里一次都没触发。所以「每个 Emoji 是否带着 ID 写出去」「回来时是不是服务端剥掉的」都判不了。",
|
||||
unblock: "在 Debug 包里给出站加一条日志,把每个块带的字段打出来。",
|
||||
owner: "提交人",
|
||||
},
|
||||
{
|
||||
cause: "后端没有带 Emoji ID 的样例数据",
|
||||
cps: ["C02 #6", "C04 #10", "C05 #13", "C05 #14"],
|
||||
what: "可编辑的 Emoji 只能由服务端下发的带 ID 文本产生。现在唯一造得出来的是 Remix 提示,一编辑就消失,所以删除、复制粘贴、冷读还原都测不了。",
|
||||
unblock: "后端给一个带 canvas.dm_official_emoji_id 的预填 / 推荐样例,或一条可控的回包 mock。",
|
||||
alt: "调试面板加一个「插入官方 Emoji」动作,不依赖后端。",
|
||||
owner: "后端",
|
||||
},
|
||||
{
|
||||
cause: "平台没有控流和计数工具",
|
||||
cps: ["C06 #16", "C06 #17", "C06 #18", "C07 #19", "C07 #20"],
|
||||
what: "加载中占位、资源失败兜底、请求合并、启动耗时这几项,要么得注入失败,要么得数请求次数 / 量耗时,这次都没有对应工具。",
|
||||
unblock: "资源失败注入 + 请求计数;性能项先定基线(架构 MR 上的对照值)。",
|
||||
owner: "平台",
|
||||
},
|
||||
],
|
||||
findings: [
|
||||
{ kind: "suggest", text: "测试计划有两处和实际不符:单测文件路径写错了;远端构建工具没有单测入口,「有就跑单测」这条永远跑不了,单测这次也就没跑。" },
|
||||
{ kind: "suggest", text: "任务里给的参考文档链接指错了(指向的是 Streamline 接入指南),当前账号也没有读权限。" },
|
||||
{ kind: "note", text: "为了造前置条件,往测试会话里发了几条 Emoji 消息、建了几个 Canvas 生成任务,都没删。" },
|
||||
],
|
||||
trust: [
|
||||
"跑在模拟器上:所有「通过」都是模拟器通过,不能说成真机通过。",
|
||||
"C01 #3 的截图是调试页,看不出新旧输入框;这一条的结论来自界面结构树,截图本身证明不了。",
|
||||
"6 条用例的截图拍在录像区间外,点检查点跳不到录像对应的那一秒。",
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
const ORDER = ["1c965adb", "7bca8ceb"];
|
||||
|
||||
function Demo() {
|
||||
const [task, setTask] = useState(() => ORDER.includes(q.get("task") ?? "") ? q.get("task")! : ORDER[0]);
|
||||
const [view, setView] = useState<"new" | "old">(() => q.get("view") === "old" ? "old" : "new");
|
||||
const snap = SNAP[task];
|
||||
const resolveUrl = (n: string) => snap.urls[n] ?? "";
|
||||
const go = (t: string, v: "new" | "old") => {
|
||||
setTask(t); setView(v);
|
||||
const u = new URL(location.href);
|
||||
u.searchParams.set("task", t); u.searchParams.set("view", v);
|
||||
history.replaceState(null, "", u);
|
||||
document.querySelector(".crv-demo-scroll")?.scrollTo({ top: 0 });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="crv-demo-scroll" style={{ height: "100vh", overflow: "auto", background: "var(--bg)" }}>
|
||||
<div style={{ position: "sticky", top: 0, zIndex: 5, background: "var(--surface)", borderBottom: "1px solid var(--border)" }}>
|
||||
<div style={{ maxWidth: 960, margin: "0 auto", padding: "10px 16px", display: "flex", flexWrap: "wrap", gap: 12, alignItems: "center" }}>
|
||||
<div className="cr-filters" style={{ margin: 0 }}>
|
||||
{ORDER.map((t) => (
|
||||
<button key={t} type="button" className={task === t ? "is-on" : ""} onClick={() => go(t, view)}>{SNAP[t].title}</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="cr-filters" style={{ margin: "0 0 0 auto" }}>
|
||||
<button type="button" className={view === "old" ? "is-on" : ""} onClick={() => go(task, "old")}>现在的样子</button>
|
||||
<button type="button" className={view === "new" ? "is-on" : ""} onClick={() => go(task, "new")}>改版后</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ maxWidth: 960, margin: "20px auto 60px", padding: "0 16px", display: "flex", flexDirection: "column", gap: 22 }}>
|
||||
<h1 style={{ margin: 0, fontSize: 18, fontWeight: 650 }}>{snap.title}</h1>
|
||||
{view === "new"
|
||||
? <CaseRunReportPanel key={`${task}-n`} data={{ ...snap.data, verdict: SUMMARY[task] }} resolveUrl={resolveUrl} />
|
||||
: <CaseRunReportPanel key={`${task}-o`} data={snap.data} resolveUrl={resolveUrl} hideVerdict />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,179 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api, type CiGateReport, type MrCommentsResponse } from "../lib/api";
|
||||
import CiGatePanel from "../components/CiGatePanel";
|
||||
import ReviewComposer from "../components/ReviewComposer";
|
||||
import { CiGateRow } from "../components/TaskDetailDrawer";
|
||||
import { setReviewTarget, openReview } from "../lib/reviewDraft";
|
||||
import Toaster from "../components/Toaster";
|
||||
import {
|
||||
CI_CATEGORY_LABEL, CI_FIX_SOURCE_LABEL, DEFAULT_CI_GATE_SETTINGS, summarizeCiGate,
|
||||
type CiFailureCategory, type CiFinding, type CiFixSource, type CiGateEvent, type CiGateRunView, type CiGateSettings, type CiSyncJobView,
|
||||
} from "@bbbug/shared/ci_gate";
|
||||
|
||||
/**
|
||||
* 本地演示:管理台「CI 收尾」页,用假数据。比例照 2026-10 的采样定(iOS 首次 CI 约三成红,
|
||||
* 红的里面钟馗规则和分支落后各占一大块,其余是基建抽风 / 编译 / 单测 / 要审批的)。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-ci-gate.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const MIN = 60_000;
|
||||
const now = Date.now();
|
||||
let seed = 7;
|
||||
const rnd = () => { seed = (seed * 16807) % 2147483647; return seed / 2147483647; };
|
||||
const pick = <T,>(xs: T[]) => xs[Math.floor(rnd() * xs.length)]!;
|
||||
|
||||
const TITLES = [
|
||||
"【iOS】私信列表长按菜单在横屏下错位", "【Android】关注页「更多」按钮点击无响应", "【iOS】个人页头像预览缩放后无法关闭",
|
||||
"【Android】评论区表情后 @昵称 不高亮", "【iOS】分享二维码页在深色模式下看不清", "【Android】直播间礼物面板偶现空白",
|
||||
"【iOS】音乐锚点单图时长显示错误", "【Android】故事发布失败没有提示", "【iOS】收件箱公告卡片按钮无障碍标签缺失",
|
||||
"【Android】特效面板导航图标颜色不对", "【iOS】好友推荐弹窗重复出现", "【Android】草稿箱封面加载慢",
|
||||
];
|
||||
|
||||
const FINDING: Record<CiFailureCategory, CiFinding> = {
|
||||
rule: { job: "check_t_zhongkui_pre", stage: "check", jobId: 1, url: "https://bits.bytedance.net/devops/1500037378/code/detail/1/report/1", category: "rule",
|
||||
items: [{ file: "Modules/TikTokUserRecommend/Classes/Core/TTKFFFListMoreActionButtonUtilities.m", line: 42, rule: "LimitKeywordsTTKABTest", message: "限制使用关键字「TTKABTest.」。TTKABTest.key_name 已弃用,请改用 ABTesting.ModuleName.key_name" }] },
|
||||
build: { job: "build_m", stage: "build", jobId: 2, url: "", category: "build", items: [{ file: "Modules/TikTokIM/Tests/AWEIMUserMessageCellViewModelMock.m", line: 15, message: "auto property synthesis will not synthesize property 'shouldShowAIAvatarBadge'" }] },
|
||||
unit_test: { job: "test_im_unit", stage: "test", jobId: 3, url: "", category: "unit_test", items: [{ message: "unit_test failed, xctest report: https://xctest.bytedance.net/dashboard/task?task_id=demo" }] },
|
||||
static: { job: "z_check_code_check", stage: "check", jobId: 4, url: "", category: "static", items: [{ file: "app/src/main/java/com/ss/android/ugc/aweme/Foo.kt", line: 88, rule: "1-2-1-ThreadUsage", message: "禁止直接 new Thread,请使用线程池" }] },
|
||||
infra: { job: "build_m", stage: "build", jobId: 5, url: "", category: "infra", items: [] },
|
||||
out_of_date: { job: "trigger_pipeline", stage: "other", jobId: 6, url: "", category: "out_of_date", items: [] },
|
||||
approval: { job: "check_t_zhongkui_pre", stage: "check", jobId: 7, url: "", category: "approval", items: [{ rule: "LaunchCodeProtectionChecker", message: "启动期代码需 FF 包裹并在审批门禁发起审批" }] },
|
||||
other: { job: "performance_gate", stage: "check", jobId: 8, url: "", category: "other", items: [] },
|
||||
};
|
||||
|
||||
function fakeRun(i: number, kind: "bug" | "feature"): CiGateRunView {
|
||||
const platform = rnd() < 0.55 ? "ios" : "android";
|
||||
const startedAt = now - Math.floor(rnd() * 7 * 24 * 60) * MIN - 30 * MIN;
|
||||
const ciMin = platform === "ios" ? 30 + rnd() * 20 : 45 + rnd() * 25;
|
||||
const events: CiGateEvent[] = [{ at: startedAt, type: "start", detail: "交付给人,开始跟进 MR 的 CI(不扣交付)" }];
|
||||
let t = startedAt + ciMin * MIN;
|
||||
const firstRed = rnd() < (platform === "ios" ? 0.33 : 0.15);
|
||||
const cat: CiFailureCategory = pick(["rule", "rule", "out_of_date", "out_of_date", "infra", "infra", "build", "unit_test", "approval", "static"] as CiFailureCategory[]);
|
||||
const firstFailed = firstRed ? [{ job: FINDING[cat].job, category: cat }] : [];
|
||||
events.push({ at: t, type: "ci", verdict: firstRed ? "red" : "green", ms: ciMin * MIN, detail: firstRed ? `CI 红:${FINDING[cat].job}(${CI_CATEGORY_LABEL[cat]})` : "CI 全绿(22 项)", failed: firstFailed });
|
||||
let fixRounds = 0, fixMs = 0, retries = 0, syncs = 0;
|
||||
let outcome: CiGateRunView["outcome"] = firstRed ? null : (rnd() < 0.5 ? "green" : "merged");
|
||||
let phase: CiGateRunView["phase"] = firstRed ? "awaiting" : "done";
|
||||
let latest: CiFinding[] = firstRed ? [FINDING[cat]] : [];
|
||||
if (firstRed) {
|
||||
const handled = rnd() < 0.75;
|
||||
if (cat === "infra" && handled) {
|
||||
retries = 1; events.push({ at: t + MIN, type: "retry", detail: `重跑:${FINDING[cat].job}` }); t += 18 * MIN; outcome = "green";
|
||||
} else if (cat === "out_of_date" && handled) {
|
||||
syncs = 1; events.push({ at: t + MIN, type: "sync_enqueue", detail: "分支落后超过 5 天,派节点把 develop 合进来" });
|
||||
t += 6 * MIN; events.push({ at: t, type: "sync_done", ms: 5 * MIN, detail: "fei-ios-02 已把 develop 合进分支并推送" });
|
||||
t += ciMin * MIN; outcome = "green";
|
||||
} else if (["rule", "build", "unit_test", "static"].includes(cat) && handled) {
|
||||
const source: CiFixSource = pick(["reject", "boost", "boost", "auto"]);
|
||||
fixRounds = 1; const round = (25 + rnd() * 50) * MIN; fixMs = source === "reject" ? 0 : round;
|
||||
events.push({ at: t + 20 * MIN, type: "fix_requeue", source, detail: `第 1 次回炉(${CI_FIX_SOURCE_LABEL[source]},从「${source === "reject" ? "人工复核" : "已修复"}」发起):${FINDING[cat].job}(${CI_CATEGORY_LABEL[cat]})` });
|
||||
if (source !== "reject") {
|
||||
t += 20 * MIN + round; events.push({ at: t, type: "fix_done", ms: round, detail: "回炉轮完成,已回到「已修复」,等新 commit 的 CI" });
|
||||
t += ciMin * MIN; outcome = "green";
|
||||
} else { outcome = "preempted"; }
|
||||
}
|
||||
if (outcome) { phase = "done"; latest = []; }
|
||||
}
|
||||
if (outcome) events.push({ at: t, type: "ci", verdict: outcome === "preempted" ? "red" : "green", detail: outcome === "preempted" ? "" : "CI 全绿" });
|
||||
if (outcome) events.push({ at: t, type: "end", detail: outcome === "preempted" ? "又一轮交付开始,上一轮让位" : outcome === "merged" ? "MR 已合入" : "CI 全绿" });
|
||||
else events.push({ at: t, type: "note", detail: ["rule", "build", "unit_test", "static"].includes(cat) ? "CI 红着:复核中:等复核人打回时导入或一键修复" : "CI 红着:剩下的失败需要人处理(审批 / 未识别)" });
|
||||
return {
|
||||
id: `r${kind}${i}`, kind, itemId: `item-${kind}-${i}`,
|
||||
title: pick(TITLES.filter((x) => x.includes(platform === "ios" ? "iOS" : "Android"))), platform,
|
||||
mode: "follow", mrUrl: "https://bits.bytedance.net/devops/1500037378/code/detail/8494580", round: 1,
|
||||
phase, outcome, startedAt, endedAt: outcome ? t : null, deliveredAt: null,
|
||||
firstVerdict: firstRed ? "red" : "green", firstVerdictAt: startedAt + ciMin * MIN, firstFailed,
|
||||
finalVerdict: outcome ? (outcome === "preempted" ? "red" : "green") : null,
|
||||
latestFindings: latest, boostFrom: null, fixRounds, fixMs, retries, syncs, events,
|
||||
};
|
||||
}
|
||||
|
||||
const runs = [
|
||||
...Array.from({ length: 46 }, (_, i) => fakeRun(i, "bug")),
|
||||
...Array.from({ length: 14 }, (_, i) => fakeRun(i + 50, "feature")),
|
||||
].sort((a, b) => b.startedAt - a.startedAt);
|
||||
|
||||
/** 抽屉 / 打回框演示用的那张单:复核中,CI 红在钟馗规则 + 编译。 */
|
||||
const DEMO_RED: CiGateRunView = {
|
||||
...fakeRun(999, "bug"),
|
||||
id: "demo-red", itemId: "demo-red", title: "【iOS】好友推荐弹窗重复出现", platform: "ios", phase: "awaiting", outcome: null,
|
||||
firstVerdict: "red", finalVerdict: null, endedAt: null, latestFindings: [FINDING.rule, FINDING.build], fixRounds: 0,
|
||||
};
|
||||
|
||||
const syncs: (CiSyncJobView & { title: string | null })[] = [
|
||||
{ id: "s1", kind: "bug", itemId: "item-blocking-4", runId: "r", platform: "ios", branch: "bugfix/lyrics-anchor-single-image-duration", targetBranch: "develop", status: "merged", nodeId: "fei-ios-02.local", createdAt: now - 3 * 60 * MIN, finishedAt: now - 3 * 60 * MIN + 5 * MIN, detail: null, title: TITLES[6]! },
|
||||
{ id: "s2", kind: "bug", itemId: "item-blocking-9", runId: null, platform: "ios", branch: "bugfix/inbox-bulletin-a11y", targetBranch: "develop", status: "conflict", nodeId: "fei-ios-01.local", createdAt: now - 26 * 60 * MIN, finishedAt: now - 26 * 60 * MIN + 4 * MIN, detail: "Modules/TikTokInbox/Classes/TTKInboxBulletinBoardGuideCollectionViewCell.m", title: TITLES[8]! },
|
||||
{ id: "s3", kind: "feature", itemId: "item-follow-51", runId: null, platform: "android", branch: "feature/draft-cover-preload", targetBranch: "develop", status: "queued", nodeId: null, createdAt: now - 8 * MIN, finishedAt: null, detail: null, title: TITLES[11]! },
|
||||
];
|
||||
|
||||
let settings: CiGateSettings = { ...DEFAULT_CI_GATE_SETTINGS };
|
||||
|
||||
Object.assign(api, {
|
||||
ciGateReport: async (days = 7): Promise<CiGateReport> => {
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
const since = now - days * 24 * 60 * MIN;
|
||||
return { settings, stats: summarizeCiGate(runs, since), runs: runs.filter((r) => r.startedAt >= since), syncs };
|
||||
},
|
||||
ciGateSaveSettings: async (s: CiGateSettings) => {
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
settings = s;
|
||||
return { settings };
|
||||
},
|
||||
ciGateForItem: async () => ({ runs: [demoRun] }),
|
||||
ciGateBoost: async () => {
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
demoRun = { ...demoRun, phase: "fixing", boostFrom: "manual_review", fixRounds: demoRun.fixRounds + 1 };
|
||||
return { ok: true };
|
||||
},
|
||||
reviewReject: async (_id: string, _md: string, _mr?: string[], ciJobs?: string[]) => {
|
||||
await new Promise((r) => setTimeout(r, 500));
|
||||
return { ok: true, ciFindings: ciJobs?.length || undefined };
|
||||
},
|
||||
mrComments: async (): Promise<MrCommentsResponse> => {
|
||||
await new Promise((r) => setTimeout(r, 600));
|
||||
return {
|
||||
ok: true, totalLive: 2, dropped: { resolved: 1, outdated: 0 },
|
||||
comments: [
|
||||
{ threadId: "t1", commentId: "c1", author: "aime", path: "Modules/TikTokUserRecommend/Classes/Core/TTKFFFListMoreActionButtonUtilities.m", line: 58, createdAt: now,
|
||||
body: "**Issue Description**\n弹窗关闭后没有清掉 `hasShownPopup`,下次进入页面时会再次弹出。\n```suggestion\nself.hasShownPopup = YES;\n```", diff: null, maybeStale: false, replies: [] },
|
||||
{ threadId: "t2", commentId: "c2", author: "reviewer.a", path: null, line: null, createdAt: now,
|
||||
body: "注释请用英文。", diff: null, maybeStale: false, replies: ["好的"] },
|
||||
],
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
let demoRun: CiGateRunView = DEMO_RED;
|
||||
|
||||
function Demo() {
|
||||
const [status, setStatus] = useState("manual_review");
|
||||
return (
|
||||
<div style={{ minHeight: "100vh", background: "var(--bg)" }}>
|
||||
<div style={{ padding: 24, maxWidth: 1280, margin: "0 auto", display: "flex", flexDirection: "column", gap: 20 }}>
|
||||
<div style={{ background: "var(--surface)", border: "1px solid var(--border)", borderRadius: "var(--r)", padding: "14px 16px" }}>
|
||||
<b style={{ fontSize: 13.5 }}>抽屉里的「CI 收尾」一行(复核中的单,CI 红在钟馗规则 + 编译)</b>
|
||||
<p style={{ fontSize: 12, color: "var(--muted)", margin: "4px 0 10px" }}>点状态标签展开失败明细;「一键修复 CI」把它们交回 agent。右下角是打回框:CI 失败已经默认作为标签放进去了,「导入 MR 反馈」里可以增减 CI 失败、勾选 Code Review 评论。</p>
|
||||
<dl className="kv"><CiGateRow kind="bug" id="demo-red" status={status} /></dl>
|
||||
<button type="button" className="chip" style={{ marginTop: 8 }} onClick={() => { demoRun = DEMO_RED; setStatus(status + " "); }}>重置演示</button>
|
||||
</div>
|
||||
<CiGatePanel />
|
||||
</div>
|
||||
<ReviewComposer />
|
||||
<Toaster />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
setReviewTarget({ kind: "bug", id: "demo-red", title: "【iOS】好友推荐弹窗重复出现", mrUrl: "https://bits.bytedance.net/devops/1500037378/code/detail/8494580" });
|
||||
openReview();
|
||||
|
||||
// 全局样式把 html/body/#root 锁成整屏应用布局(滚动在应用内部的容器里),演示页要整页滚。
|
||||
const unlock = document.createElement("style");
|
||||
unlock.textContent = "html, body, #root { height: auto !important; overflow: auto !important; }";
|
||||
document.head.appendChild(unlock);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,36 @@
|
||||
import { api } from "../lib/api";
|
||||
import { setLang } from "../lib/i18n";
|
||||
|
||||
// Standalone sharing build: every API read comes from the published snapshot.
|
||||
// Never forward requests or mutations to the live control plane.
|
||||
async function start() {
|
||||
setLang("zh");
|
||||
document.documentElement.lang = "zh-CN";
|
||||
const originalFetch = window.fetch.bind(window);
|
||||
const snapshot = await (await originalFetch("/snapshot.json")).json() as {
|
||||
responses: Record<string, { type: string; data: unknown }>;
|
||||
media: Record<string, string>;
|
||||
};
|
||||
const snapshotFetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> = async (input, init) => {
|
||||
const url = new URL(typeof input === "string" ? input : input instanceof URL ? input.href : input.url, location.href);
|
||||
if (!url.pathname.startsWith("/api/")) return originalFetch(input, init);
|
||||
const method = init?.method ?? (input instanceof Request ? input.method : "GET");
|
||||
const cached = snapshot.responses[url.pathname + url.search] ?? snapshot.responses[url.pathname];
|
||||
if (method.toUpperCase() === "GET" && cached) {
|
||||
return new Response(cached.type === "json" ? JSON.stringify(cached.data) : String(cached.data), {
|
||||
headers: { "Content-Type": cached.type === "json" ? "application/json" : "text/plain" },
|
||||
});
|
||||
}
|
||||
return new Response(JSON.stringify({ error: "此静态预览未包含该材料,操作不会写入线上数据" }), {
|
||||
status: 404, headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
};
|
||||
window.fetch = snapshotFetch as typeof window.fetch;
|
||||
api.me = async () => ({ email: null, isAdmin: false, isSuper: false });
|
||||
api.verificationEvidenceFileUrl = (id, name) => snapshot.media[`${id}:${name}`] ?? "";
|
||||
api.resolveWatchers = async (keys) => ({ names: Object.fromEntries(keys.map((key) => [key, key])) });
|
||||
await import("./auditFixDemo");
|
||||
}
|
||||
void start().catch(() => {
|
||||
document.getElementById("root")!.textContent = "预览加载失败,请刷新重试。";
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,31 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { HostingTrendCard, HostingTrendOverview } from "../components/HostingTrend";
|
||||
import type { HostingTrendTeam } from "@bbbug/shared/hosting_trend";
|
||||
import data from "./hostingTrendDemo.data.json";
|
||||
|
||||
/**
|
||||
* 本地演示:托管效果看板。数据是 2026-11-12 从 Meego 真实还原的(5 个托管团队、近 90 天),不是假数据;
|
||||
* 还原脚本与校验见 memory hosted-teams-open-bug-dashboard。打开方式:
|
||||
* control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问 /demo-hosting-trend.html。
|
||||
*/
|
||||
const L = (zh: string) => zh;
|
||||
const teams = (data as { asOf: string; teams: HostingTrendTeam[] }).teams;
|
||||
|
||||
function Page() {
|
||||
return (
|
||||
<div className="ht-scroll"><div className="ht-page">
|
||||
<header>
|
||||
<h1>托管效果 · 未解决 bug 总量</h1>
|
||||
<p>
|
||||
每个接入托管的团队:Meego 视图范围内、每天结束时处于 open / reopened 的 bug 数,往前还原到 {teams[0]?.days[0]?.day}。
|
||||
基线取存量治理开始前 28 天(存量期常有批量关单,拿它当基线会失真)。托管开启后总量比基线低、并且近两周净流量 ≤ 0(关掉的不少于进来的),才算「下降且收敛」。数据截至 {(data as { asOf: string }).asOf}。
|
||||
</p>
|
||||
</header>
|
||||
<HostingTrendOverview teams={teams} L={L} />
|
||||
{teams.map((t) => <HostingTrendCard key={t.tag} team={t} L={L} />)}
|
||||
</div></div>
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Page />);
|
||||
@@ -0,0 +1,151 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api, type RetargetPreview } from "../lib/api";
|
||||
import type { BoardItem, Task } from "../types";
|
||||
import type { TaskRetarget } from "@bbbug/shared/alpha_branch";
|
||||
import { retargetBlock, retargetBranchName } from "@bbbug/shared/alpha_branch";
|
||||
import TaskCard from "../components/TaskCard";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:抽屉 MR 行只留「打开 / 提交」,其它收进「MR 操作」弹窗;弹窗里的「重做到 alpha」。
|
||||
* 抽屉是真组件,喂假数据;MR 相关接口在这里打桩。「重做」跑完用 4 秒假装一轮。其它接口连不上,只看 MR 那一块。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-mr-actions.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
* 批次设置里的「P1 及以上的新单走最新 alpha」在 /demo-batch-watch.html 的「设置」那一幕。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const mrUrl = (id: number) => `https://bits.bytedance.net/devops/1499114242/code/detail/${id}`;
|
||||
const LATEST: Record<string, string> = { android: "alpha/v4770", ios: "alpha/47.7.0" };
|
||||
const base = {
|
||||
kind: "bug" as const, platform: "android", priorityKey: 1, pinned: 0, createdAt: now - 26 * 3_600_000,
|
||||
statusChangedAt: now - 40 * 60_000, clusters: [], tags: [], watchers: ["rd.li@bytedance.com"],
|
||||
watcherLabels: { "rd.li@bytedance.com": "李研发" }, status: "manual_review",
|
||||
mrState: "opened", mergedIntoBaseAt: null, baseRef: null, repoKey: "tiktok-android", retarget: null,
|
||||
createdViaKeyId: null, createdViaSource: null, createdViaLabel: null, createdViaOwner: null, externalId: null,
|
||||
description: "增量托管自动导入。", executionPlan: null, reproSteps: null, remark: null, reviewHistory: [],
|
||||
attempts: 1, executorNodeId: "fei-android-01", branchName: "bugfix/comment-mention-highlight",
|
||||
workspacePath: "/tmp/demo", beforeEvidencePath: "/tmp/demo/before.png", afterEvidencePath: "/tmp/demo/after.png", failureReason: null,
|
||||
meegoId: "7388192503", meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/7388192503", mrUrl: mrUrl(8500001),
|
||||
};
|
||||
const mk = (over: Record<string, unknown>): BoardItem => ({ ...base, ...over } as unknown as BoardItem);
|
||||
|
||||
interface Scenario { note: string; item: BoardItem; outcome?: "moved" | "failed" }
|
||||
const SCENARIOS: Scenario[] = [
|
||||
{ note: "① 最典型:在 develop 上修好了,群里说要进 alpha。点「MR 操作」→「重做」,4 秒后成功(真实是排队跑一轮),基线和 MR 都换掉", outcome: "moved",
|
||||
item: mk({ id: "a1", title: "【Android】评论区 @昵称不高亮" }) },
|
||||
{ note: "② 同样发起,但这一轮没成:回到待复核,原 MR 和基线不变,弹窗里写原因", outcome: "failed",
|
||||
item: mk({ id: "a2", title: "【Android】故事发布失败没有提示", branchName: "bugfix/story-publish-toast", mrUrl: mrUrl(8500002) }) },
|
||||
{ note: "③ 增量托管按 P1 自动走 alpha 的单:已经在最新 alpha 上,按钮置灰并说明原因", item: mk({ id: "a3", title: "【Android】P1 · 发布页崩溃", baseRef: "alpha/v4770", mrUrl: mrUrl(8500003), branchName: "bugfix/publish-crash" }) },
|
||||
{ note: "④ 赶上了上一趟 alpha,复核拖到新 alpha 切出来:可以从 alpha/47.6.0 再挪到 alpha/47.7.0(iOS 的分支写法)", outcome: "moved",
|
||||
item: mk({ id: "a4", title: "【iOS】个人页头像预览无法关闭", platform: "ios", repoKey: "tiktok-ios", baseRef: "alpha/47.6.0", mrUrl: mrUrl(8500004), branchName: "bugfix/avatar-preview-close-alpha-47.6.0" }) },
|
||||
{ note: "⑤ MR 已合入(已修复):弹窗里没有「重做」,只剩能做的;这里按经办人重建也没了,所以入口不出现", item: mk({ id: "a5", title: "【Android】关注页「更多」无响应", status: "fix_succeeded", mrState: "merged", mrUrl: mrUrl(8500005), mrMergedAt: now - 3_600_000 }) },
|
||||
{ note: "⑥ 新 MR 建好了但旧 MR 没关掉(没人有权限):入口有警示,弹窗给旧 MR 链接", item: mk({ id: "a6", title: "【Android】草稿箱封面加载慢", baseRef: "alpha/v4770", mrUrl: mrUrl(8500006),
|
||||
retarget: { ref: "alpha/v4770", fromBranch: "bugfix/draft-cover", fromBase: "develop", oldMrUrl: mrUrl(8400006), by: "rd.li", at: now, phase: "closing_old" } satisfies TaskRetarget }) },
|
||||
{ note: "⑦ MR 提交失败:红色「MR 提交失败」,失败引导直接展开在下面,点这一行收起 / 展开", item: mk({ id: "a7", title: "【Android】直播间礼物面板偶现空白", mrUrl: null, mrState: null, failureReason: "create_mr: permission denied: no developer role" }) },
|
||||
{ note: "⑧ 还没提交 MR:琥珀色「MR 未创建」,右边小字「提交 MR」,整行一点就提交;提交中整行不可点", item: mk({ id: "a8", title: "【Android】私信输入框高度抖动", mrUrl: null, mrState: null }) },
|
||||
{ note: "⑨ 这一轮重做正在跑:复核区没了,抽屉基本信息里有一行「移动基线」", item: mk({ id: "a9", title: "【Android】分享面板图标错位", status: "fixing",
|
||||
retarget: { ref: "alpha/v4770", fromBranch: "bugfix/share-icon", fromBase: "develop", oldMrUrl: mrUrl(8500009), by: "rd.li", at: now, phase: "running" } satisfies TaskRetarget }) },
|
||||
{ note: "⑩ Feature 还没提交 MR:先选「产品需求 / 技术优化」(产品需求必填 Meego 单,这里从描述预填),再选以谁的名义提交。提交参数打在控制台",
|
||||
item: mk({ id: "f1", kind: "feature", title: "Lemon8 - 投稿后 landing 到 feed", mrUrl: null, mrState: null, meegoId: null, meegoUrl: null,
|
||||
branchName: "feature/l8-post-landing", description: "投稿后落到 feed。需求单 https://meego.larkoffice.com/tiktok/story/detail/7382040553" }) },
|
||||
{ note: "⑪ Feature 已提交 MR:「查看 MR ↗」", item: mk({ id: "f2", kind: "feature", title: "Lemon8 - 发布页草稿自动保存", meegoId: null, meegoUrl: null, mrUrl: mrUrl(8500011) }) },
|
||||
];
|
||||
|
||||
const outcomes = new Map(SCENARIOS.map((s) => [s.item.id, s.outcome]));
|
||||
let items = new Map(SCENARIOS.map((s) => [s.item.id, s.item]));
|
||||
let render: () => void = () => {};
|
||||
const patch = (id: string, over: Record<string, unknown>) => { items = new Map(items).set(id, { ...items.get(id)!, ...over } as BoardItem); render(); };
|
||||
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
Object.assign(api, {
|
||||
me: async () => ({ email: "rd.li@bytedance.com", hasBitsToken: true }),
|
||||
retargetPreview: async (id: string): Promise<RetargetPreview> => {
|
||||
await wait(500);
|
||||
const t = items.get(id) as Task;
|
||||
const latest = LATEST[t.platform] ?? null;
|
||||
return { baseRef: t.baseRef, latest, block: retargetBlock(t, latest) };
|
||||
},
|
||||
retarget: async (id: string) => {
|
||||
await wait(400);
|
||||
const t = items.get(id) as Task;
|
||||
const ref = LATEST[t.platform]!;
|
||||
const retarget: TaskRetarget = { ref, fromBranch: t.branchName, fromBase: t.baseRef || "develop", oldMrUrl: t.mrUrl, by: "rd.li", at: Date.now(), phase: "running" };
|
||||
patch(id, { status: "fixing", retarget });
|
||||
void wait(4000).then(() => {
|
||||
if (outcomes.get(id) === "failed") {
|
||||
patch(id, { status: "manual_review", retarget: { ...retarget, phase: "failed", error: `修复依赖的代码在 ${ref} 上不存在,确认这个问题不在这条分支上` } });
|
||||
} else {
|
||||
patch(id, { status: "manual_review", baseRef: ref, retarget: null, branchName: retargetBranchName(t.branchName!, ref), mrUrl: mrUrl(8600000 + Math.floor(Math.random() * 999)) });
|
||||
}
|
||||
});
|
||||
return { ok: true, ref };
|
||||
},
|
||||
regenerateMrPreview: async () => { await wait(400); return { assignees: ["rd.li"], oldMrUrl: null, plan: { ok: true, noop: true, owner: "rd.li", message: "MR 已经在经办人 rd.li 名下,无需重建" } }; },
|
||||
mrSubmitters: async () => ({ candidates: [{ user: "rd.li", roles: ["self", "assignee"], hasToken: true }], defaultUser: "rd.li" }),
|
||||
featureMrSubmitters: async () => {
|
||||
await wait(300);
|
||||
return {
|
||||
candidates: [{ user: "liuxiangyu.jason", roles: ["creator", "watcher"], hasToken: false }, { user: "rd.li", roles: ["self"], hasToken: true }],
|
||||
defaultUser: "rd.li",
|
||||
meegoUrls: ["https://meego.larkoffice.com/tiktok/story/detail/7382040553"],
|
||||
};
|
||||
},
|
||||
submitMrFeature: async (id: string, _repoKey?: string, asUser?: string, choice?: unknown) => {
|
||||
console.log("[demo] submitMrFeature", JSON.stringify({ id, asUser, choice }));
|
||||
await wait(1500);
|
||||
const url = mrUrl(8700000 + Math.floor(Math.random() * 999));
|
||||
patch(id, { mrUrl: url, failureReason: null });
|
||||
return { ok: true, mrUrl: url, bitsUser: asUser };
|
||||
},
|
||||
submitMr: async (id: string) => { await wait(800); const url = mrUrl(8700000 + Math.floor(Math.random() * 999)); patch(id, { mrUrl: url, mrState: "opened", failureReason: null }); return { ok: true, mrUrl: url }; },
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const [, force] = useState(0);
|
||||
render = () => force((n) => n + 1);
|
||||
const [openId, setOpenId] = useState<string | null>(null);
|
||||
const open = openId ? items.get(openId) ?? null : null;
|
||||
return (
|
||||
<div className="op-demo">
|
||||
<h1>MR 操作弹窗 · 重做到 alpha · 演示</h1>
|
||||
<p className="op-sub">点卡片打开抽屉,看「人工复核」那块:MR 行只剩打开 / 提交,下面一个「MR 操作」。抽屉是真组件、数据是假的,其它接口连不上(下半部分会空着)。刷新页面重置。</p>
|
||||
<div className="op-cards">
|
||||
{SCENARIOS.map((s) => {
|
||||
const it = items.get(s.item.id)! as Task;
|
||||
return (
|
||||
<div key={s.item.id} className="op-case">
|
||||
<div className="op-note">{s.note}</div>
|
||||
<TaskCard item={it as BoardItem} onOpen={() => setOpenId(it.id)} />
|
||||
<div className="op-mr">基线 {it.baseRef || "develop"} · MR {it.mrUrl?.replace(/.*\//, "") ?? "无"} · {it.status}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<TaskDetailDrawer item={open} onClose={() => setOpenId(null)} />
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.op-demo { padding: 24px 32px 64px; max-width: 1120px; color: var(--text); }
|
||||
.op-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.op-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
|
||||
.op-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
|
||||
.op-case { display: flex; flex-direction: column; gap: 8px; }
|
||||
.op-note { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 54px; }
|
||||
.op-mr { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,146 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api, type RegenerateMrPreview, type RegenerateMrResult } from "../lib/api";
|
||||
import type { BoardItem, Task } from "../types";
|
||||
import TaskCard from "../components/TaskCard";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:抽屉里「按经办人重建 MR」按钮。抽屉是真组件,喂假数据;重建的预览 / 执行两个接口
|
||||
* 在这里打桩,按场景回不同结果。抽屉里其它接口都连不上(下半部分会报错或空着),只看 MR 那一块。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-mr-regen.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const mrUrl = (id: number) => `https://bits.bytedance.net/devops/1500037378/code/detail/${id}`;
|
||||
const base = {
|
||||
kind: "bug" as const, platform: "android", priorityKey: 1, pinned: 0, createdAt: now - 26 * 3_600_000,
|
||||
statusChangedAt: now - 40 * 60_000, clusters: [], tags: [], watchers: ["qa.zhang@bytedance.com"],
|
||||
watcherLabels: { "qa.zhang@bytedance.com": "张测试" },
|
||||
mrState: "opened", mergedIntoBaseAt: null, baseRef: null, repoKey: null,
|
||||
createdViaKeyId: null, createdViaSource: null, createdViaLabel: null, createdViaOwner: null, externalId: null,
|
||||
description: "增量 bug:Meego 视图自动导入。", executionPlan: null, reproSteps: null, remark: null, reviewHistory: [],
|
||||
attempts: 1, executorNodeId: "fei-android-01", branchName: "bugfix/streamline-demo",
|
||||
workspacePath: "/tmp/demo", beforeEvidencePath: null, afterEvidencePath: null, failureReason: null,
|
||||
};
|
||||
|
||||
interface Scenario {
|
||||
note: string;
|
||||
item: BoardItem;
|
||||
preview: RegenerateMrPreview;
|
||||
/** 执行结果;抛错用 string。 */
|
||||
result?: RegenerateMrResult | string;
|
||||
}
|
||||
|
||||
const mk = (over: Record<string, unknown>): BoardItem => ({ ...base, ...over } as unknown as BoardItem);
|
||||
|
||||
const SCENARIOS: Scenario[] = [
|
||||
{
|
||||
note: "① 典型场景:MR 建在 QA 名下,经办人后来改成 RD(已绑 Token)。确认后关旧建新,抽屉里的 MR 链接会换成新的",
|
||||
item: mk({ id: "s1", status: "manual_review", title: "【Android】评论区 @昵称不高亮", meegoId: "6931201188",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931201188", mrUrl: mrUrl(8494580) }),
|
||||
preview: { assignees: ["rd.li"], oldMrUrl: mrUrl(8494580),
|
||||
plan: { ok: true, noop: false, candidates: ["rd.li"], closeMrId: 8494580, currentAuthor: "qa.zhang" } },
|
||||
result: { ok: true, closedMrUrl: mrUrl(8494580), mrUrl: mrUrl(8501234), owner: "rd.li" },
|
||||
},
|
||||
{
|
||||
note: "② 已修复(MR 待合入)也能点;两位经办人,第一位没绑 Token,只在第二位名下建",
|
||||
item: mk({ id: "s2", status: "fix_succeeded", title: "【iOS】个人页头像预览缩放后无法关闭", platform: "ios", meegoId: "6931177420",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931177420", mrUrl: mrUrl(8490011) }),
|
||||
preview: { assignees: ["rd.wang", "rd.zhao"], oldMrUrl: mrUrl(8490011),
|
||||
plan: { ok: true, noop: false, candidates: ["rd.zhao"], closeMrId: 8490011, currentAuthor: "temp.chen" } },
|
||||
result: { ok: true, closedMrUrl: mrUrl(8490011), mrUrl: mrUrl(8502222), owner: "rd.zhao" },
|
||||
},
|
||||
{
|
||||
note: "③ MR 已经在经办人名下:不弹确认,直接提示无需重建",
|
||||
item: mk({ id: "s3", status: "manual_review", title: "【Android】故事发布失败没有提示", meegoId: "6931196005",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931196005", mrUrl: mrUrl(8493333) }),
|
||||
preview: { assignees: ["rd.li"], oldMrUrl: mrUrl(8493333),
|
||||
plan: { ok: true, noop: true, owner: "rd.li", message: "MR 已经在经办人 rd.li 名下,无需重建" } },
|
||||
},
|
||||
{
|
||||
note: "④ 新经办人没绑 Bits Token:直接拦下,旧 MR 不动",
|
||||
item: mk({ id: "s4", status: "manual_review", title: "【Android】草稿箱封面加载慢", meegoId: "6931200001",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931200001", mrUrl: mrUrl(8494444) }),
|
||||
preview: { assignees: ["rd.sun"], oldMrUrl: mrUrl(8494444),
|
||||
plan: { ok: false, code: "no_token", message: "经办人 rd.sun 都没有绑定 Bits 个人 Token,MR 建不到他们名下;请经办人先在 Streamline 头像菜单绑定 Token 再来点。当前 MR 未做任何改动" } },
|
||||
},
|
||||
{
|
||||
note: "⑤ 确认之后关旧 MR 失败(没人有权限):报错,单子不动",
|
||||
item: mk({ id: "s5", status: "manual_review", title: "【Android】直播间礼物面板偶现空白", meegoId: "6931200002",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931200002", mrUrl: mrUrl(8495555) }),
|
||||
preview: { assignees: ["rd.li"], oldMrUrl: mrUrl(8495555),
|
||||
plan: { ok: true, noop: false, candidates: ["rd.li"], closeMrId: 8495555, currentAuthor: "qa.zhang" } },
|
||||
result: "关闭旧 MR 8495555 失败,未做任何改动:you: no permission; qa.zhang: no permission; rd.li: no permission",
|
||||
},
|
||||
{
|
||||
note: "⑥ 对照:MR 已合入 —— 不出现按钮",
|
||||
item: mk({ id: "s6", status: "fix_succeeded", title: "【Android】关注页「更多」按钮点击无响应", meegoId: "6931200003",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931200003", mrUrl: mrUrl(8496666), mrState: "merged" }),
|
||||
preview: { assignees: [], oldMrUrl: null, plan: { ok: false, code: "merged", message: "" } },
|
||||
},
|
||||
];
|
||||
|
||||
const byId = new Map(SCENARIOS.map((s) => [s.item.id, s]));
|
||||
let setItems: (fn: (m: Map<string, BoardItem>) => Map<string, BoardItem>) => void = () => {};
|
||||
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
Object.assign(api, {
|
||||
regenerateMrPreview: async (id: string) => { await wait(500); return byId.get(id)!.preview; },
|
||||
regenerateMr: async (id: string) => {
|
||||
await wait(1200);
|
||||
const r = byId.get(id)!.result;
|
||||
if (typeof r === "string" || !r) throw new Error(r || "unknown");
|
||||
if (r.mrUrl) setItems((m) => new Map(m).set(id, { ...m.get(id)!, mrUrl: r.mrUrl } as BoardItem));
|
||||
return r;
|
||||
},
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const [items, _setItems] = useState(() => new Map(SCENARIOS.map((s) => [s.item.id, s.item])));
|
||||
setItems = _setItems;
|
||||
const [openId, setOpenId] = useState<string | null>(null);
|
||||
const open = openId ? items.get(openId) ?? null : null;
|
||||
return (
|
||||
<div className="op-demo">
|
||||
<h1>按 Meego 经办人重建 MR · 演示</h1>
|
||||
<p className="op-sub">点卡片打开抽屉,在「人工复核 / 已修复」那块的 MR 行下面找「按经办人重建 MR」。抽屉是真组件、数据是假的,其它接口连不上,只看 MR 那一块。刷新页面重置。</p>
|
||||
<div className="op-cards">
|
||||
{SCENARIOS.map((s) => {
|
||||
const it = items.get(s.item.id)!;
|
||||
return (
|
||||
<div key={s.item.id} className="op-case">
|
||||
<div className="op-note">{s.note}</div>
|
||||
<TaskCard item={it} onOpen={() => setOpenId(it.id)} />
|
||||
<div className="op-mr">当前 MR:{(it as Task).mrUrl?.replace(/.*\//, "")}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<TaskDetailDrawer item={open} onClose={() => setOpenId(null)} />
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.op-demo { padding: 24px 32px 64px; max-width: 1120px; color: var(--text); }
|
||||
.op-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.op-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
|
||||
.op-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
|
||||
.op-case { display: flex; flex-direction: column; gap: 8px; }
|
||||
.op-note { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 54px; }
|
||||
.op-mr { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,168 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api, type MrSubmittersPreview, type SubmitMrResult } from "../lib/api";
|
||||
import type { BoardItem, Task } from "../types";
|
||||
import TaskCard from "../components/TaskCard";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:Bug 抽屉里点「提交 MR」先弹「以谁的名义提交 MR」。抽屉是真组件,喂假数据;候选人和提交
|
||||
* 两个接口在这里打桩,按场景回不同结果。抽屉里其它接口都连不上,只看 MR 那一块。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-mr-submit-as.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const mrUrl = (id: number) => `https://bits.bytedance.net/devops/1500037378/code/detail/${id}`;
|
||||
const base = {
|
||||
kind: "bug" as const, platform: "android", priorityKey: 1, pinned: 0, createdAt: now - 26 * 3_600_000,
|
||||
statusChangedAt: now - 40 * 60_000, clusters: [], tags: [], status: "manual_review", mrUrl: null,
|
||||
watcherLabels: {}, mrState: null, mergedIntoBaseAt: null, baseRef: null, repoKey: null,
|
||||
createdViaKeyId: null, createdViaSource: null, createdViaLabel: null, createdViaOwner: null, externalId: null,
|
||||
description: "Meego 导入。", executionPlan: null, reproSteps: null, remark: null, reviewHistory: [],
|
||||
attempts: 1, executorNodeId: "fei-android-01", branchName: "bugfix/streamline-demo",
|
||||
workspacePath: "/tmp/demo", beforeEvidencePath: null, afterEvidencePath: null, failureReason: null,
|
||||
};
|
||||
|
||||
interface Scenario {
|
||||
note: string;
|
||||
item: BoardItem;
|
||||
preview: MrSubmittersPreview;
|
||||
/** 提交结果按选中的人给;抛错用 string。 */
|
||||
result: (asUser: string | undefined) => SubmitMrResult | string;
|
||||
}
|
||||
|
||||
const mk = (over: Record<string, unknown>): BoardItem => ({ ...base, ...over } as unknown as BoardItem);
|
||||
const ok = (who: string, id: number): SubmitMrResult => ({ ok: true, mrUrl: mrUrl(id), bitsUser: who });
|
||||
|
||||
const SCENARIOS: Scenario[] = [
|
||||
{
|
||||
note: "① 就是 81c7b38b 那张单的形状:经办人 jinchaoshuai 不在关注人里,关注人三位(含我)。默认选经办人",
|
||||
item: mk({ id: "s1", title: "【Android】play_time 缺少PhotoParam部分key", meegoId: "7322667510",
|
||||
watchers: ["jingyuan.yi@bytedance.com", "yangqifan.harry@bytedance.com", "huayipeng@bytedance.com"] }),
|
||||
preview: { defaultUser: "jinchaoshuai", candidates: [
|
||||
{ user: "jinchaoshuai", roles: ["assignee"], hasToken: true },
|
||||
{ user: "jingyuan.yi", roles: ["watcher", "self"], hasToken: true },
|
||||
{ user: "yangqifan.harry", roles: ["watcher"], hasToken: true },
|
||||
{ user: "huayipeng", roles: ["watcher"], hasToken: false },
|
||||
] },
|
||||
result: (who) => ok(who || "jingyuan.yi", 8510001),
|
||||
},
|
||||
{
|
||||
note: "② 经办人没绑 Token:那一行置灰写原因,默认退到我自己",
|
||||
item: mk({ id: "s2", title: "【iOS】个人页头像预览缩放后无法关闭", platform: "ios", meegoId: "6931177420",
|
||||
watchers: ["jingyuan.yi@bytedance.com", "qa.zhang@bytedance.com"] }),
|
||||
preview: { defaultUser: "jingyuan.yi", candidates: [
|
||||
{ user: "rd.wang", roles: ["assignee"], hasToken: false },
|
||||
{ user: "jingyuan.yi", roles: ["watcher", "self"], hasToken: true },
|
||||
{ user: "qa.zhang", roles: ["watcher"], hasToken: true },
|
||||
] },
|
||||
result: (who) => ok(who || "jingyuan.yi", 8510002),
|
||||
},
|
||||
{
|
||||
note: "③ 选的人 Token 失效 / 没仓库权限:报错,单子不动(这里任何人都会失败)",
|
||||
item: mk({ id: "s3", title: "【Android】故事发布失败没有提示", meegoId: "6931196005",
|
||||
watchers: ["rd.li@bytedance.com", "jingyuan.yi@bytedance.com"] }),
|
||||
preview: { defaultUser: "rd.li", candidates: [
|
||||
{ user: "rd.li", roles: ["assignee", "watcher"], hasToken: true },
|
||||
{ user: "jingyuan.yi", roles: ["watcher", "self"], hasToken: true },
|
||||
] },
|
||||
result: (who) => `create_mr: as ${who}: 403 no permission on repo tiktok_android`,
|
||||
},
|
||||
{
|
||||
note: "④ 对照:单上只有我(没有经办人 / 其他关注人)—— 不弹窗,直接以我的名义提交",
|
||||
item: mk({ id: "s4", title: "【Android】草稿箱封面加载慢", meegoId: null, watchers: ["jingyuan.yi@bytedance.com"] }),
|
||||
preview: { defaultUser: "jingyuan.yi", candidates: [{ user: "jingyuan.yi", roles: ["watcher", "self"], hasToken: true }] },
|
||||
result: () => ok("jingyuan.yi", 8510004),
|
||||
},
|
||||
{
|
||||
note: "⑤ 单上谁都没绑 Token(包括我):提示先绑定,并打开我的绑定框",
|
||||
item: mk({ id: "s5", title: "【Android】直播间礼物面板偶现空白", meegoId: "6931200002",
|
||||
watchers: ["jingyuan.yi@bytedance.com"] }),
|
||||
preview: { defaultUser: null, candidates: [
|
||||
{ user: "rd.sun", roles: ["assignee"], hasToken: false },
|
||||
{ user: "jingyuan.yi", roles: ["watcher", "self"], hasToken: false },
|
||||
] },
|
||||
result: () => "unreachable",
|
||||
},
|
||||
{
|
||||
note: "⑥ Feature:没有 Meego 经办人,建单人排第一、默认选他;其余是关注人和我",
|
||||
item: mk({ id: "s6", kind: "feature", title: "【Android】评论区支持发送 GIF", meegoId: null,
|
||||
watchers: ["pm.wu@bytedance.com", "rd.li@bytedance.com", "jingyuan.yi@bytedance.com"] }),
|
||||
preview: { defaultUser: "pm.wu", candidates: [
|
||||
{ user: "pm.wu", roles: ["creator", "watcher"], hasToken: true },
|
||||
{ user: "rd.li", roles: ["watcher"], hasToken: true },
|
||||
{ user: "jingyuan.yi", roles: ["watcher", "self"], hasToken: true },
|
||||
] },
|
||||
result: (who) => ok(who || "jingyuan.yi", 8510006),
|
||||
},
|
||||
];
|
||||
|
||||
const byId = new Map(SCENARIOS.map((s) => [s.item.id, s]));
|
||||
let setItems: (fn: (m: Map<string, BoardItem>) => Map<string, BoardItem>) => void = () => {};
|
||||
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
const submitters = async (id: string) => { await wait(400); return byId.get(id)!.preview; };
|
||||
const submit = async (id: string, _repoKey?: string, asUser?: string) => {
|
||||
await wait(1000);
|
||||
const r = byId.get(id)!.result(asUser);
|
||||
if (typeof r === "string") throw new Error(r);
|
||||
if (r.mrUrl) setItems((m) => new Map(m).set(id, { ...m.get(id)!, mrUrl: r.mrUrl } as BoardItem));
|
||||
lastAuthor.set(id, r.bitsUser || "?");
|
||||
return r;
|
||||
};
|
||||
Object.assign(api, {
|
||||
me: async () => ({ email: "jingyuan.yi@bytedance.com", hasBitsToken: true }),
|
||||
mrSubmitters: submitters, featureMrSubmitters: submitters,
|
||||
submitMr: submit, submitMrFeature: submit,
|
||||
});
|
||||
const lastAuthor = new Map<string, string>();
|
||||
|
||||
function Demo() {
|
||||
const [items, _setItems] = useState(() => new Map(SCENARIOS.map((s) => [s.item.id, s.item])));
|
||||
setItems = _setItems;
|
||||
const [openId, setOpenId] = useState<string | null>(null);
|
||||
const open = openId ? items.get(openId) ?? null : null;
|
||||
return (
|
||||
<div className="op-demo">
|
||||
<h1>以谁的名义提交 MR · 演示</h1>
|
||||
<p className="op-sub">点卡片打开抽屉,在「人工复核」那块点 MR 行的「提交 MR」(Bug 和 Feature 都有)。抽屉是真组件、数据是假的,其它接口连不上,只看 MR 那一块。当前登录人假定是 jingyuan.yi。刷新页面重置。</p>
|
||||
<div className="op-cards">
|
||||
{SCENARIOS.map((s) => {
|
||||
const it = items.get(s.item.id)!;
|
||||
const url = (it as Task).mrUrl;
|
||||
return (
|
||||
<div key={s.item.id} className="op-case">
|
||||
<div className="op-note">{s.note}</div>
|
||||
<TaskCard item={it} onOpen={() => setOpenId(it.id)} />
|
||||
<div className="op-mr">{url ? `MR ${url.replace(/.*\//, "")} · 作者 ${lastAuthor.get(it.id)}` : "还没有 MR"}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<TaskDetailDrawer item={open} onClose={() => setOpenId(null)} />
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.op-demo { padding: 24px 32px 64px; max-width: 1120px; color: var(--text); }
|
||||
.op-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.op-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
|
||||
.op-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
|
||||
.op-case { display: flex; flex-direction: column; gap: 8px; }
|
||||
.op-note { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 54px; }
|
||||
.op-mr { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,88 @@
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api, type OpenApiUsageStats } from "../lib/api";
|
||||
import OpenPlatformUsagePanel from "../components/OpenPlatformUsagePanel";
|
||||
|
||||
/**
|
||||
* 本地演示:管理台「开放平台 → 使用情况」。不连任何接口 —— api.openApiUsage 换成按窗口生成的假数据
|
||||
* (Skill 从窗口中段才开始有人用,模拟刚上线后爬坡)。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-openapi-usage.html。`?empty=1` 看刚上线还没有调用的样子,`?dark=1` 看深色。
|
||||
*/
|
||||
const q = new URLSearchParams(location.search);
|
||||
const empty = q.has("empty");
|
||||
if (q.has("dark")) document.documentElement.dataset.theme = "dark";
|
||||
|
||||
const DAY = 86_400_000;
|
||||
const now = Date.now();
|
||||
const bj = (ms: number) => new Date(ms + 8 * 3_600_000).toISOString().slice(0, 10);
|
||||
// 固定种子,刷新不跳。
|
||||
let seed = 7;
|
||||
const rnd = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
|
||||
|
||||
function fake(days: number): OpenApiUsageStats {
|
||||
seed = 7 + days;
|
||||
const daily = Array.from({ length: days }, (_, k) => {
|
||||
const i = days - 1 - k, t = now - i * DAY, dow = new Date(t).getUTCDay(), weekend = dow === 0 || dow === 6;
|
||||
const ramp = Math.max(0, 1 - i / Math.min(days, 21)); // 越近越多
|
||||
const web = empty ? Math.round((weekend ? 3 : 14) * (0.7 + rnd() * 0.6)) : Math.round((weekend ? 3 : 14) * (0.7 + rnd() * 0.6));
|
||||
const openapi = empty ? 0 : Math.round((weekend ? 0.3 : 2.2) * rnd() * 1.6);
|
||||
const cli = empty ? 0 : Math.round((weekend ? 0.5 : 5) * ramp * (0.5 + rnd()));
|
||||
return { date: bj(t), web, openapi, cli, calls: empty ? 0 : (openapi + cli) * 6 + Math.round(rnd() * 10), activeActors: empty ? 0 : Math.min(9, openapi + Math.ceil(cli * 0.8)) };
|
||||
});
|
||||
const sum = (k: "web" | "openapi" | "cli") => daily.reduce((a, d) => a + d[k], 0);
|
||||
const tasks = { web: sum("web"), openapi: sum("openapi"), cli: sum("cli"), total: 0 };
|
||||
tasks.total = tasks.web + tasks.openapi + tasks.cli;
|
||||
const calls = daily.reduce((a, d) => a + d.calls, 0);
|
||||
return {
|
||||
days, from: now - days * DAY, to: now,
|
||||
summary: {
|
||||
tasks, nonWebShare: tasks.total ? (tasks.openapi + tasks.cli) / tasks.total : null, prevNonWebShare: empty ? 0 : 0.06,
|
||||
calls: { total: calls, openapi: Math.round(calls * 0.3), cli: calls - Math.round(calls * 0.3), errors: Math.round(calls * 0.03) },
|
||||
activeKeys: empty ? 0 : 3, totalKeys: 5, activeCliUsers: empty ? 0 : 14, authorizedCliUsers: empty ? 1 : 21, newCliUsers: empty ? 1 : 9,
|
||||
},
|
||||
daily,
|
||||
actors: empty ? [] : [
|
||||
{ channel: "cli", id: "zhangsan@bytedance.com", name: "zhangsan", owner: "zhangsan@bytedance.com", calls: 86, errors: 2, tasks: 11, executes: 7, lastAt: now - 40 * 60_000, agents: ["claude-code"] },
|
||||
{ channel: "openapi", id: "opk_1", name: "Meego 工单同步", owner: "jiuyu.zhou@bytedance.com", calls: 240, errors: 9, tasks: Math.round(tasks.openapi * 0.7), executes: 18, lastAt: now - 2 * 3_600_000, agents: [] },
|
||||
{ channel: "cli", id: "lisi@bytedance.com", name: "lisi", owner: "lisi@bytedance.com", calls: 41, errors: 0, tasks: 6, executes: 2, lastAt: now - 5 * 3_600_000, agents: ["cursor"] },
|
||||
{ channel: "cli", id: "wangwu@bytedance.com", name: "wangwu", owner: "wangwu@bytedance.com", calls: 22, errors: 4, tasks: 3, executes: 0, lastAt: now - 26 * 3_600_000, agents: ["codex", "terminal"] },
|
||||
{ channel: "openapi", id: "opk_2", name: "Spoton", owner: "me@bytedance.com", calls: 57, errors: 1, tasks: Math.round(tasks.openapi * 0.3), executes: 0, lastAt: now - 3 * DAY, agents: [] },
|
||||
],
|
||||
routes: empty ? [] : [
|
||||
{ channel: "cli", route: "GET /cli/v1/tasks/:taskId", calls: 310, errors: 3 },
|
||||
{ channel: "openapi", route: "POST /openapi/v1/meego-import", calls: 196, errors: 7 },
|
||||
{ channel: "cli", route: "POST /cli/v1/meego-import", calls: 88, errors: 2 },
|
||||
{ channel: "cli", route: "POST /cli/v1/tasks", calls: 64, errors: 1 },
|
||||
{ channel: "cli", route: "POST /cli/v1/handoff", calls: 19, errors: 1 },
|
||||
{ channel: "cli", route: "POST /cli/v1/tasks/:taskId/execute", calls: 31, errors: 9 },
|
||||
{ channel: "openapi", route: "GET /openapi/v1/tasks/:taskId", calls: 22, errors: 0 },
|
||||
{ channel: "openapi", route: "POST /openapi/v1/features", calls: 9, errors: 0 },
|
||||
],
|
||||
agents: empty ? [] : [
|
||||
{ agent: "claude-code", users: 9, calls: 402 }, { agent: "cursor", users: 4, calls: 121 }, { agent: "codex", users: 2, calls: 37 }, { agent: "terminal", users: 3, calls: 12 },
|
||||
],
|
||||
outcomes: [
|
||||
{ channel: "web" as const, total: tasks.web, evaluating: Math.round(tasks.web * 0.18), running: Math.round(tasks.web * 0.08), fixed: Math.round(tasks.web * 0.42), notFixed: Math.round(tasks.web * 0.2), closed: 0 },
|
||||
{ channel: "openapi" as const, total: tasks.openapi, evaluating: Math.round(tasks.openapi * 0.55), running: Math.round(tasks.openapi * 0.05), fixed: Math.round(tasks.openapi * 0.25), notFixed: Math.round(tasks.openapi * 0.1), closed: 0 },
|
||||
{ channel: "cli" as const, total: tasks.cli, evaluating: Math.round(tasks.cli * 0.3), running: Math.round(tasks.cli * 0.15), fixed: Math.round(tasks.cli * 0.35), notFixed: Math.round(tasks.cli * 0.15), closed: 0 },
|
||||
{ channel: "handoff" as const, total: Math.round(tasks.cli * 0.4), evaluating: Math.round(tasks.cli * 0.08), running: Math.round(tasks.cli * 0.06), fixed: Math.round(tasks.cli * 0.2), notFixed: Math.round(tasks.cli * 0.04), closed: 0 },
|
||||
].map((o) => ({ ...o, closed: Math.max(0, o.total - o.evaluating - o.running - o.fixed - o.notFixed) })),
|
||||
integrations: { webhooks: empty ? 0 : 2, larkBots: empty ? 0 : 1 },
|
||||
};
|
||||
}
|
||||
|
||||
(api as { openApiUsage: (days: number) => Promise<OpenApiUsageStats> }).openApiUsage = async (days) => {
|
||||
await new Promise((r) => setTimeout(r, 250));
|
||||
return fake(days);
|
||||
};
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
// 应用的全局样式关掉了 body 滚动(真实页面由各自的面板容器滚),演示页自己给一个滚动容器。
|
||||
<div style={{ height: "100vh", overflow: "auto" }}>
|
||||
<div style={{ maxWidth: 980, margin: "24px auto", padding: "0 16px" }}>
|
||||
<OpenPlatformUsagePanel />
|
||||
</div>
|
||||
</div>,
|
||||
);
|
||||
@@ -0,0 +1,110 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api, type LarkBotKeyOption, type OpenPlatformKeyRequest, type OpenPlatformLarkBot } from "../lib/api";
|
||||
import OpenPlatformRequestModal from "../components/OpenPlatformRequestModal";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:头像菜单 →「开放平台 API」弹窗,含「飞书机器人」登记区。不连任何接口 ——
|
||||
* 弹窗用到的 api 方法全换成内存里的假数据,登记 / 申请 / 停用 / 删除都只改这份数据。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-openapi.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
* `?empty=1` 看还没申请过任何 Key 的样子。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const empty = new URLSearchParams(location.search).has("empty");
|
||||
|
||||
let requests: OpenPlatformKeyRequest[] = empty ? [] : [
|
||||
{
|
||||
id: "opr_1", label: "Spoton", source: "spoton", reason: "话题群里 @ 机器人报 bug", requestedBy: "me@bytedance.com", requestedAt: now - 5 * 86_400_000,
|
||||
status: "approved", reviewedBy: "admin@bytedance.com", reviewedAt: now - 4 * 86_400_000, rejectReason: null,
|
||||
keyId: "opk_1", pickedUpAt: now - 4 * 86_400_000, hasSecretToPickup: false,
|
||||
larkBots: [{ id: "lkb_1a2b3c4d5e6f", name: "Spoton 助手", appId: "cli_a1b2c3d4e5f6a7b8" }],
|
||||
},
|
||||
{
|
||||
id: "opr_2", label: "Spoton 海外", source: "spoton-sg", reason: null, requestedBy: "me@bytedance.com", requestedAt: now - 3_600_000,
|
||||
status: "pending", reviewedBy: null, reviewedAt: null, rejectReason: null, keyId: null, pickedUpAt: null, hasSecretToPickup: false,
|
||||
larkBots: [],
|
||||
},
|
||||
];
|
||||
const keys = (): LarkBotKeyOption[] => empty ? [] : [
|
||||
{ id: "opk_1", label: "Spoton", pending: false },
|
||||
...requests.filter((r) => r.status === "pending").map((r) => ({ id: `req:${r.id}`, label: r.label, pending: true })),
|
||||
];
|
||||
let bots: OpenPlatformLarkBot[] = empty ? [] : [
|
||||
{
|
||||
id: "lkb_1a2b3c4d5e6f", keyId: "opk_1", appId: "cli_a1b2c3d4e5f6a7b8", domain: "feishu", name: "Spoton 助手", avatarUrl: null,
|
||||
createdBy: "me@bytedance.com", createdAt: now - 4 * 86_400_000, disabledAt: null, disabledReason: null,
|
||||
consecutiveFailures: 0, lastSuccessAt: now - 20 * 60_000, lastFailureAt: null, lastError: null,
|
||||
},
|
||||
{
|
||||
id: "lkb_9f8e7d6c5b4a", keyId: "opk_1", appId: "cli_b9c8d7e6f5a4b3c2", domain: "lark", name: "Spoton Global", avatarUrl: null,
|
||||
createdBy: "me@bytedance.com", createdAt: now - 86_400_000, disabledAt: now - 3_600_000, disabledReason: "连续 10 次发送失败,自动停用",
|
||||
consecutiveFailures: 10, lastSuccessAt: null, lastFailureAt: now - 3_600_000, lastError: "机器人不在被回复消息所在的群里,请把机器人拉进群",
|
||||
},
|
||||
];
|
||||
|
||||
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
const verify = async (appSecret: string) => {
|
||||
await sleep(600);
|
||||
if (appSecret.length < 16) throw new Error("App ID / App Secret 校验失败(飞书返回 10014:app secret invalid)");
|
||||
};
|
||||
const newBot = (keyId: string, appId: string, domain: string): OpenPlatformLarkBot => ({
|
||||
id: `lkb_${Math.random().toString(16).slice(2, 14)}`, keyId, appId, domain, name: `新机器人 ${appId.slice(-4)}`, avatarUrl: null,
|
||||
createdBy: "me@bytedance.com", createdAt: Date.now(), disabledAt: null, disabledReason: null, consecutiveFailures: 0,
|
||||
lastSuccessAt: null, lastFailureAt: null, lastError: null,
|
||||
});
|
||||
|
||||
Object.assign(api, {
|
||||
myOpenPlatformKeyRequests: async () => ({ requests }),
|
||||
requestOpenPlatformKey: async (label: string, source: string, reason: string | null, larkBot: { appId: string; appSecret: string; domain: string } | null) => {
|
||||
if (larkBot) await verify(larkBot.appSecret);
|
||||
const r: OpenPlatformKeyRequest = {
|
||||
id: `opr_${requests.length + 1}`, label, source, reason, requestedBy: "me@bytedance.com", requestedAt: Date.now(), status: "pending",
|
||||
reviewedBy: null, reviewedAt: null, rejectReason: null, keyId: null, pickedUpAt: null, hasSecretToPickup: false, larkBots: [],
|
||||
};
|
||||
if (larkBot) {
|
||||
const b = newBot(`req:${r.id}`, larkBot.appId, larkBot.domain);
|
||||
bots = [b, ...bots];
|
||||
r.larkBots = [{ id: b.id, name: b.name, appId: b.appId }];
|
||||
}
|
||||
requests = [r, ...requests];
|
||||
return { request: r };
|
||||
},
|
||||
pickupOpenPlatformKeyRequest: async () => ({ secret: "sk-sl-demo" }),
|
||||
myLarkBots: async () => ({ keys: keys(), bots }),
|
||||
createLarkBot: async (input: { keyId: string; appId: string; appSecret: string; domain: string }) => {
|
||||
await verify(input.appSecret);
|
||||
const b = newBot(input.keyId, input.appId, input.domain);
|
||||
bots = [b, ...bots];
|
||||
return b;
|
||||
},
|
||||
setLarkBotEnabled: async (id: string, enabled: boolean) => {
|
||||
bots = bots.map((b) => b.id !== id ? b : { ...b, disabledAt: enabled ? null : Date.now(), disabledReason: enabled ? null : "手动停用(me@bytedance.com)", consecutiveFailures: enabled ? 0 : b.consecutiveFailures });
|
||||
return bots.find((b) => b.id === id)!;
|
||||
},
|
||||
updateLarkBotSecret: async (id: string, secret: string) => {
|
||||
await verify(secret);
|
||||
bots = bots.map((b) => b.id !== id ? b : { ...b, disabledAt: null, disabledReason: null, consecutiveFailures: 0, lastError: null });
|
||||
return bots.find((b) => b.id === id)!;
|
||||
},
|
||||
deleteLarkBot: async (id: string) => { bots = bots.filter((b) => b.id !== id); return { ok: true }; },
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const [open, setOpen] = useState(true);
|
||||
return (
|
||||
<div style={{ padding: 24 }}>
|
||||
<button className="primary" onClick={() => setOpen(true)}>打开「开放平台 API」弹窗</button>
|
||||
{open && <OpenPlatformRequestModal onClose={() => setOpen(false)} />}
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,156 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import type { BoardItem, Task } from "../types";
|
||||
import TaskCard from "../components/TaskCard";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:开放平台建的单在看板卡片 / 抽屉 / 飞书卡片上怎么标来源。不连任何接口 ——
|
||||
* 卡片和抽屉是真组件,喂的是假数据;飞书卡片是照 notify_cards.ts 的版式画的静态示意
|
||||
* (真卡片 JSON 用 `bun scripts/preview-notify-cards.ts bug:dispatched:openplatform` 看)。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-openplatform-source.html。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const base = {
|
||||
kind: "bug" as const, platform: "android", priorityKey: 1, pinned: 0, createdAt: now - 3 * 3_600_000,
|
||||
statusChangedAt: now - 12 * 60_000, clusters: [], tags: [], watchers: ["qifan.zhang@bytedance.com", "jiaopengwen@bytedance.com"],
|
||||
watcherLabels: { "qifan.zhang@bytedance.com": "张齐帆", "jiaopengwen@bytedance.com": "焦鹏文" },
|
||||
mrState: null, mergedIntoBaseAt: null, baseRef: null, meegoId: null, meegoUrl: null,
|
||||
createdViaKeyId: null, createdViaSource: null, createdViaLabel: null, createdViaOwner: null, externalId: null,
|
||||
description: "复现步骤见外部工单。", executionPlan: null, reproSteps: null, remark: null, reviewHistory: [],
|
||||
attempts: 1, executorNodeId: "fei-android-01",
|
||||
};
|
||||
|
||||
const mk = (over: Partial<Task> & { id: string; title: string; status: string }): BoardItem =>
|
||||
({ ...base, ...over } as unknown as BoardItem);
|
||||
|
||||
const CASES: { note: string; item: BoardItem; stage?: "running" | "queued" | "evaluating" }[] = [
|
||||
{
|
||||
note: "通用建单接口建的:没有 Meego 号,右上角显示对方单号;标签「开放平台 │ 申请人」,悬停看 Key 名字和来源标签",
|
||||
stage: "running",
|
||||
item: mk({
|
||||
id: "a1f3c9e2-0000-4000-8000-000000000001", status: "fixing", platform: "ios",
|
||||
title: "登录页在 iPad 横屏下「继续」按钮被裁切",
|
||||
createdViaKeyId: "opk_1", createdViaSource: "meego", createdViaLabel: "根据meego bug ticket自动创建streamline auto fix", createdViaOwner: "Yifan Jiang", externalId: "CRM-10293",
|
||||
} as never),
|
||||
},
|
||||
{
|
||||
note: "Meego 导入接口建的:右上角照旧是 Meego 号;申请人没缓存过飞书姓名时显示邮箱前缀",
|
||||
stage: "queued",
|
||||
item: mk({
|
||||
id: "b2e4d0f3-0000-4000-8000-000000000002", status: "awaiting_fix",
|
||||
title: "直播间评论区 @ 昵称不高亮",
|
||||
meegoId: "6931196005", meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931196005",
|
||||
createdViaKeyId: "opk_2", createdViaSource: "meego", createdViaLabel: "Meego ticket sync", createdViaOwner: "jiuyu.zhou",
|
||||
} as never),
|
||||
},
|
||||
{
|
||||
note: "同时有导入批次标签:插头 = 哪个外部系统建的,Tag = 哪一批导入的",
|
||||
item: mk({
|
||||
id: "c3f5e1a4-0000-4000-8000-000000000003", status: "manual_review",
|
||||
title: "私信会话列表下拉刷新后头像闪一下",
|
||||
meegoId: "6931201188", meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931201188",
|
||||
tags: ["social_relation"],
|
||||
createdViaKeyId: "opk_3", createdViaSource: "相机Bug", createdViaLabel: "相机", createdViaOwner: "Mou Sun",
|
||||
} as never),
|
||||
},
|
||||
{
|
||||
note: "对照:面板上手动建的单,什么都不多",
|
||||
item: mk({
|
||||
id: "d4a6f2b5-0000-4000-8000-000000000004", status: "manual_review",
|
||||
title: "个人主页关注数在弱网下显示为 0",
|
||||
meegoId: "6931177420", meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6931177420",
|
||||
} as never),
|
||||
},
|
||||
];
|
||||
|
||||
/** 飞书状态卡片的静态示意 —— 只画和这次改动相关的部分(顶部框架行 + 字段区)。 */
|
||||
function LarkCardMock({ withOrigin }: { withOrigin: boolean }) {
|
||||
return (
|
||||
<div className="lk">
|
||||
<div className="lk-head">⚠ 缺陷修复 | 修复中</div>
|
||||
<div className="lk-body">
|
||||
<div className="lk-eyebrow">
|
||||
<span>📱 iOS</span>
|
||||
<span>▦ default · fei-ios-02</span>
|
||||
{withOrigin && <span className="lk-new">↗ 开放平台 · Yifan Jiang</span>}
|
||||
</div>
|
||||
<div className="lk-title">登录页在 iPad 横屏下「继续」按钮被裁切</div>
|
||||
<div className="lk-caption">已派发到节点,正在编译和复现</div>
|
||||
<hr />
|
||||
<div className="lk-grid">
|
||||
{withOrigin
|
||||
? <div className="lk-new"><span className="lk-label">外部单号</span>CRM-10293</div>
|
||||
: <div><span className="lk-label">Meego</span><span className="lk-link">6931177420</span></div>}
|
||||
<div><span className="lk-label">关注人</span><span className="lk-tag">张齐帆</span> <span className="lk-tag">焦鹏文</span></div>
|
||||
</div>
|
||||
<div className="lk-btn">查看实时进度</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Demo() {
|
||||
const [open, setOpen] = useState<BoardItem | null>(null);
|
||||
return (
|
||||
<div className="op-demo">
|
||||
<h1>开放平台来源标识 · 演示</h1>
|
||||
<p className="op-sub">卡片和抽屉用的是真组件。点任意一张卡片可以打开抽屉(抽屉里的接口都连不上,下半部分会报错或空着,只看头部那一块)。</p>
|
||||
|
||||
<h2>1 · 看板卡片(「进行中」「待我处理」「已完成」共用同一个组件)</h2>
|
||||
<div className="op-cards">
|
||||
{CASES.map((c) => (
|
||||
<div key={c.item.id} className="op-case">
|
||||
<div className="op-note">{c.note}</div>
|
||||
<TaskCard item={c.item} onOpen={setOpen} stage={c.stage} queuePos={c.stage === "queued" ? 3 : undefined} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<h2>2 · 飞书状态卡片(私信关注人;接入方机器人回复进话题的也是同一张)</h2>
|
||||
<div className="op-lark">
|
||||
<div><div className="op-note">开放平台建的单(黄色底是新增的两处)</div><LarkCardMock withOrigin /></div>
|
||||
<div><div className="op-note">对照:面板上建的单,没有变化</div><LarkCardMock withOrigin={false} /></div>
|
||||
</div>
|
||||
|
||||
<TaskDetailDrawer item={open} onClose={() => setOpen(null)} />
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.op-demo { padding: 24px 32px 64px; max-width: 1120px; color: var(--text); }
|
||||
.op-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.op-demo h2 { font-size: 15px; margin: 32px 0 12px; }
|
||||
.op-sub { font-size: 13px; color: var(--muted); margin: 0; }
|
||||
.op-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
|
||||
.op-case { display: flex; flex-direction: column; gap: 8px; }
|
||||
.op-note { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 36px; }
|
||||
.op-lark { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
|
||||
.lk { border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid #e4e6eb; font-size: 14px; color: #1f2329; max-width: 420px; }
|
||||
.lk-head { background: #3370ff; color: #fff; padding: 12px 20px; font-weight: 600; }
|
||||
.lk-body { padding: 10px 20px 20px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.lk-eyebrow { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: #8f959e; }
|
||||
.lk-title { font-weight: 600; }
|
||||
.lk-caption { font-size: 12px; color: #8f959e; }
|
||||
.lk hr { border: none; border-top: 1px solid #e4e6eb; margin: 8px 0; width: 100%; }
|
||||
.lk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||
.lk-label { display: block; font-size: 12px; color: #8f959e; }
|
||||
.lk-link { color: #3370ff; }
|
||||
.lk-tag { background: #d5f6f2; color: #078372; border-radius: 4px; padding: 0 4px; font-size: 12px; }
|
||||
.lk-btn { margin-top: 12px; align-self: flex-start; background: #3370ff; color: #fff; border-radius: 6px; padding: 5px 14px; font-size: 13px; }
|
||||
.lk-new { background: #fff6d1; border-radius: 4px; padding: 0 4px; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,147 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import type { BoardItem, Task } from "../types";
|
||||
import type { BatchPulse } from "@bbbug/shared/batch_center";
|
||||
import {
|
||||
QA_FIRST_ACTOR, QA_REOPEN_NOTE_HEAD, DEFAULT_REVIEW_POLICY,
|
||||
type ReviewPolicyConfig, type TaskReviewInfo,
|
||||
} from "@bbbug/shared/review_policy";
|
||||
import TaskCard from "../components/TaskCard";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:「QA 先验收」项目里的任务抽屉(shared/src/review_policy.ts、components/QaPolicyNote.tsx)。
|
||||
* 抽屉是真组件,喂假数据;只打桩了「所在项目」和「复核策略」两个接口,其它接口连不上,抽屉下半部分会空着。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-qa-first-drawer.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
* 项目页(设置、指标、任务清单)在 /demo-batch-watch.html 的 ⑫–⑭。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const QA: ReviewPolicyConfig = { id: "qa_first", maxChangedUnits: 5 };
|
||||
const base = {
|
||||
kind: "bug" as const, platform: "android", priorityKey: 1, pinned: 0, createdAt: now - 26 * 3_600_000,
|
||||
statusChangedAt: now - 40 * 60_000, clusters: [], tags: ["friending_ei_sa"], watchers: ["rd.li@bytedance.com"],
|
||||
watcherLabels: { "rd.li@bytedance.com": "李研发" }, status: "manual_review",
|
||||
mrState: "opened", mergedIntoBaseAt: null, baseRef: null, repoKey: "tiktok-android", retarget: null,
|
||||
createdViaKeyId: null, createdViaSource: null, createdViaLabel: null, createdViaOwner: null, externalId: null,
|
||||
description: "导入自 Friending EI SA 视图。", executionPlan: null, reproSteps: null, remark: null, reviewHistory: [],
|
||||
attempts: 1, executorNodeId: "fei-android-01", branchName: "bugfix/demo", workspacePath: "/tmp/demo",
|
||||
beforeEvidencePath: "/tmp/demo/before.png", afterEvidencePath: "/tmp/demo/after.png", failureReason: null,
|
||||
meegoId: "7388192503", meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/7388192503",
|
||||
mrUrl: "https://bits.bytedance.net/devops/1499114242/code/detail/8500001", meegoState: "OPEN",
|
||||
};
|
||||
const mk = (over: Record<string, unknown>): BoardItem => ({ ...base, ...over } as unknown as BoardItem);
|
||||
|
||||
interface Scenario { note: string; item: BoardItem; info: TaskReviewInfo }
|
||||
const info = (over: Partial<TaskReviewInfo> = {}): TaskReviewInfo => ({ policy: QA, approvedBy: null, unreproToQa: false, route: null, ...over });
|
||||
|
||||
const SCENARIOS: Scenario[] = [
|
||||
{ note: "① 待复核,但改动 8 处、超过上限 5,没直接交 QA:抽屉标题下写明为什么还要你复核。底部「所在项目」名字旁标「QA 先验收」",
|
||||
item: mk({ id: "q1", title: "【Android】私信输入框高度抖动", status: "manual_review" }),
|
||||
info: info({ route: { toQa: false, reason: "too_large", units: 8 } }) },
|
||||
{ note: "② 平台跳过 RD 直接交了 QA,等 QA 验收:状态是「待 QA」,说明写「未经 RD 复核」,RD 合码前要改用右上角「退回复核」。「关注人」里经办人后面多一个虚线的 QA(导入时记下的 Meego 报告人,只读、不收卡片)",
|
||||
item: mk({ id: "q2", title: "【Android】评论区 @昵称不高亮", status: "fix_succeeded", meegoState: "RESOLVED", qaEmail: "larry.guo@bytedance.com" }),
|
||||
info: info({ approvedBy: QA_FIRST_ACTOR }) },
|
||||
{ note: "③ QA 在 Meego 上重开了,还没在单上写原因:说明写了原因平台会读、说清了就自动重修,10 分钟后会提醒",
|
||||
item: mk({ id: "q3", title: "【Android】关注页「更多」无响应", status: "fix_succeeded", meegoState: "REOPENED" }),
|
||||
info: info({ approvedBy: QA_FIRST_ACTOR }) },
|
||||
{ note: "④ 复现不了,平台已置「无法复现」交 QA 判断:标签是「已交 QA 判断」,不是「确认无法复现」",
|
||||
item: mk({ id: "q4", title: "【iOS】首次登录访问 Profile 弹出授权弹窗", platform: "ios", status: "unreproducible", meegoState: "RESOLVED", mrUrl: null, mrState: null }),
|
||||
info: info({ unreproToQa: true }) },
|
||||
{ note: "⑤ 复现不了,QA 能复现、重开了:写了复现方式平台会按它重新修",
|
||||
item: mk({ id: "q5", title: "【iOS】Story 圈好友可见范围不生效", platform: "ios", status: "unreproducible", meegoState: "REOPENED", mrUrl: null, mrState: null }),
|
||||
info: info({ unreproToQa: true }) },
|
||||
{ note: "⑥ QA 写了原因,平台已打回重修:复核历史里这条标「QA @zhangwenyu.666」,悬停是「QA 验收(Meego)」,不是「人工复核」",
|
||||
item: mk({ id: "q6", title: "【Android】上下分屏发布后被裁剪", status: "awaiting_fix", meegoState: "REOPENED", attempts: 1, reviewHistory: [
|
||||
{ at: now - 20 * 60_000, source: "human", round: 1, reviewer: "zhangwenyu.666", text: `${QA_REOPEN_NOTE_HEAD}\n@zhangwenyu.666:\n手机上下分屏场景最后发布的作品还是会被裁剪,横屏正常。` },
|
||||
] }),
|
||||
info: info({ approvedBy: QA_FIRST_ACTOR }) },
|
||||
{ note: "⑧ QA 重开前,单上有人留言在找报告人补操作步骤(11-06 7387934741 的原话):平台读过,判定先不重修,说明里附一句转述,下面有「按这条意见重修」",
|
||||
item: mk({ id: "q8", title: "[Android] Leading&Trailing empty spaces should be trimmed when posting", status: "fix_succeeded", meegoState: "REOPENED" }),
|
||||
info: info({ approvedBy: QA_FIRST_ACTOR, reopenJudge: { state: "wait", kind: "needs_info", summary: "留言在请报告人补全操作步骤和实际结果,验证还没走到,没说修复哪里不对", at: now - 5 * 60_000 } }) },
|
||||
{ note: "⑨ QA 刚重开、单上有留言,平台正在读(几十秒)",
|
||||
item: mk({ id: "q9", title: "【Android】Thought 删除按钮置灰", status: "fix_succeeded", meegoState: "REOPENED" }),
|
||||
info: info({ approvedBy: QA_FIRST_ACTOR, reopenJudge: { state: "judging", at: now } }) },
|
||||
{ note: "⑩ 平台没读懂留言(没有可用节点 / 超时),10 分钟后自动再读,期间不跑;人可以直接点按钮重修",
|
||||
item: mk({ id: "q10", title: "【iOS】群列表头像进他人主页后 Thought 过期", platform: "ios", status: "fix_succeeded", meegoState: "REOPENED" }),
|
||||
info: info({ approvedBy: QA_FIRST_ACTOR, reopenJudge: { state: "failed", at: now - 3 * 60_000 } }) },
|
||||
{ note: "⑪ 增量托管只建记录 · 需求 bug(照 6c9c5560 / Meego 7397497455):标题下写明为什么没跑,带「仍然修复」;点了先确认,确认后状态变成「评估中」、说明行消失",
|
||||
item: mk({ id: "q11", title: "[Android] Your account is private tooltip shows up sometimes", status: "cancelled", meegoState: null, mrUrl: null, mrState: null,
|
||||
executorNodeId: null, branchName: null, attempts: 0, tags: ["social_relation"], watchTag: "social_relation", watchWithdrawn: "record:requirement",
|
||||
watchers: ["annalice.ni@bytedance.com"], watcherLabels: { "annalice.ni@bytedance.com": "Annalice Ni" },
|
||||
failureReason: "增量托管只建记录:关联的是业务 / 技术需求(需求 bug),由需求 RD 跟:业务需求-TT 7346814013" }),
|
||||
info: { policy: DEFAULT_REVIEW_POLICY, approvedBy: null, unreproToQa: false, route: null } },
|
||||
{ note: "⑫ 增量托管只建记录 · 已绑 MR:同样能「仍然修复」,说明里带上绑着的 MR",
|
||||
item: mk({ id: "q12", title: "【Android】关注列表下拉刷新闪一下空白", status: "cancelled", meegoState: null, mrUrl: null, mrState: null,
|
||||
executorNodeId: null, branchName: null, attempts: 0, tags: ["social_relation"], watchTag: "social_relation", watchWithdrawn: "record:mr",
|
||||
failureReason: "增量托管只建记录:工单上已经绑了 MR,有人在修 https://bits.bytedance.net/bytebus/devops/code/detail/8512345" }),
|
||||
info: { policy: DEFAULT_REVIEW_POLICY, approvedBy: null, unreproToQa: false, route: null } },
|
||||
{ note: "⑦ 对照:同样是 ④ 的单,但项目用默认的 RD 复核——还是「确认无法复现」,没有说明行,「所在项目」不标策略",
|
||||
item: mk({ id: "q7", title: "【iOS】首次登录访问 Profile 弹出授权弹窗(默认策略)", platform: "ios", status: "unreproducible", meegoState: "RESOLVED", mrUrl: null, mrState: null, tags: ["social_relation"] }),
|
||||
info: { policy: DEFAULT_REVIEW_POLICY, approvedBy: null, unreproToQa: false, route: null } },
|
||||
];
|
||||
|
||||
const byId = new Map(SCENARIOS.map((s) => [s.item.id, s]));
|
||||
const pulse = (id: string): BatchPulse[] => {
|
||||
const s = byId.get(id);
|
||||
const qa = s?.info.policy.id === "qa_first";
|
||||
return [{ tag: qa ? "friending_ei_sa" : "social_relation", name: qa ? "Friending EI SA" : "社交关系链", total: 23, fixed: 3, settled: 3, settledRate: 0.13, stage: "review", reviewPolicy: s?.info.policy.id ?? "rd_review" }];
|
||||
};
|
||||
Object.assign(api, {
|
||||
me: async () => ({ email: "rd.li@bytedance.com", hasBitsToken: true }),
|
||||
taskBatchPulse: async (id: string) => ({ batches: pulse(id) }),
|
||||
taskReviewInfo: async (id: string) => byId.get(id)!.info,
|
||||
qaReopenRework: async () => ({ ok: true }),
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const [openId, setOpenId] = useState<string | null>(null);
|
||||
const [, bump] = useState(0);
|
||||
// 「仍然修复」:假数据里把这张单改成评估中(和服务端 runRecordedAnyway 一样摘掉 watchTag / watchWithdrawn)。
|
||||
(api as { runRecordedTask: (id: string) => Promise<unknown> }).runRecordedTask = async (id: string) => {
|
||||
const s = byId.get(id);
|
||||
if (s) s.item = { ...s.item, status: "initializing", failureReason: null, watchTag: null, watchWithdrawn: null } as unknown as BoardItem;
|
||||
return { ok: true };
|
||||
};
|
||||
const open = openId ? byId.get(openId)?.item ?? null : null;
|
||||
return (
|
||||
<div className="op-demo">
|
||||
<h1>QA 先验收 · 任务抽屉 · 演示</h1>
|
||||
<p className="op-sub">点卡片打开抽屉,看标题下面的说明行、状态旁的标签、底部「所在项目」和复核历史。抽屉是真组件、数据是假的,其它接口连不上(下半部分会空着)。</p>
|
||||
<div className="op-cards">
|
||||
{SCENARIOS.map((s) => (
|
||||
<div key={s.item.id} className="op-case">
|
||||
<div className="op-note">{s.note}</div>
|
||||
<TaskCard item={s.item} onOpen={() => setOpenId(s.item.id)} />
|
||||
<div className="op-mr">{(s.item as Task).status} · Meego {(s.item as Task).meegoState ?? "—"}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<TaskDetailDrawer item={open} onClose={() => setOpenId(null)} onMutated={() => bump((x) => x + 1)} />
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.op-demo { padding: 24px 32px 64px; max-width: 1120px; color: var(--text); }
|
||||
.op-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.op-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
|
||||
.op-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
|
||||
.op-case { display: flex; flex-direction: column; gap: 8px; }
|
||||
.op-note { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 54px; }
|
||||
.op-mr { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,126 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import { api } from "../lib/api";
|
||||
import type { BoardItem, Task } from "../types";
|
||||
import TaskCard from "../components/TaskCard";
|
||||
import TaskDetailDrawer from "../components/TaskDetailDrawer";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:抽屉右下角「修改意见」在各状态下的样子(shared bugReworkable)。抽屉是真组件,喂假数据;
|
||||
* 打回接口在这里打桩(成功后单子变成「排队修复」),其它接口都连不上(抽屉下半部分会报错或空着)。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8093`,访问
|
||||
* /demo-reject-approved.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const mrUrl = (id: number) => `https://bits.bytedance.net/devops/1500037378/code/detail/${id}`;
|
||||
const base = {
|
||||
kind: "bug" as const, platform: "ios", priorityKey: 1, pinned: 0, createdAt: now - 6 * 86_400_000,
|
||||
statusChangedAt: now - 4 * 86_400_000, startedAt: now - 6 * 86_400_000, finishedAt: now - 5 * 86_400_000,
|
||||
clusters: [], tags: [], watchers: ["qa.zhang@bytedance.com"], watcherLabels: { "qa.zhang@bytedance.com": "张测试" },
|
||||
mrState: "opened", mergedIntoBaseAt: null, baseRef: null, repoKey: "tiktok-ios",
|
||||
createdViaKeyId: null, createdViaSource: null, createdViaLabel: null, createdViaOwner: null, externalId: null,
|
||||
description: "", executionPlan: null, reproSteps: null, remark: null, reviewHistory: [], reviewFeedback: null,
|
||||
attempts: 1, executorNodeId: "ff-ios-01", branchName: "bugfix/streamline-demo",
|
||||
workspacePath: "/tmp/demo", beforeEvidencePath: null, afterEvidencePath: null, failureReason: null,
|
||||
codeSidecars: [], attachments: null, ttkbPackages: [],
|
||||
};
|
||||
const mk = (over: Record<string, unknown>): BoardItem => ({ ...base, ...over } as unknown as BoardItem);
|
||||
|
||||
const SCENARIOS: { note: string; item: BoardItem }[] = [
|
||||
{
|
||||
note: "① 这次报的场景(8ec5eb5e):QA 在 Meego 上重开,但留言只说「群里说未修好」,平台判定先不重修。以前 RD 没地方写意见;现在右下角有「新增修改」,写了提交就带着意见重修",
|
||||
item: mk({ id: "r1", status: "fix_succeeded", meegoState: "REOPENED", mrUrl: mrUrl(8592680), meegoId: "7390551125",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/7390551125", attempts: 2,
|
||||
title: "[Server][ODC]删除SA头像后,仍然展示SA头像,编辑头像业务进入后提示出错了" }),
|
||||
},
|
||||
{
|
||||
note: "② 修复失败:以前要先「重新打开」回到待复核才能打回;现在右下角直接写意见重修",
|
||||
item: mk({ id: "r2", status: "fix_failed", meegoState: "OPEN", mrUrl: null, meegoId: "6840020004", failureReason: "agent 判定改动范围超出预期,未完成",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6840020004", title: "【iOS】私信会话页长按消息菜单位置偏移" }),
|
||||
},
|
||||
{
|
||||
note: "③ 待 QA 确认(Meego RESOLVED)/ MR 待合入:和以前一样能打回(底部「打回修改」和右下角是同一个输入框)",
|
||||
item: mk({ id: "r3", status: "fix_succeeded", meegoState: "RESOLVED", mrUrl: mrUrl(8580001), meegoId: "6840020001",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6840020001", title: "【iOS】个人页头像预览缩放后无法关闭" }),
|
||||
},
|
||||
{
|
||||
note: "④ 正在修:右下角「新增修改」还在,但灰着;点一下提示「正在修,这一轮跑完再提」",
|
||||
item: mk({ id: "r4", status: "fixing", meegoState: "OPEN", mrUrl: null, meegoId: "6840020005", finishedAt: null,
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6840020005", title: "【iOS】关注列表下拉刷新后头像闪烁" }),
|
||||
},
|
||||
{
|
||||
note: "⑤ 对照:MR 已合入 —— 修复已落地,不出入口(要接着改请新建单)",
|
||||
item: mk({ id: "r5", status: "fix_succeeded", meegoState: "CLOSED", mrState: "merged", mrUrl: mrUrl(8580002), meegoId: "6840020002",
|
||||
meegoUrl: "https://meego.larkoffice.com/tiktok/issue/detail/6840020002", title: "【iOS】关注页「更多」按钮点击无响应" }),
|
||||
},
|
||||
];
|
||||
|
||||
let setItems: (fn: (m: Map<string, BoardItem>) => Map<string, BoardItem>) => void = () => {};
|
||||
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
Object.assign(api, {
|
||||
ciGateForItem: async () => ({ runs: [] }),
|
||||
// ① 那张单所在项目是「QA 先验收」,平台读过 QA 的留言、判定先不重修 —— 抽屉标题下那行说明
|
||||
taskReviewInfo: async (id: string) => ({
|
||||
policy: { id: id === "r1" ? "qa_first" : "rd_review", maxChangedUnits: 5 }, approvedBy: "system:qa-first", unreproToQa: false, route: null,
|
||||
reopenJudge: id === "r1" ? { state: "wait", kind: "no_signal", summary: "留言只转述群里说未修好、需流转回RD,没说哪里不对", at: Date.now() - 3_600_000 } : null,
|
||||
}),
|
||||
reviewReject: async (id: string, feedback: string) => {
|
||||
await wait(700);
|
||||
setItems((m) => {
|
||||
const cur = m.get(id) as Task & { kind: "bug" };
|
||||
const reviewHistory = [...(cur.reviewHistory as unknown as unknown[] ?? []), { at: Date.now(), source: "human", round: cur.attempts, text: feedback, reviewer: "jingyuan.yi" }];
|
||||
return new Map(m).set(id, { ...cur, status: "awaiting_fix", reviewFeedback: feedback, reviewHistory, statusChangedAt: Date.now(), finishedAt: null } as unknown as BoardItem);
|
||||
});
|
||||
return { ok: true };
|
||||
},
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const [items, _setItems] = useState(() => new Map(SCENARIOS.map((s) => [s.item.id, s.item])));
|
||||
setItems = _setItems;
|
||||
const [openId, setOpenId] = useState<string | null>(null);
|
||||
const open = openId ? items.get(openId) ?? null : null;
|
||||
return (
|
||||
<div className="op-demo">
|
||||
<h1>右下角「修改意见」随时可提 · 演示</h1>
|
||||
<p className="op-sub">点卡片打开抽屉,看右下角的「新增修改」。这一轮停下来、修复还没落地的单(待复核、复现不了、修复失败、待 QA、待合入、QA 打回;Feature 的待复核 / 实现失败 / 已完成)都能写意见提交,单子回到排队修复,agent 在同一条分支上接着改;正在排队 / 修的单入口灰着;已合入的不出。提交后单子变成「排队修复」,入口随之变灰。抽屉是真组件、数据是假的,其它接口连不上。刷新页面重置。</p>
|
||||
<div className="op-cards">
|
||||
{SCENARIOS.map((s) => {
|
||||
const it = items.get(s.item.id)!;
|
||||
return (
|
||||
<div key={s.item.id} className="op-case">
|
||||
<div className="op-note">{s.note}</div>
|
||||
<TaskCard item={it} onOpen={() => setOpenId(it.id)} />
|
||||
<div className="op-mr">状态:{it.status} · Meego {(it as Task).meegoState} · MR {(it as Task).mrState}</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<TaskDetailDrawer item={open} onClose={() => setOpenId(null)} />
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.op-demo { padding: 24px 32px 64px; max-width: 1120px; color: var(--text); }
|
||||
.op-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.op-sub { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
|
||||
.op-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
|
||||
.op-case { display: flex; flex-direction: column; gap: 8px; }
|
||||
.op-note { font-size: 12px; color: var(--muted); line-height: 1.5; min-height: 54px; }
|
||||
.op-mr { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
@@ -0,0 +1,314 @@
|
||||
import { useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import "../styles/dashboard.css";
|
||||
import {
|
||||
api, type LoopOverview, type LoopExperiment, type LoopExperimentDetail, type LoopShipView, type LoopShipOption,
|
||||
type LoopShipScope, type LoopStatus, type LoopEvent,
|
||||
} from "../lib/api";
|
||||
import RsiLoop from "../components/RsiLoop";
|
||||
import Toaster from "../components/Toaster";
|
||||
import DialogHost from "../components/DialogHost";
|
||||
|
||||
/**
|
||||
* 本地演示:自我改进 → 实验里的「上线决策」(批准上线 / 驳回 / 重跑一端 / 补另一端)。
|
||||
* 面板是真组件(RsiLoop),回路的几个接口在这里打桩,状态存在内存里,刷新页面重置。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问
|
||||
* /demo-rsi-ship.html(API_TARGET 指向死端口,保证不会代理到任何真实服务)。
|
||||
*
|
||||
* 打桩只模拟「控制面算好的东西」—— 真正的规则与补丁校验在 control-server/src/rsi_ship_service.ts
|
||||
* 与 shared/src/rsi_ship.ts,单测在 control-server/test/rsi_ship.test.ts。
|
||||
*/
|
||||
|
||||
const now = Date.now();
|
||||
const H = 3_600_000;
|
||||
const wait = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
type Plat = "ios" | "android";
|
||||
interface Member { id: string; platform: Plat; status: LoopStatus; reason: string; labReason?: string; inconclusive?: boolean; createdAt: number; shipScope?: string | null; promotedAt?: number | null }
|
||||
interface Case {
|
||||
title: string; note: string; kind: "prompt" | "runtime"; scope: "both" | Plat; target: string;
|
||||
members: Member[];
|
||||
added?: string[]; profile?: Record<string, string>;
|
||||
/** 补丁冲突时的错误(演示「补丁不可用」)。 */
|
||||
conflict?: string;
|
||||
drift?: { platform: string; lines: number }[];
|
||||
}
|
||||
|
||||
const PASS = (t: string) => `复跑通过:${t}`;
|
||||
const CASES: Case[] = [
|
||||
{
|
||||
title: "进入目标页前先等首页 feed 加载完", kind: "prompt", scope: "both", target: "reach_s",
|
||||
note: "① 双端策略,两端都通过 → 只有「两端一起上线」",
|
||||
members: [
|
||||
{ id: "c1-ios", platform: "ios", status: "lab_passed", reason: PASS("到达复现现场 44.1 → 36.8 分(5 对);自报修好 4 → 4;到达 4 → 5"), createdAt: now - 70 * H },
|
||||
{ id: "c1-and", platform: "android", status: "lab_passed", reason: PASS("到达复现现场 31.2 → 27.9 分(5 对);自报修好 3 → 4;到达 4 → 4"), createdAt: now - 70 * H + 1 },
|
||||
],
|
||||
added: ["- 冷启动后先确认首页 feed 已出现第一条内容,再去点目标入口;feed 没出来就等,不要先点入口再回头等。"],
|
||||
},
|
||||
{
|
||||
title: "deeplink 打不开时换成首页入口走", kind: "prompt", scope: "both", target: "reach_miss",
|
||||
note: "② 双端策略,iOS 通过、Android 变差 → 只能「只上 iOS」(新增行包进 iOS 段,Android 逐字节不变)",
|
||||
members: [
|
||||
{ id: "c2-ios", platform: "ios", status: "lab_passed", reason: PASS("未到达复现现场 2 → 0(5 对);自报修好 3 → 4"), createdAt: now - 90 * H },
|
||||
{ id: "c2-and", platform: "android", status: "lab_failed", reason: "复跑未通过:到达复现现场的个数比现行少(4 → 3),底线没守住", createdAt: now - 90 * H + 1 },
|
||||
],
|
||||
added: ["- deeplink 跳转后 10 秒内目标页没出现,不要重试同一条 deeplink;回到首页按 TestSpec 的入口路径手动进入。"],
|
||||
},
|
||||
{
|
||||
title: "Frida 报错后先看后续调用有没有自愈", kind: "prompt", scope: "both", target: "dead_end_s",
|
||||
note: "③ 双端策略,iOS 通过、Android「判不了」(可比的对数不够)→ 可以只上 iOS,也可以先重跑 Android",
|
||||
members: [
|
||||
{ id: "c3-ios", platform: "ios", status: "lab_passed", reason: PASS("走不通时耗掉的时长 96 → 71 分(4 对);自报修好 3 → 3"), createdAt: now - 120 * H },
|
||||
{ id: "c3-and", platform: "android", status: "lab_failed", inconclusive: true, reason: "复跑 3 天到期,只有 2 对可比的跑完(至少要 3 对),判不了;另有 1 对不可比已剔除(两组跑在不同版本的卫星包上)", createdAt: now - 120 * H + 1 },
|
||||
],
|
||||
added: ["- Frida attach / 调用报错后,先看接下来两次调用是否已恢复;连续三次同样报错再判定为环境问题。"],
|
||||
},
|
||||
{
|
||||
title: "安装包之后先确认进程起来再操作", kind: "prompt", scope: "both", target: "reach_s",
|
||||
note: "④ 双端策略,iOS 已通过、Android 还在复跑 → 等两端都跑完才能决定",
|
||||
members: [
|
||||
{ id: "c4-ios", platform: "ios", status: "lab_passed", reason: PASS("到达复现现场 41.0 → 37.2 分(5 对)"), createdAt: now - 30 * H },
|
||||
{ id: "c4-and", platform: "android", status: "lab", reason: "复跑中:3/5 对已跑完", createdAt: now - 30 * H + 1 },
|
||||
],
|
||||
added: ["- 装完包先用 wait-for --pid 等 App 进程起来,再做第一次 UI 操作。"],
|
||||
},
|
||||
{
|
||||
title: "catuse 树里找不到控件时先滚动再找", kind: "prompt", scope: "ios", target: "reach_s",
|
||||
note: "⑤ 单端策略(iOS 专有),通过 → 只能「只上 iOS」;也可以「补 Android 端复跑」变成双端组",
|
||||
members: [
|
||||
{ id: "c5-ios", platform: "ios", status: "lab_passed", reason: PASS("到达复现现场 47.5 → 40.3 分(5 对);自报修好 4 → 4"), createdAt: now - 50 * H },
|
||||
],
|
||||
added: ["- catuse ui 的结构树里找不到目标控件时,先在当前列表上滑一屏再找,别直接判定入口不存在。"],
|
||||
drift: [{ platform: "ios", lines: 2 }],
|
||||
},
|
||||
{
|
||||
title: "Android:思考强度调到 medium", kind: "runtime", scope: "android", target: "reach_s",
|
||||
note: "⑥ 运行时旋钮(单端):生产配置包按端分开,只改 Android 的",
|
||||
members: [
|
||||
{ id: "c6-and", platform: "android", status: "lab_passed", reason: PASS("到达复现现场 53.3 → 50.2 分(5 对);单次用时 86 → 77 分"), createdAt: now - 200 * H },
|
||||
],
|
||||
profile: { android: "思考强度=medium" },
|
||||
},
|
||||
{
|
||||
title: "复现前先清 App 数据", kind: "prompt", scope: "ios", target: "reach_miss",
|
||||
note: "⑦ 补丁冲突:实验之后模板改过,锚点那一行没了 → 「补丁不可用」,不能批准",
|
||||
members: [
|
||||
{ id: "c7-ios", platform: "ios", status: "lab_passed", reason: PASS("未到达复现现场 1 → 0(5 对)"), createdAt: now - 240 * H },
|
||||
],
|
||||
added: ["- 复现前先清掉 App 数据(设置 → 通用 → iPhone 储存空间),避免旧缓存把问题盖住。"],
|
||||
conflict: "新增的「- 复现前先清掉 App 数据…」在现在的模板里找不到唯一的位置(锚点「## 步骤 3 — 复现、修复、验证」已改动或重复)",
|
||||
},
|
||||
{
|
||||
title: "长列表滚动到底再判定没有数据", kind: "prompt", scope: "both", target: "reach_s",
|
||||
note: "⑧ 已批准两端、等改动进代码:显示落代码命令;可撤销批准",
|
||||
members: [
|
||||
{ id: "c8-ios", platform: "ios", status: "approved", shipScope: "both", reason: "admin.wang 批准上线(两端):两端到达都快了", createdAt: now - 300 * H },
|
||||
{ id: "c8-and", platform: "android", status: "approved", shipScope: "both", reason: "admin.wang 批准上线(两端):两端到达都快了", createdAt: now - 300 * H + 1 },
|
||||
],
|
||||
added: ["- 判定「列表没有数据」之前,先滚动到底并等加载更多结束。"],
|
||||
},
|
||||
{
|
||||
title: "评论区输入框弹起后等键盘动画结束", kind: "prompt", scope: "both", target: "reach_s",
|
||||
note: "⑨ 已上线(iOS)+ Android 当时判不了被单独留下",
|
||||
members: [
|
||||
{ id: "c9-ios", platform: "ios", status: "shipped", shipScope: "ios", promotedAt: now - 20 * H, reason: "admin.wang 批准上线(iOS)", createdAt: now - 400 * H },
|
||||
{ id: "c9-and", platform: "android", status: "declined", reason: "admin.wang 批准时只上 iOS,这一端不上", createdAt: now - 400 * H + 1 },
|
||||
],
|
||||
added: ["- 点评论输入框后,等键盘动画结束(wait-for --settle)再输入。"],
|
||||
},
|
||||
];
|
||||
|
||||
// ── 内存里的状态机:只演示交互,规则以控制面为准 ───────────────────────────────
|
||||
|
||||
const byMember = new Map<string, Case>();
|
||||
for (const c of CASES) for (const m of c.members) { byMember.set(m.id, c); m.labReason = m.reason; }
|
||||
const events = new Map<string, LoopEvent[]>();
|
||||
const ev = (id: string, actor: string, type: string, title: string, body: string | null = null) =>
|
||||
events.set(id, [{ id: `${id}-${Math.random()}`, experimentId: id, at: Date.now(), actor, type, title, body }, ...(events.get(id) ?? [])]);
|
||||
for (const c of CASES) for (const m of c.members) {
|
||||
ev(m.id, "loop-runner", "proposal", `提案${c.scope === "both" ? `(双端 · ${m.platform === "ios" ? "iOS" : "Android"} 端)` : ""}:${c.title}`);
|
||||
if (m.status !== "lab") ev(m.id, "loop-judge", m.status === "lab_failed" ? "lab_fail" : "lab_pass", m.reason);
|
||||
}
|
||||
|
||||
const latest = (c: Case) => {
|
||||
const map = new Map<string, Member>();
|
||||
for (const m of [...c.members].sort((a, b) => a.createdAt - b.createdAt)) map.set(m.platform, m);
|
||||
return [...map.values()];
|
||||
};
|
||||
|
||||
function shipView(c: Case, self: Member): LoopShipView {
|
||||
const ms = latest(c);
|
||||
const running = ms.filter((m) => m.status === "lab" || m.status === "queued");
|
||||
const passed = ms.filter((m) => m.status === "lab_passed");
|
||||
const options: LoopShipOption[] = [];
|
||||
if (!running.length && passed.length) {
|
||||
const scope: LoopShipScope = passed.length === 2 ? "both" : passed[0].platform;
|
||||
if (c.conflict) options.push({ scope, ok: false, error: c.conflict });
|
||||
else if (c.kind === "runtime") {
|
||||
options.push({ scope, ok: true, profile: c.profile, checks: (["ios", "android"] as const).map((p) => p === scope || scope === "both"
|
||||
? { platform: p, kind: "shipped" as const, ok: true, note: `生产配置包改为 ${c.profile?.[p] ?? ""}` }
|
||||
: { platform: p, kind: "unchanged" as const, ok: true, note: "生产配置包不变" }) });
|
||||
} else {
|
||||
options.push({ scope, ok: true, added: c.added, drift: c.drift, checks: (["ios", "android"] as const).map((p) => scope === "both" || p === scope
|
||||
? { platform: p, kind: "shipped" as const, ok: true, note: `新增 ${c.added?.length ?? 0} 行,与复跑的候选一致` }
|
||||
: { platform: p, kind: "unchanged" as const, ok: true, note: "展开后的正文逐字节不变" }) });
|
||||
}
|
||||
}
|
||||
const lead = c.members[0];
|
||||
const canExtend = c.scope !== "both" && ["lab_passed", "approved", "shipped"].includes(lead.status);
|
||||
return {
|
||||
scope: c.scope,
|
||||
members: c.members.map((m) => ({ id: m.id, platform: m.platform, status: m.status, reason: m.reason, inconclusive: !!m.inconclusive,
|
||||
createdAt: m.createdAt, shipScope: m.shipScope ?? null, promotedAt: m.promotedAt ?? null })),
|
||||
options,
|
||||
waiting: running.length ? `等 ${running.map((m) => (m.platform === "ios" ? "iOS" : "Android")).join(" / ")} 复跑结束:双端策略两端都跑完才决定` : null,
|
||||
rerunnable: ms.filter((m) => m.status === "lab_failed").map((m) => ({ id: m.id, platform: m.platform })),
|
||||
extendTo: canExtend && self.id === lead.id ? (lead.platform === "ios" ? "android" : "ios") : null,
|
||||
};
|
||||
}
|
||||
|
||||
function toExp(c: Case, m: Member): LoopExperiment {
|
||||
return {
|
||||
id: m.id, stage: "bug.run", platform: m.platform, kind: c.kind, status: m.status, title: c.title,
|
||||
problemClass: null, cluster: null,
|
||||
summary: "(演示数据)回路从近 7 天的执行会话里切出这类浪费,聚合后排在第一。",
|
||||
hypothesis: "(演示数据)把这条纪律写进执行 prompt,能让 agent 更早走到复现现场。",
|
||||
method: c.kind === "runtime" ? "运行时实验:两组同一版 prompt,候选组多带执行配置包。" : "在步骤 3 前插入一行纪律;实验机上配对复跑评估集历史任务。",
|
||||
conclusion: null, targetMetric: c.target, basePromptId: null, candidatePromptId: null,
|
||||
candidateProfile: c.kind === "runtime" ? JSON.stringify({ effort: "medium" }) : null,
|
||||
scope: c.scope, groupId: c.scope === "both" || c.members.length > 1 ? c.members[0].id : null, shipScope: (m.shipScope as LoopShipScope) ?? null,
|
||||
offlineResult: null,
|
||||
onlineResult: m.status === "lab" ? { phase: "lab", at: now, decision: "continue", reason: m.labReason ?? m.reason }
|
||||
: { phase: "lab", at: m.createdAt + 60 * H, decision: m.status === "lab_failed" ? "fail" : "pass", reason: m.labReason ?? m.reason },
|
||||
decisionReason: ["approved", "declined", "shipped"].includes(m.status) ? m.reason : null, share: 0,
|
||||
createdBy: "loop-runner", createdAt: m.createdAt, updatedAt: now, canaryStartedAt: null, promotedAt: m.promotedAt ?? null, decidedAt: null,
|
||||
};
|
||||
}
|
||||
|
||||
const BASE = "## 步骤 3 — 复现、修复、验证\n- 先按 TestSpec 的入口走到目标页。\n- 到达后录屏取证。";
|
||||
const metrics = [
|
||||
{ key: "reach_s", label: "到达复现现场用时", unit: "seconds" as const, better: "down" as const, role: "target" as const, group: "business" as const, doc: "从这批开始到第一张校验通过的修复前证据。" },
|
||||
{ key: "reach_miss", label: "未到达复现现场", unit: "rate" as const, better: "down" as const, role: "target" as const, group: "business" as const, doc: "一批结束仍没有合格的修复前证据。" },
|
||||
{ key: "dead_end_s", label: "走不通时耗掉的时长", unit: "seconds" as const, better: "down" as const, role: "target" as const, group: "business" as const, doc: "没以 FIXED 收尾的批次的整批时长。" },
|
||||
];
|
||||
|
||||
function overview(): LoopOverview {
|
||||
return {
|
||||
enabled: true, labNodes: { android: "evaluator-android-01", ios: "temp-ios-01" },
|
||||
pause: { paused: false, by: null, at: null, reason: null },
|
||||
params: { LAB_WALL_TOLERANCE: 0.2, LAB_MIN_PAIRS: 3, LAB_MAX_DAYS: 3 },
|
||||
stages: ["bug.run"], metrics,
|
||||
experiments: CASES.flatMap((c) => c.members.map((m) => toExp(c, m))).sort((a, b) => b.createdAt - a.createdAt),
|
||||
events: [],
|
||||
baseline: {
|
||||
days: Array.from({ length: 14 }, (_, i) => ({ day: new Date(now - (13 - i) * 24 * H).toISOString().slice(0, 10), rounds: 10,
|
||||
metrics: { reach_s: { mean: 2400 + Math.sin(i / 2) * 300, n: 10 } } })),
|
||||
markers: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function find(id: string): { c: Case; m: Member } {
|
||||
const c = byMember.get(id)!;
|
||||
return { c, m: c.members.find((x) => x.id === id)! };
|
||||
}
|
||||
|
||||
const WHO = "admin.wang";
|
||||
Object.assign(api.rsi.loop, {
|
||||
overview: async () => { await wait(150); return overview(); },
|
||||
experiment: async (id: string): Promise<LoopExperimentDetail> => {
|
||||
await wait(200);
|
||||
const { c, m } = find(id);
|
||||
const cand = c.added ? BASE.replace("## 步骤 3 — 复现、修复、验证\n", `## 步骤 3 — 复现、修复、验证\n${c.added.join("\n")}\n`) : null;
|
||||
return { experiment: toExp(c, m), events: events.get(id) ?? [], baseTemplate: BASE, candidateTemplate: cand, lab: [], ship: shipView(c, m) };
|
||||
},
|
||||
approve: async (id: string, scope: LoopShipScope, reason?: string) => {
|
||||
await wait(500);
|
||||
const { c } = find(id);
|
||||
for (const m of latest(c)) {
|
||||
if (m.status !== "lab_passed") continue;
|
||||
if (scope === "both" || m.platform === scope) {
|
||||
m.status = "approved"; m.shipScope = scope; m.reason = `${WHO} 批准上线(${scope === "both" ? "两端" : scope === "ios" ? "iOS" : "Android"})${reason ? `:${reason}` : ""}`;
|
||||
ev(m.id, WHO, "approve", `人工决定:批准上线(${scope})`, reason ?? null);
|
||||
} else {
|
||||
m.status = "declined"; m.reason = `${WHO} 批准时只上 ${scope === "ios" ? "iOS" : "Android"},这一端不上`;
|
||||
ev(m.id, WHO, "decision", "人工决定:这一端不上");
|
||||
}
|
||||
}
|
||||
return { ok: true };
|
||||
},
|
||||
decline: async (id: string, reason: string) => {
|
||||
await wait(400);
|
||||
const { c } = find(id);
|
||||
for (const m of latest(c)) if (m.status === "lab_passed" || m.status === "approved") {
|
||||
m.status = "declined"; m.shipScope = null; m.reason = `${WHO} 驳回:${reason}`; ev(m.id, WHO, "decision", "人工决定:驳回", reason);
|
||||
}
|
||||
return { ok: true };
|
||||
},
|
||||
unapprove: async (id: string) => {
|
||||
await wait(400);
|
||||
const { c } = find(id);
|
||||
for (const m of latest(c)) {
|
||||
if (m.status === "approved" || (m.status === "declined" && /批准时只上/.test(m.reason))) {
|
||||
m.status = "lab_passed"; m.shipScope = null; m.reason = m.labReason ?? PASS(""); ev(m.id, WHO, "decision", "人工决定:撤销批准,回到待决定");
|
||||
}
|
||||
}
|
||||
return { ok: true };
|
||||
},
|
||||
rerun: async (id: string) => {
|
||||
await wait(500);
|
||||
const { c, m } = find(id);
|
||||
const nm: Member = { id: `${id}-r${Date.now()}`, platform: m.platform, status: "lab", reason: "复跑中:0/5 对已跑完", labReason: "复跑中:0/5 对已跑完", createdAt: Date.now() };
|
||||
c.members.push(nm); byMember.set(nm.id, c);
|
||||
ev(nm.id, WHO, "proposal", `重跑 ${m.platform === "ios" ? "iOS" : "Android"} 端:同一对现行 / 候选,换一批复跑`);
|
||||
return { ok: true };
|
||||
},
|
||||
extend: async (id: string) => {
|
||||
await wait(500);
|
||||
const { c, m } = find(id);
|
||||
const to: Plat = m.platform === "ios" ? "android" : "ios";
|
||||
c.scope = "both";
|
||||
const nm: Member = { id: `${id}-x${Date.now()}`, platform: to, status: "queued", reason: "实验机被别的实验占着,排队", labReason: "排队中", createdAt: Date.now() };
|
||||
c.members.push(nm); byMember.set(nm.id, c);
|
||||
ev(nm.id, WHO, "proposal", `补 ${to === "ios" ? "iOS" : "Android"} 端复跑`);
|
||||
return { ok: true };
|
||||
},
|
||||
revert: async () => { await wait(300); return { ok: true }; },
|
||||
pause: async () => ({ pause: overview().pause }),
|
||||
});
|
||||
|
||||
function Demo() {
|
||||
const [admin, setAdmin] = useState(true);
|
||||
const [k, setK] = useState(0);
|
||||
return (
|
||||
<div className="rs-demo">
|
||||
<h1>自我改进 · 实验「上线决策」演示</h1>
|
||||
<p className="rs-sub">面板是真组件、数据是假的,刷新页面重置。点开任意实验,详情里的「上线决策」块就是这次新增的部分。规则:<b>哪端复跑通过就只上哪端</b>;双端策略两端都跑完才决定。</p>
|
||||
<div className="rs-bar">
|
||||
<label style={{ display: "inline-flex", alignItems: "center", gap: 6, cursor: "pointer" }}><input type="checkbox" style={{ width: "auto", margin: 0 }} checked={admin} onChange={(e) => { setAdmin(e.target.checked); setK((n) => n + 1); }} /> 以管理员身份查看(取消勾选 = 非管理员,只能看不能点)</label>
|
||||
</div>
|
||||
<ol className="rs-cases">{CASES.map((c) => <li key={c.title}><b>{c.title}</b> —— {c.note}</li>)}</ol>
|
||||
<div className="lab rsi"><div className="rsi-body">
|
||||
<RsiLoop key={k} canDecide canShip={admin} />
|
||||
</div></div>
|
||||
<Toaster />
|
||||
<DialogHost />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
html, body, #root { height: auto !important; overflow: auto !important; }
|
||||
body { margin: 0; background: var(--bg, #f6f7f9); }
|
||||
.rs-demo { padding: 24px 32px 64px; max-width: 1120px; margin: 0 auto; color: var(--text); }
|
||||
.rs-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.rs-sub { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.7; }
|
||||
.rs-bar { font-size: 13px; margin-bottom: 10px; }
|
||||
.rs-cases { font-size: 12.5px; color: var(--text-2); line-height: 1.8; margin: 0 0 16px; padding-left: 20px; }
|
||||
@media (max-width: 640px) { .rs-demo { padding: 16px; } }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,194 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "../styles.css";
|
||||
import ImportDialog from "../components/ImportDialog";
|
||||
import Toaster from "../components/Toaster";
|
||||
import { api } from "../lib/api";
|
||||
import { setLang } from "../lib/i18n";
|
||||
import {
|
||||
DEFAULT_VERIFY_RUN_FIRST_TEMPLATE, parseVerifySpec, verifyKnowledgeBlock, verifySpecBlock, type VerifySpec,
|
||||
} from "@bbbug/shared/verify_prompt";
|
||||
import { checksFromPresets, type CustomCheckPreset } from "@bbbug/shared/verify_scope_templates";
|
||||
import SAMPLE from "./verifyChecksDemo.data.json";
|
||||
|
||||
/**
|
||||
* 本地演示:UI 走查的检查项不再有系统缺省。
|
||||
*
|
||||
* 右侧渲染的是**真模板 + 真 verifySpecBlock**(shared/verify_prompt.ts),和派发时 agent 收到的正文同源;
|
||||
* 只有节点侧才知道的块(Frida 接入、设备说明、wait-for)留了占位。「改前」一栏是改动前不勾专项时
|
||||
* 系统补上的那段原文,拿来对照。
|
||||
*
|
||||
* 左边「新建验证任务」打开的是真表单;提交被拦在本页(createVerification 换成假的),不会建单,
|
||||
* 建出的规约直接进右侧渲染。「快捷专项筛查 → 添加更多」的共享专项存在本页内存里(刷新即复原),
|
||||
* 增删改走的是和线上同一套表单与校验。
|
||||
*
|
||||
* 打开方式:control-web 下 `API_TARGET=http://127.0.0.1:9 bun x vite --port 8092`,访问 /demo-verify-checks.html。
|
||||
*/
|
||||
|
||||
// 改动前 verifySpecBlock 在 checks 为空时补上的那段(UI_AUDIT_CHECKS),逐字保留做对照。
|
||||
const OLD_DEFAULT = `**检查项**(逐条对照,不要只报你第一眼看见的那类):
|
||||
1. 老旧组件样式:用的是不是规范的 TUX 组件(Panel / 按钮 / 颜色 / 圆角) —— 截图 + 代码参数
|
||||
2. UI 异常:提示气泡 / 弹窗 / banner 同屏出现两样及以上,插画 / icon / 按钮尺寸异常 —— 截图 + 代码参数
|
||||
3. 热区异常或过小:低于 44×44pt 的可点区域 —— 代码参数
|
||||
4. 文案冗长或不合理截断:被硬截断、从单词中间断开、折行挤压 —— 截图
|
||||
5. 新用户流程体验:连续遭遇弹窗 / banner / 提示 —— 截图 + 代码参数
|
||||
6. 多语言适配:截断、超长、与英文对照表意错误、标点滥用 —— 截图`;
|
||||
|
||||
type Scenario = { key: string; label: string; spec: VerifySpec; note: string };
|
||||
const base: VerifySpec = { format: "ui-audit", scope: SAMPLE.scope, budgetHours: 12 };
|
||||
const GENERAL = ["general-legacy-style", "general-ui-anomaly", "hit-area-spec", "general-copy-truncation", "general-new-user-flow", "general-multilingual"];
|
||||
const SCENARIOS: Scenario[] = [
|
||||
{ key: "none", label: "e1e28a58 原样:不勾专项", spec: base,
|
||||
note: "就是线上那张单。改前系统补了六类(含热区 <44pt),报告里 23 条热区;改后只按范围正文查。" },
|
||||
{ key: "hit", label: "同范围 + 勾「热区问题」", spec: { ...base, checks: checksFromPresets(["hit-area-spec"]) },
|
||||
note: "想查热区就勾上。注入的是按平台组件规范的那一份,不再有 44pt / 36pt 两个阈值。" },
|
||||
{ key: "general", label: "同范围 + 勾「常规走查」", spec: { ...base, checks: checksFromPresets(GENERAL) },
|
||||
note: "以前的缺省六类,现在是一个显式预设:勾了才进 prompt。" },
|
||||
];
|
||||
|
||||
let captured: ((s: VerifySpec, title: string) => void) | null = null;
|
||||
setLang("zh");
|
||||
// 共享专项:本页内存里的假存储,预置一条别人加的。
|
||||
let store: CustomCheckPreset[] = [{
|
||||
id: "custom-demo-1", label: "Toast 文案超过两行", cat: "文案与多语言",
|
||||
text: "Toast 文案超过两行。行数从截图数,或结构树里 label 高度 ÷ 单行高;「细节」抄原文并写行数",
|
||||
createdBy: "teammate@bytedance.com", updatedBy: "teammate@bytedance.com", updatedAt: Date.now(),
|
||||
}];
|
||||
const ME = "demo.user@bytedance.com";
|
||||
api.verifyCheckPresets = async () => ({ presets: store });
|
||||
api.addVerifyCheckPreset = async (input) => {
|
||||
const p: CustomCheckPreset = { id: `custom-${crypto.randomUUID()}`, ...input, createdBy: ME, updatedBy: ME, updatedAt: Date.now() };
|
||||
store = [...store, p];
|
||||
return p;
|
||||
};
|
||||
api.updateVerifyCheckPreset = async (id, input) => {
|
||||
const old = store.find((p) => p.id === id);
|
||||
if (!old) throw new Error("这条专项已被删除");
|
||||
const p = { ...old, ...input, updatedBy: ME, updatedAt: Date.now() };
|
||||
store = store.map((x) => x.id === id ? p : x);
|
||||
return p;
|
||||
};
|
||||
api.deleteVerifyCheckPreset = async (id) => { store = store.filter((p) => p.id !== id); return { ok: true }; };
|
||||
api.clustersList = async () => ({ clusters: ["default"] });
|
||||
api.productProfiles = async () => ({ version: 1, profiles: [{ id: "tiktok", name: "TikTok", platforms: { ios: { repoKey: "tiktok-ios", baseBranch: "develop" }, android: { repoKey: "tiktok-android", baseBranch: "develop" } } }] }) as unknown as Awaited<ReturnType<typeof api.productProfiles>>;
|
||||
api.ttkbPackages = (async () => ({ packages: [] })) as unknown as typeof api.ttkbPackages;
|
||||
api.createVerification = (async (input: { verifySpec: string; title: string | null; description: string }) => {
|
||||
const spec = parseVerifySpec(input.verifySpec);
|
||||
const title = input.title || input.description.slice(0, 24);
|
||||
if (spec) captured?.(spec, title);
|
||||
return { title };
|
||||
}) as unknown as typeof api.createVerification;
|
||||
|
||||
function render(spec: VerifySpec, title: string): string {
|
||||
const fill: Record<string, string> = {
|
||||
workspaceDir: "/…/verify-demo", verifySpecBlock: verifySpecBlock(spec), knowledgeBlock: verifyKnowledgeBlock("ios"),
|
||||
budgetHours: String(spec.budgetHours ?? 6), title, platform: "ios", batchNo: "1", attempts: "0",
|
||||
fridaBlock: "(Frida 接入说明 —— 节点按平台渲染)", iosDeviceBlock: "", waitBlock: "", waitForCmd: "wait-for",
|
||||
auditReportCmd: "audit-report", aiWorkspace: "~/ai_workspace", baseBranch: "develop", langNote: "中文", linkNote: "", reviewFeedback: "",
|
||||
};
|
||||
return DEFAULT_VERIFY_RUN_FIRST_TEMPLATE.replace(/\{\{(\w+)\}\}/g, (_, k: string) => fill[k] ?? "");
|
||||
}
|
||||
|
||||
function checksSection(spec: VerifySpec): string {
|
||||
const block = verifySpecBlock(spec);
|
||||
return block.slice(block.indexOf("**检查项**")).trim();
|
||||
}
|
||||
|
||||
const HIT = /热区|44×44|36×36/g;
|
||||
function hitLines(text: string): string[] {
|
||||
return text.split("\n").filter((l) => HIT.test(l) && ((HIT.lastIndex = 0), true));
|
||||
}
|
||||
|
||||
function Mark({ text }: { text: string }) {
|
||||
const parts = text.split(/(热区|44×44pt|36×36pt)/);
|
||||
return <>{parts.map((p, i) => i % 2 ? <mark key={i}>{p}</mark> : p)}</>;
|
||||
}
|
||||
|
||||
function Demo() {
|
||||
const [key, setKey] = useState("none");
|
||||
const [mine, setMine] = useState<Scenario | null>(null);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [full, setFull] = useState(false);
|
||||
useEffect(() => {
|
||||
captured = (spec, title) => {
|
||||
setMine({ key: "mine", label: `你刚建的:${title}`, spec, note: "表单提交被拦在本页,没有真的建单。" });
|
||||
setKey("mine");
|
||||
};
|
||||
}, []);
|
||||
// 表单默认停在 Bug 页签,打开后切到「验证」。
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const id = setTimeout(() => {
|
||||
const tab = [...document.querySelectorAll<HTMLButtonElement>(".import-dialog .import-kind-tabs button")]
|
||||
.find((b) => /^(验证|Verify)/.test(b.textContent?.trim() ?? ""));
|
||||
tab?.click();
|
||||
}, 50);
|
||||
return () => clearTimeout(id);
|
||||
}, [open]);
|
||||
|
||||
const all = mine ? [...SCENARIOS, mine] : SCENARIOS;
|
||||
const sc = all.find((s) => s.key === key) ?? SCENARIOS[0];
|
||||
const prompt = render(sc.spec, SAMPLE.title);
|
||||
const noChecks = !sc.spec.checks?.length;
|
||||
const hits = hitLines(prompt);
|
||||
|
||||
return <div className="vc-demo">
|
||||
<h1>走查检查项隔离 · 演示</h1>
|
||||
<p className="vc-sub">验证任务按格式决定报告;具体查什么只来自「筛查内容」和勾选的专项,系统 prompt 里不再有缺省检查项。
|
||||
右侧是派发时 agent 真正收到的 prompt(真模板、真渲染)。</p>
|
||||
|
||||
<div className="vc-bar">
|
||||
{all.map((s) => <button key={s.key} type="button" aria-pressed={s.key === sc.key} onClick={() => setKey(s.key)}>{s.label}</button>)}
|
||||
<button type="button" className="primary" onClick={() => setOpen(true)}>新建验证任务(真表单)…</button>
|
||||
</div>
|
||||
<p className="vc-note">{sc.note}</p>
|
||||
|
||||
<div className="vc-cols">
|
||||
<section>
|
||||
<h2>改前 · 检查项段</h2>
|
||||
<pre className="vc-old"><Mark text={noChecks ? OLD_DEFAULT : checksSection(sc.spec).replace("(建单人勾的专项,逐条对照", "(逐条对照")} /></pre>
|
||||
{noChecks && <p className="vc-foot">不勾专项时系统自动补上这六条 —— 第 3 条就是热区。</p>}
|
||||
</section>
|
||||
<section>
|
||||
<h2>改后 · 检查项段</h2>
|
||||
<pre className="vc-new"><Mark text={checksSection(sc.spec)} /></pre>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section className="vc-hits">
|
||||
<h2>改后整份 prompt 里提到热区的地方:{hits.length} 处</h2>
|
||||
<ul>{hits.map((l, i) => <li key={i}><Mark text={l.trim().slice(0, 220)} /></li>)}</ul>
|
||||
{noChecks && <p className="vc-foot">不勾专项时只剩报告的分类词表那一行 —— 它说明「类别列能填什么」,并注明不是检查清单。</p>}
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<button type="button" className="ghost" onClick={() => setFull(!full)}>{full ? "收起" : "展开"}整份 prompt({prompt.length.toLocaleString()} 字)</button>
|
||||
{full && <pre className="vc-full"><Mark text={prompt} /></pre>}
|
||||
</section>
|
||||
|
||||
<ImportDialog open={open} onClose={() => setOpen(false)} />
|
||||
<Toaster />
|
||||
</div>;
|
||||
}
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
.vc-demo { padding: 24px 32px 64px; max-width: 1280px; color: var(--text); }
|
||||
.vc-demo h1 { font-size: 20px; margin: 0 0 6px; }
|
||||
.vc-demo h2 { font-size: 14px; margin: 0 0 8px; }
|
||||
.vc-sub, .vc-note, .vc-foot { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 12px; }
|
||||
.vc-note { color: var(--text); }
|
||||
.vc-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
|
||||
.vc-bar button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
|
||||
.vc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
|
||||
.vc-demo section { margin-bottom: 20px; }
|
||||
.vc-demo pre { white-space: pre-wrap; font-size: 12.5px; line-height: 1.65; padding: 12px 14px; border-radius: 12px;
|
||||
border: 1px solid var(--border); background: var(--surface); margin: 0; max-height: 560px; overflow: auto; }
|
||||
.vc-old { border-color: color-mix(in srgb, #d14 40%, var(--border)) !important; }
|
||||
.vc-new { border-color: color-mix(in srgb, #1a7 45%, var(--border)) !important; }
|
||||
.vc-full { max-height: 80vh !important; }
|
||||
.vc-demo mark { background: #ffd54a66; color: inherit; padding: 0 1px; border-radius: 2px; }
|
||||
.vc-hits ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
createRoot(document.getElementById("root")!).render(<Demo />);
|
||||
Reference in New Issue
Block a user