zhaoxuya520/reverse-skill / skills
reverse-skill-router
FlaggedRoutes reverse engineering, exploitation, penetration testing, malware, mobile, firmware, browser automation, documentation, and security tasks to the appropriate specialist skill. Use when a task spans modules or the correct reverse-skill entrypoint is unclear.
field-journal/2026-10-16_fidelity-verification-layering.md
View on GitHub---
name: fidelity-verification-layering
description: 1:1 复刻的保真验证要分三层:实现有无 → 数值一致 → 响应结构一致。前两层全绿仍会漏掉字段级差异
metadata:
type: project
---
# 保真验证要分三层(前两层全绿,第三层才抓到问题)
**日期**: 2026-10-16
**场景分类**: Web / API(1:1 复刻验收)
**目标**: `{target_domain}`(原站)与其自研复刻版
## 背景
复刻版已由另一条独立路径完成。为验收保真度,逐层加深核对,**每一层都给出不同结论**:
| 层 | 检查内容 | 结果 |
|---|---|---|
| **L1 实现有无** | 端点/功能是否都做了 | 22/22 全覆盖 → 看着没问题 |
| **L2 数值一致** | 关键常量是否与原站一致(档位、系数、枚举、时限) | **逐字一致**(含"此前是 0.675 拟合值,已按原站改正"这类自查痕迹)→ 看着非常到位 |
| **L3 响应结构一致** | 每个端点的**响应体字段结构** | **抓到 3 处差异** —— 某端点缺 8 个字段、另两个各缺 2-3 个 |
**L3 的发现举例**(同类问题的一般形态):
- 配置端点:复刻版返回 6 个字段,原站返回 11 个 —— **缺** `usage` / `constants` / `uploadBlocked` / `suspendedUntil` / 第二组常量 …
- 知识库端点:**缺** `categories` / `quota` / `revealedToday`(配额与"今日已展开数" —— 前端展示"还能看几条"的依据)
- 素材端点:**缺** `total` / `quota`
**为什么 L1/L2 全绿却有问题**:L1 只问"有没有",L2 只问"数值对不对"。
**字段结构缺失**既不违反"有实现",也不违反"数值正确" —— 只有把两边的**响应体字段集合**摆在一起才看得见。
## 分层验证方法(可直接照搬)
**L3 的正确做法**:在**已登录**的真实页面上直接调**只读端点**,拿真实响应结构。
```js
(async () => {
const out = {};
const G = async (p) => {
const r = await fetch(p, { credentials: 'include' });
let j = null; try { j = await r.json(); } catch {}
return { status: r.status, ok: j && j.ok,
topKeys: j ? Object.keys(j) : null,
dataKeys: j && j.data && typeof j.data === 'object'
? (Array.isArray(j.data) ? `[array ${j.data.length}]` : Object.keys(j.data))
: null };
};
out['config'] = await G('/api/<服务>/config');
return JSON.stringify(out, null, 1);
})()
```
再与复刻版对应处理器的返回字段做**集合差异**。
**顺带能抓到的两类信息**:
- **统一响应外壳**:实测为 `{ok:true, data}` / `{ok:false, error}` —— 可作全站契约基准
- **参数校验行为**:缺必填参数时是返回 **400 + `{ok:false,error}`**,还是 **200 + 空数组**?两种风格都要对齐
## 安全边界(做 L3 时必守)
- **只调 GET**。生成类/揭示类 POST 端点(`score` / `cards` / `convert` / `kb/:id/reveal` 等)
**会消耗配额或产生副作用**;脚本化前必须先跑**一个**看响应里有没有 `charged` / `quota` 字段,
一旦计费立刻停手并如实告知用户消耗了多少。
- **别把静态提取当定论**:复刻版那侧的字段是从代码里静态抓的,可能有未覆盖的返回分支,
或字段由**别的端点**补上。报告里必须写明"需对方确认,不是定论"。
## 可复用的模式
**验收的深度决定能发现什么**:
「有没有」→「对不对」→「**长得一样吗**」。
前两层便宜且容易全绿,**最容易让人误判"已经复刻完了"**;
第三层要跑真实接口,成本高一点,但往往才是真正的保真关。
## 进化动作
- [x] 新增了 pitfalls 记录
## 环境信息
- OS: win32 x64 | 工具版本: Chrome 155 / Node 26
---
<!-- [进化统计] 本次新增模式: 1(三层保真验证) | 本次修复工具链问题: 0 -->
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |