一键导入
code-review
Code Review Guide guidance for Fortress Rollback. Use when Reviewing PRs, auditing code changes, verifying zero-panic compliance, checking determinism.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Code Review Guide guidance for Fortress Rollback. Use when Reviewing PRs, auditing code changes, verifying zero-panic compliance, checking determinism.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Crate Publishing guidance for Fortress Rollback. Use when Publishing to crates.io, version bumps, release checklist.
Changelog Practices guidance for Fortress Rollback. Use when Writing CHANGELOG entries, deciding what to document.
Design Decision Log Pattern guidance for Fortress Rollback. Use when Architectural decisions, design alternatives, superseding prior choices.
Repository-wide engineering policy and project context for Fortress Rollback. Use when implementing, diagnosing, reviewing, testing, documenting, or releasing changes in this repository.
GitHub Actions Best Practices guidance for Fortress Rollback. Use when Writing GitHub Actions workflows, CI debugging, actionlint, caching.
Workspace Organization guidance for Fortress Rollback. Use when Organizing workspace, splitting crates, module structure decisions.
| name | code-review |
| description | Code Review Guide guidance for Fortress Rollback. Use when Reviewing PRs, auditing code changes, verifying zero-panic compliance, checking determinism. |
Structured two-pass review for fortress-rollback. Pass 1 finds correctness issues. Pass 2 finds style and improvement opportunities. Fix mechanical issues directly; flag judgment calls for discussion.
Search the diff for forbidden patterns:
rg '\.unwrap\(\)|\.expect\(|panic!\(|todo!\(|unimplemented!\(' --type rust -- src/
Direct indexing (array[i] instead of array.get(i)) is caught by clippy::indexing_slicing, which is denied in CI safety checks. Run the strict clippy pass or review manually.
Every hit in production code (src/, excluding #[cfg(test)] blocks) is a blocking issue. Verify the fix uses structured error handling.
// FORBIDDEN
let val = map.get(&key).unwrap();
// REQUIRED
let val = map.get(&key).ok_or(FortressError::InternalErrorStructured {
kind: InternalErrorKind::Custom("key not found in map"),
})?;
Check for non-deterministic patterns in any code that runs during simulation:
| Pattern | Grep | Fix |
|---|---|---|
| HashMap iteration | rg 'HashMap' --type rust src/ | BTreeMap or sort before use |
| System time | rg 'Instant::now|SystemTime' --type rust src/ | Frame counters |
| Thread-local RNG | rg 'thread_rng|random\(\)' --type rust src/ | Seeded RNG (rand_pcg or rand_chacha) |
| Pointer-based ordering | rg 'as \*const|addr\(\)' --type rust src/ | Stable IDs |
| Unordered iteration | rg '\.par_iter\(\)' --type rust src/ | Sequential or collect+sort |
For every new match on FortressError or its sub-enums:
_ => on #[non_exhaustive] enums that drops new cases)Result values are propagated with ?, not discarded with let _ =When a PR adds a new variant to any enum, search for all match sites:
rg 'match.*error|match.*kind|match.*reason|match.*state' --type rust src/
Every _ => arm on a non-#[non_exhaustive] enum is suspicious. Adding a variant should cause compile errors at all match sites.
For changes to SyncLayer, P2PSession, or InputQueue:
SavedStates?Frame arithmetic using try_add/try_sub (not raw +/-)?Escalate using adversarial-handoff.md when changes touch high-risk areas:
If triggered, complete adversarial handoff before final merge approval.
/// and examples?#[must_use] where appropriate?Code in advance_frame, SyncLayer::advance_frame, input queues, and protocol handling is hot path:
String, Vec::new(), format!())clone() where a reference sufficesSmallVec over Vec for bounded collectionswhat_condition_expected_behaviorWhen public API changes, verify these are updated:
rg 'old_function_name|OldTypeName' --type rust --type md
Check: rustdoc, CHANGELOG.md, docs/user-guide.md, examples/.
If the PR introduces a major architectural or behavior choice, verify a corresponding entry exists per design-decisions.md.
All frame math must use checked operations:
// FORBIDDEN: can overflow silently
let next = current_frame + offset;
// REQUIRED: returns FortressError::FrameArithmeticOverflow on overflow
let next = current_frame.try_add(offset)?;
Changes to Message, network protocol types (InputBytes, codec), or serialized types risk wire-protocol breakage. Verify:
New SessionBuilder parameters must validate at build time:
// REQUIRED: validate in builder, not at runtime
if fps == 0 {
return Err(InvalidRequestKind::ZeroFps.into());
}
Structure findings as:
## Critical (must fix before merge)
- [file:line] Description citing specific code
## Suggestions (non-blocking)
- [file:line] Description with proposed alternative
## Verified
- Zero-panic compliance: PASS/FAIL (N hits found)
- Determinism: PASS/FAIL
- Error handling: PASS/FAIL
- Tests included: YES/NO
- Design decision log: YES/NO/N/A
- Adversarial escalation required: YES/NO
unwrap/expect/panic!/todo! in production codeHashMap iteration in simulation pathsInstant::now() in game logicmatch arms exhaustive (no silent _ =>)cargo doc --no-deps passes (no broken doc links)cargo c && cargo t passes