feat(timestep): fixed 120 Hz timestep accumulator (demoa-4cp) #1

Closed
computercrack-sandfortress-ci wants to merge 0 commits from computercrack-sandfortress-ci/feature/fogleap-backbone into feature/fogleap-backbone AGit

Loop result for demoa-4cp (app: fixed timestep accumulator, F-INPUT-003): commits 221c839 (tests) and a035461 (implementation), changes only crates/fogleap/src/timestep.rs and crates/fogleap/tests/timestep.rs. The base has the newer 0ba103a, which is intended (no rebase/merge). Pushed unchanged at the maintainer's request despite known stage 2 findings (remainder not clamped at 0.0, Refs: trailer missing), details in the comment. 🤖 Generated with Claude Code

Loop result for demoa-4cp (app: fixed timestep accumulator, F-INPUT-003): commits 221c839 (tests) and a035461 (implementation), changes only `crates/fogleap/src/timestep.rs` and `crates/fogleap/tests/timestep.rs`. The base has the newer 0ba103a, which is intended (no rebase/merge). Pushed unchanged at the maintainer's request despite known stage 2 findings (remainder not clamped at 0.0, `Refs:` trailer missing), details in the comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Phase 1: add integration tests for Accumulator::advance().
Tests verify exact-sequence behaviour, stall clamping, and a
10 000-frame LCG property test.  Stubs in timestep.rs still
panic via todo!().
- Clamp negative/NaN/infinite dt to 0.0
- Accumulate remainder in seconds, convert to ticks via floor(remainder*120+1e-9)
- Cap at MAX_TICKS_PER_FRAME=8, drop remainder on stall clamp
- Carry sub-tick remainder between frames

Co-Authored-By: Claude Code <noreply@anthropic.com>
Author
Collaborator

Audit stage 1 (Forge Gateway): no findings.

**Audit stage 1 (Forge Gateway)**: no findings.
Author
Collaborator

Stage 2 review: feature/fogleap-backbone (a035461) against feature/fogleap-backbone (897d242), ticket demoa-4cp

Stage 1 (audit-preview):

remote: audit-preview: no findings (nothing was forwarded)

Not run: cargo is not installed in the review VM, so neither the tests nor scripts/static-check.sh were run here.

Security

  • Hard: none. Only crates/fogleap/src/timestep.rs and crates/fogleap/tests/timestep.rs change. No Cargo, scripts, assets or CI changes, no FOGLEAP_BLESS, no I/O. No documented boundary is crossed (quality.md: security "low").
  • Untrusted dt: NaN, ±inf and negative values become 0.0. A huge finite dt saturates the as u32 cast, which lands in the clamp branch and returns 8 with remainder 0.0. No panic, no DoS.
  • Judgement: no test for +inf or f64::MAX.

Code review

Standards

  • Hard: both commits (221c839, a035461) lack the Refs: demoa-4cp trailer that CONTRIBUTING.md:18 requires ("Commit messages: <type>(<scope>): <description> with a Refs: <ticket> trailer").
  • Judgement: 120.0 appears twice as a literal (design.md:31 names fogleap_core::TICKS_PER_SECOND). is_nan() || is_infinite() could be !is_finite().

Spec

  • Hard: "remainder -= n / 120.0 (not below 0.0)": the clamp is missing (timestep.rs, else branch self.remainder -= n as f64 / 120.0;). Because of +1e-9, n can round up and the remainder becomes slightly negative. Fix: self.remainder = (self.remainder - n as f64 / 120.0).max(0.0);.
  • Everything else is implemented as specified. All acceptance tests are present and use the ticket's numbers. TDD phases are separate (phase 2 did not touch the tests).

Architecture

  • Hard (in scope): the same missing clamp breaks the invariant remainder >= 0. Tests in tests/ cannot reach it because the field is private.
  • Hard (plan, outside this diff): demoa-fya expects frame(.., 10.0/120.0, ..) to give 10 ticks and 30.0/120.0 to give 30 ticks. Through this Accumulator both are capped at 8 (MAX_TICKS_PER_FRAME), so fya's tests cannot be met as written. Fix the fya ticket before seeding it.
  • Judgement: use TICKS_PER_SECOND instead of the literal. No alpha() for interpolation (nobody asks for it so far).
  • API, module and dependency direction match the pre-seeded stub and design.md:73. No ADR needed.

Count

Section Hard Judgement Worst finding
Security 0 1 no inf test
Code review 2 2 remainder not clamped at 0.0 (spec)
Architecture 2 (1 in scope, 1 plan) 2 fya tests contradict the 8-tick clamp
# Stage 2 review: feature/fogleap-backbone (a035461) against feature/fogleap-backbone (897d242), ticket demoa-4cp Stage 1 (audit-preview): ``` remote: audit-preview: no findings (nothing was forwarded) ``` Not run: `cargo` is not installed in the review VM, so neither the tests nor `scripts/static-check.sh` were run here. ## Security - **Hard:** none. Only `crates/fogleap/src/timestep.rs` and `crates/fogleap/tests/timestep.rs` change. No Cargo, scripts, assets or CI changes, no `FOGLEAP_BLESS`, no I/O. No documented boundary is crossed (quality.md: security "low"). - **Untrusted dt:** NaN, ±inf and negative values become 0.0. A huge finite dt saturates the `as u32` cast, which lands in the clamp branch and returns 8 with remainder 0.0. No panic, no DoS. - **Judgement:** no test for `+inf` or `f64::MAX`. ## Code review *Standards* - **Hard:** both commits (221c839, a035461) lack the `Refs: demoa-4cp` trailer that CONTRIBUTING.md:18 requires ("Commit messages: `<type>(<scope>): <description>` with a `Refs: <ticket>` trailer"). - **Judgement:** `120.0` appears twice as a literal (design.md:31 names `fogleap_core::TICKS_PER_SECOND`). `is_nan() || is_infinite()` could be `!is_finite()`. *Spec* - **Hard:** "remainder -= n / 120.0 (not below 0.0)": the clamp is missing (`timestep.rs`, else branch `self.remainder -= n as f64 / 120.0;`). Because of `+1e-9`, n can round up and the remainder becomes slightly negative. Fix: `self.remainder = (self.remainder - n as f64 / 120.0).max(0.0);`. - Everything else is implemented as specified. All acceptance tests are present and use the ticket's numbers. TDD phases are separate (phase 2 did not touch the tests). ## Architecture - **Hard (in scope):** the same missing clamp breaks the invariant remainder >= 0. Tests in `tests/` cannot reach it because the field is private. - **Hard (plan, outside this diff):** demoa-fya expects `frame(.., 10.0/120.0, ..)` to give 10 ticks and `30.0/120.0` to give 30 ticks. Through this `Accumulator` both are capped at 8 (`MAX_TICKS_PER_FRAME`), so fya's tests cannot be met as written. Fix the fya ticket before seeding it. - **Judgement:** use `TICKS_PER_SECOND` instead of the literal. No `alpha()` for interpolation (nobody asks for it so far). - API, module and dependency direction match the pre-seeded stub and design.md:73. No ADR needed. ## Count | Section | Hard | Judgement | Worst finding | |---|---|---|---| | Security | 0 | 1 | no inf test | | Code review | 2 | 2 | remainder not clamped at 0.0 (spec) | | Architecture | 2 (1 in scope, 1 plan) | 2 | fya tests contradict the 8-tick clamp |
Author
Collaborator

Superseded: its commits (221c839, a035461, the merge 0f2b954 and the fix d88649f) are on feature/fogleap-backbone, so this PR has no diff left. Closing; the backbone reaches review as one PR at its end.

Superseded: its commits (221c839, a035461, the merge 0f2b954 and the fix d88649f) are on feature/fogleap-backbone, so this PR has no diff left. Closing; the backbone reaches review as one PR at its end.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ComputerCrack/rust-vulkan-fog-platformer!1
No description provided.