원클릭으로
py2rs-review-r0-behavior
[DRAFT] 第 0 轮审查:行为一致性验证。证明 Python 实现 == 迁移版 Rust 实现。不允许改代码,仅产出对比报告。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
[DRAFT] 第 0 轮审查:行为一致性验证。证明 Python 实现 == 迁移版 Rust 实现。不允许改代码,仅产出对比报告。
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Convert Markdown with LaTeX math, images, and tables into a polished PDF. Two rendering engines: (1) weasyprint — pure Python, no browser needed; (2) chromium — best for matrices/bmatrix/pmatrix/vmatrix and complex formulas. Supports Chinese/Japanese fonts. Can chain after ocr-md-polish for a complete OCR→clean→PDF workflow.
Burn core framework - Provides tensor operations, automatic differentiation, and neural network building blocks for Rust deep learning.
Burn CUDA backend - High-performance NVIDIA GPU acceleration. Provides optimal performance for NVIDIA hardware.
Burn Metal backend - Apple GPU acceleration for macOS and iOS. Optimized for Apple Silicon and Intel-based Macs.
Burn NdArray backend - CPU-based tensor operations using Rust's ndarray crate. Ideal for development, testing, and lightweight inference.
Burn ONNX support - Import ONNX models into Burn for inference on any backend. Supports compile-time code generation and runtime loading.
| name | py2rs-review-r0-behavior |
| description | [DRAFT] 第 0 轮审查:行为一致性验证。证明 Python 实现 == 迁移版 Rust 实现。不允许改代码,仅产出对比报告。 |
DRAFT(草稿状态)。下面的产物结构、输入输出都是猜想。
tests/compare/conftest.py —— pytest 的 fixture,统一加载 py 与 rs 两侧的同名模块tests/compare/test_<module>.py —— 一组用例:正常路径 / 边界值 / 异常路径 / 副作用tests/compare/<module>.log —— 运行产物,格式约定:每一行 <case> : PASS | FAIL <detail>reviews/r0-<module>-signature.md —— 签名对比报告的模板(函数 / 参数 / 返回 / 异常 / 副作用)python -m tests.compare.run --module <name>(可选)上面任何一样都可能在第一个真实项目里被推翻重写。
本 skill 是 所有后续审查(R1~R6)启动的前置 gate。 如果你在 R1 / R2 / R3 / R4 / R5 / R6 中发现“好像语义变了”,回到这里。
Python 实现 == Rust 实现
用一组可重复的输入/输出对来证明上式成立。
本 skill 不写代码、不改结构、不做任何优化,只做一件事:生成并跑行为对比测试。
py/<module>.py(原实现,已归档)rs/<module>.rs(迁移版实现)manifest/signatures/<module>.json(对外函数签名契约)tests/compare/test_<module>.py(或 .rs),形如:
for case in CASES:
py_result = py_imp.fn(case.input)
rs_result = rs_imp.fn(case.input)
assert py_result == rs_result, case.label
其中 CASES 至少覆盖:
reviews/r0-<module>-signature.md,逐函数列出:
| 项 | Python | Rust | 状态 |
|---|---|---|---|
| 参数列表 | get_user(user_id: int) | get_user(user_id: i64) | ✅ |
| 返回类型 | dict | None | Option<HashMap<String, Value>> | ✅ |
| 抛出异常 | UserNotFoundError, IOError | AppError::UserNotFound, AppError::Io | ✅ |
| 副作用 | 读 DB | 读 DB | ✅ |
tests/compare/<module>.log:
Case normal_1 PASS
Case normal_2 PASS
Case empty_input PASS
Case invalid_id PASS (一致地抛出 NotFound)
Case io_failure PASS (一致地抛出 IOError)
Total: 17 / 17 PASS
reviews/r0-<module>-diff.mdN / N PASSverified_attests/compare/<module>.log 中显示 100% PASSreviews/r0-<module>-signature.md 写好并存档manifest/modules.yaml 中对应模块状态被推进为 verified(或保持 verified 并刷新 verified_at)manifest/history/<ts>-r0-<module>.log 记录“已通过行为一致性审查”只有本 skill 完成后,R1~R6 才允许启动。