Files
2026-11-16 17:26:44 -08:00

23 lines
3.6 KiB
TypeScript

// Local rendering of real review components. No server or production requests.
import React from "react";
import { createRoot } from "react-dom/client";
import DialogHost from "../../src/components/DialogHost";
import EddyCompatPanel from "../../src/components/EddyCompatPanel";
import { api } from "../../src/lib/api";
import "../../src/styles.css";
const baseline = 'notes-build-a';
const source = '// review fixture: never execute\nreturn { install(ctx) { ctx.status("installed") }, dispose() {} };';
const bytes = new TextEncoder().encode(source);
const sha = Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))).map(x=>x.toString(16).padStart(2,'0')).join('');
const knowledge = {category:'app-compat',confidence:'suspected',summary:'Notes Catalyst 布局递归:启动后无响应',cause:'父布局回调反复请求子布局',solution:'仅在指定调用栈中抑制重复布局请求',validation:'冷启动 120 秒,内存稳定;未验证真机',rollback:'移除 guard 后下次启动恢复原逻辑'};
const fix = {knowledge,safety:{verdict:'allow',reason:'已自动检查:仅限定进程内布局,无外传行为'}, id:'fixture-layout',rev:1,tier:'frida-guard',problem:'hang:layout',title:'只抑制递归布局请求',state:'published',baseline,author:'local fixture',created:Date.now(),confirmations:{installed:0,stillFailing:0,regression:0},target:{baseline,executableUUID:'EXACT-BUILD-UUID'},runtimeContract:'eddy-compat-js-v1',payload:{path:'guard.js',sha256:sha},verify:{scope:'启动到登录页',durationSeconds:120,finalMiB:156},evidence:{sourceUnchanged:true,uncovered:['真实账号登录','真机回归']},verification:null };
const overview = { baselines:[], observations:[], fixes:[fix], problems:[{knowledge,baseline,signature:'hang:window',aliases:['hang:layout'],kind:'hang',status:'open',firstSeen:Date.now(),lastSeen:Date.now(),scope:{platform:'Catalyst'}},{baseline:'other-build',signature:'hang:window',aliases:[],kind:'hang',status:'open',firstSeen:Date.now(),lastSeen:Date.now(),scope:{}}], advisories:[{knowledge,safety:{verdict:'allow',reason:'检查通过'}, id:'fixture-advice',baseline,problem:'hang:layout',title:'Notes Catalyst 布局循环:启动后无响应',text:'## 现象\n启动后主线程卡住,内存持续增长。\n\n## 根因\n父布局回调再次请求子视图布局,形成循环。\n\n## 处理\n只在指定调用栈中抑制重复布局请求。保持源码不变。\n\n**验证边界:** 冷启动持续 120 秒,未覆盖登录与完整业务回归。\n\n`<script>alert("must not execute")</script>`',state:'verified',manual:false,author:'local fixture',scope:{}}] };
overview.problems.push({knowledge:{...knowledge,category:'devicesim',summary:'Catalyst 窗口尺寸变化导致容器渲染异常'},baseline,signature:'layout:window',aliases:[],kind:'layout',status:'open',firstSeen:Date.now(),lastSeen:Date.now(),scope:{platform:'Catalyst'}});
api.eddyAdmin = async <T,>(path: string, init?: RequestInit): Promise<T> => {
if (init?.method === 'POST') throw new Error('只读本地 fixture,不写入服务');
if (path.endsWith('/overview')) return structuredClone(overview) as T;
if (path.includes('/compat/packs/')) return {manifest:{id:fix.id,rev:1,target:fix.target},payload_b64:btoa(source),payload_name:'guard.js',sha256:sha} as T;
throw new Error('Unexpected fixture request '+path);
};
createRoot(document.getElementById('root')!).render(<main style={{maxWidth:1200,height:'100vh',overflow:'auto',margin:'0 auto',padding:24}}><p>本地审核界面预览 · 示例数据 · 不连接线上</p><EddyCompatPanel /><DialogHost /></main>);