find-mismatch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFind Mismatch
查找不匹配问题
Walk through every file. Focus only on runtime failures/bugs. Do NOT report style, formatting, performance suggestions, docs/tests, or "consider using X".
遍历所有文件。仅关注运行时故障/Bug。不要报告样式、格式、性能建议、文档/测试相关问题,或「建议使用X」这类内容。
1. Process
1. 流程
- JS/TS (Pre-check): Run static analysis.
- Check if installed: .
fallow --version - Install globally if missing: .
npm install -g fallow - Execute audit: .
fallow audit --format json --quiet - Filter findings by git status: .
git diff --staged --name-only - If staged: auto-apply safe fixes, re-run audit to verify.
- If unstaged: report-only (no modification).
- Check if installed:
- Review Checklist: Apply checklist to all changes.
- Report: Format findings using the specified template.
- JS/TS(预检查):执行静态分析。
- 检查是否已安装:。
fallow --version - 若缺失则全局安装:。
npm install -g fallow - 执行审计:。
fallow audit --format json --quiet - 按git状态过滤结果:。
git diff --staged --name-only - 若为暂存文件:自动应用安全修复,重新运行审计验证。
- 若为未暂存文件:仅报告问题(不修改代码)。
- 检查是否已安装:
- 审查清单:对所有变更应用审查清单。
- 报告:使用指定模板格式化问题结果。
2. Checklist Categories
2. 清单分类
1. Cross-Boundary Contracts
1. 跨边界契约
- Calling mismatch: Check RPC, HTTP, IPC, event name/subject match receiver.
- Param names/types: vs
userId, string vs number, flat vs wrapped.user_id - Return type: Field accesses () must match return signature.
result.field
- 调用不匹配:检查RPC、HTTP、IPC、事件名称/主题是否与接收方匹配。
- 参数名称/类型:与
userId不统一、字符串与数字类型混淆、扁平结构与封装结构不匹配。user_id - 返回类型:字段访问()必须与返回签名一致。
result.field
2. Serialization & Deserialization
2. 序列化与反序列化
- Casing: in DB/backend vs
snake_casein JSON/frontend.camelCase - Optionals: Field expected by receiver but optional in producer.
- Enums/discriminators: Discriminant fields (,
type) and variants match.kind - Base64: Double-encoding layers.
- 命名风格:数据库/后端的 与JSON/前端的
snake_case不统一。camelCase - 可选字段:接收方要求必填的字段,在生产方是可选的。
- 枚举/鉴别器:鉴别字段(、
type)与枚举值是否匹配。kind - Base64:多层重复编码问题。
3. Logic Bugs
3. 逻辑Bug
- Double counting: Counters incremented both in loop/branch and outside.
- Off-by-one: Index, pagination bounds (vs
page <= total).page < total - Conditions: Redundant/dead flags, unreachable statements, shadowed variables.
- 重复计数:计数器在循环/分支内和外部都执行了递增。
- 差一错误:索引、分页边界错误(如 与
page <= total混淆)。page < total - 条件问题:冗余/无效标志、不可达语句、变量遮蔽。
4. Property & Method Access
4. 属性与方法访问
- Null derefs: Method calls or array index access () without null/length checks.
items[0].name - Optional chaining: Stop check too early (e.g. still crashes if
user?.address.streetis null).address - This context: Callback bindings in classes.
- 空指针解引用:未做空值/长度检查就调用方法或访问数组索引()。
items[0].name - 可选链:检查终止过早(例如 在
user?.address.street为null时仍会崩溃)。address - This上下文:类中的回调绑定问题。
5. Async & Concurrency
5. 异步与并发
- Race conditions: Shared mutable states, parallel filesystem accesses without coordination.
- Missing : Promise ignored, silent errors.
await - Leaks: File/DB/network connections not closed in error paths.
- 竞态条件:共享可变状态、无协调的并行文件系统访问。
- 缺失:Promise被忽略,错误静默丢失。
await - 资源泄漏:错误路径下未关闭文件/数据库/网络连接。
6. CSS & Styling
6. CSS与样式
- HSL variables: Raw HSL components () instead of functional format (
0 0% 100%) fail in Tailwind v4 (unlike v3).hsl(0 0% 100%) - Inline themes: Circular references, selector mismatch (class vs data-theme).
- HSL变量:使用原始HSL分量()而非函数格式(
0 0% 100%),会在Tailwind v4中失效(v3中支持)。hsl(0 0% 100%) - 内联主题:循环引用、选择器不匹配(class与data-theme混淆)。
7. Placeholder & Stub Code
7. 占位符与存根代码
- Unused declarations/files/dependencies, TODO comments, empty catch blocks.
- 未使用的声明/文件/依赖、TODO注释、空catch块。
3. Language-Specific Pitfalls
3. 各语言特有陷阱
- Python: Hallucinated library methods (pandas, numpy, requests), sync/asyncio confusion, mutable default arguments (), silent indentation drops.
def f(x=[]) - JS/TS: Backend (Node) vs Frontend (Browser) API mix-ups, abuse, type-only import mismatches, barrel file false positives (exported but unused in production, used in tests/libraries).
any - C++: Raw vs smart pointer mix-ups, missing standard library header , uninitialized variables, buffer overflows.
#include - Rust: Borrow checker lifetime overcomplication, on
unwrap()/None, locking acrossErryield points..await - Java / .NET: Hallucinated annotations/attributes, LINQ N+1 queries, Entity Framework model snapshot drift / missing migrations (check model changes under against
Entities/).Migrations/ - Go: WaitGroup/Channel deadlocks, unexported struct fields in JSON, defer in loop, map concurrent access.
- PHP: Loose type comparisons (vs
==), array vs object access, key undefined.===
- Python:臆造的库方法(pandas、numpy、requests)、sync/asyncio混用混淆、可变默认参数()、缩进意外丢失。
def f(x=[]) - JS/TS:后端(Node)与前端(Browser)API混淆、滥用、仅类型导入不匹配、桶文件误报(导出的内容在生产环境未使用,仅在测试/库中使用)。
any - C++:裸指针与智能指针混用、缺失标准库头文件、变量未初始化、缓冲区溢出。
#include - Rust:借用检查器生命周期过度复杂、对/
None调用Err、跨unwrap()挂起点持有锁。.await - Java / .NET:臆造的注解/特性、LINQ N+1查询问题、Entity Framework模型快照漂移/缺失迁移(需对比下的模型变更与
Entities/目录)。Migrations/ - Go:WaitGroup/Channel死锁、JSON序列化时结构体字段未导出、循环中使用defer、map并发访问问题。
- PHP:松散类型比较(与
==混淆)、数组与对象访问混淆、键未定义。===
4. Fallow Finding Mapping & Fixes
4. Fallow问题映射与修复方案
| Fallow Type | Checklist Category | Auto-Fix Action |
|---|---|---|
| Placeholder & Stub | Remove |
| Placeholder & Stub | Delete file (check dynamic imports first). |
| Placeholder & Stub | Remove dependency from |
| Cross-Boundary | Defer to manual review (causes init bugs). |
| Logic Bugs | Defer to manual review. |
| Fallow 问题类型 | 对应清单分类 | 自动修复操作 |
|---|---|---|
| 占位符与存根 | 移除 |
| 占位符与存根 | 删除文件(先检查是否有动态导入)。 |
| 占位符与存根 | 从 |
| 跨边界契约 | 转人工审查(会导致初始化Bug)。 |
| 逻辑Bug | 转人工审查。 |
5. Output Format
5. 输出格式
Include header (only if JS/TS project):
## Review Summaryundefined包含标题(仅JS/TS项目需要):
## Review SummaryundefinedReview Summary
Review Summary
- Manual review bugs found: N
- Fallow auto-fixed: N findings (staged files only)
- Fallow non-auto-fixable: N findings
- Fallow verdict: pass / fail
Format individual findings (add `[fallow]` tag for fallow-sourced bugs):- Manual review bugs found: N
- Fallow auto-fixed: N findings (staged files only)
- Fallow non-auto-fixable: N findings
- Fallow verdict: pass / fail
单个问题的格式如下(fallow检出的Bug需添加`[fallow]`标签):Bug #1
Bug #1
- File: <path>:<line>
- Category: <category>
- What's wrong: <description>
- Runtime effect: <effect>
- Fix: <code>
undefined- File: <path>:<line>
- Category: <category>
- What's wrong: <description>
- Runtime effect: <effect>
- Fix: <code>
undefined