| name | dev-pipeline |
| description | Development Pipeline guidance for Fortress Rollback. Use when Planning features, structuring development work, end-to-end development process. |
Development Pipeline
Structured workflow from planning through shipping for fortress-rollback. Each phase has defined inputs, outputs, and quality gates. Skip phases only when explicitly noted.
Phase 1: Scope
Input: Feature request, bug report, or improvement idea.
Output: Written scope document (can be a PR description or issue comment).
Scope Template
## What
[One sentence: what changes and why]
## Why
[What problem does this solve? Who benefits?]
## Affected Components
- [ ] src/sync_layer/ (SyncLayer, SavedStates, GameStateCell)
- [ ] src/input_queue/ (InputQueue, prediction)
- [ ] src/sessions/ (P2PSession, SpectatorSession, SyncTestSession, SessionBuilder)
- [ ] src/network/ (protocol, codec, compression, messages)
- [ ] src/error.rs (FortressError, structured error types)
- [ ] Public API (new pub items, changed signatures)
- [ ] Wire protocol (message format, serialization)
## Determinism Impact
[Does this touch simulation code? Could it affect determinism?]
## Breaking Changes
[Any pub API changes? Wire protocol changes? Default value changes?]
## Size Estimate
- [ ] Small (1-2 files, <100 lines)
- [ ] Medium (3-5 files, 100-500 lines)
- [ ] Large (>5 files or >500 lines) -- consider splitting
Scope Decision Rules
| Change Type | Needs Scope Doc? | Needs CHANGELOG? |
|---|
| Bug fix (pub-visible) | Yes | Yes |
| Bug fix (internal) | Yes | No |
| New public API | Yes | Yes |
| Refactoring | Brief | No |
| Dependency update | No | If user-visible |
| CI/tooling | No | No |
| Kani proof | Brief | No |
Prerequisites
Before running verification/debugging commands in this workflow, confirm:
- Rust toolchain and cargo available
rg available for scan commands
cargo-nextest available for cargo nextest commands
- Kani setup verified if running proof levels (see kani.md)
Phase 2: Design
Input: Scope document.
Output: Design decisions documented in code comments or PR description.
Skip if: Change is <100 lines and touches only one module.
Design Checklist
Design Patterns to Follow
| When You Need | Use This Pattern | Example in Codebase |
|---|
| Configurable construction | Builder | SessionBuilder |
| Protocol state machine | Type-state or enum | SessionState, protocol states |
| Input prediction | Strategy | PredictionStrategy trait |
| Bounded collections | Circular buffer | SavedStates |
| Request/response | Request enum | FortressRequest |
| Error context | Structured enum | InternalErrorKind, InvalidRequestKind |
Design Review Entrance Gate
Before moving to implementation, verify these project-specific checks:
If any check fails, refine scope/design before writing code.
Design Decision Log
If the change introduces a meaningful architecture or behavior choice, add a
one-line record using the design-decisions skill.
- Log major choices (determinism, API behavior, safety/performance trade-offs)
- Skip trivial refactors and style-only changes
- Use supersedes links when replacing prior patterns
Phase 3: Implement
Input: Design decisions.
Output: Working code with tests.
Implementation Order
- Write the error types first -- define what can go wrong
- Write the tests second -- define expected behavior
- Write the implementation third -- make tests pass
- Write the docs last -- document what you built
During Implementation
cargo check
cargo clippy --workspace --all-targets --features tokio,json
cargo nextest run module_name --no-capture
Commit Granularity
| Good Commit | Bad Commit |
|---|
"Add InputDelayTooLarge variant to InvalidRequestKind" | "Various changes" |
"Validate input delay in SessionBuilder::with_input_delay" | "Fix stuff" |
| "Add regression test for issue #42" | "WIP" |
Each commit should pass cargo c && cargo t independently.
Phase 4: Self-Review
Input: Complete implementation.
Output: Reviewed diff ready for external review.
Do this BEFORE opening a PR.
Run the readiness gate from review-readiness.md, then perform targeted checks from code-review.md:
rg '\.unwrap\(\)|\.expect\(|panic!\(|todo!\(' --type rust src/
rg 'HashMap|HashSet|Instant::now|thread_rng' --type rust src/
python3 scripts/ci/agent-preflight.py --auto-fix
cargo c && cargo t
cargo doc --no-deps
typos
All readiness checks should pass before opening a PR.
Self-Review Questions
- If I came to this code in 6 months, would I understand why?
- Is there a simpler way to achieve the same result?
- Did I test the error paths, not just the happy path?
- Could this change cause a desync in a running game?
- Would a user need to change their code because of this?
Phase 5: Verification
Input: Self-reviewed code.
Output: All verification passes.
Verification Levels (run in order, stop at first failure)
cargo c && cargo t
cargo test --doc -- --nocapture
./scripts/verification/verify-kani.sh --tier 1 --quick
cargo test --features z3-verification -- --nocapture
Kani Proof Obligations
If your change affects code covered by a Kani proof:
- Run the affected proof:
cargo kani --harness proof_name
- If the proof fails, fix the code OR update the proof (with justification)
- If you add new invariants, add new proofs
- Register new proofs in
scripts/verification/verify-kani.sh
Phase 6: Ship
Input: Passing CI, approved review.
Output: Merged PR.
Pre-Merge Checklist
Post-Merge
- Monitor CI on main branch
- If the change is user-facing, consider updating wiki/docs
- If the change is a breaking change, plan the next release
Emergency Fixes
For production-blocking bugs, compress the pipeline:
- Scope: One-line description in the PR title
- Skip design phase (but still read existing code)
- Implement: Fix + regression test in one commit
- Self-review: Run
cargo c && cargo t only
- Ship: Get one reviewer, merge quickly
- Follow up: Add docs, additional tests, and related fixes as separate PRs
Anti-Patterns
| Anti-Pattern | Why It Hurts | Do Instead |
|---|
| Code first, think later | Rework, wrong abstraction | Scope and design first |
| Skip tests | Bugs ship, regression debt | Write tests before code |
| Mega-PR (>500 lines) | Hard to review, risky merge | Split into stacked PRs |
| Fix + refactor in one PR | Hard to review, bisect-breaking | Separate commits/PRs |
| Skip self-review | Obvious issues waste reviewer time | Review your own diff first |