audit: confirm SECONDS_PER_DAY is used consistently across codebase - #708
audit: confirm SECONDS_PER_DAY is used consistently across codebase#708Horlarmmy wants to merge 2 commits into
Conversation
|
@Horlarmmy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
nice focused audit. i grepped the repo and the claim checks out: two small notes:
the failing test check is the stale-base test_campaign_update 4-tuple thing from main, unrelated to this diff. gate: this branch is behind main, rebase it and CI should go green, happy to see it merge after that (the two test suggestions above are nice-to-haves, not blockers). |
|
Thank you for the feedback, All good now |
Summary
Closes #671
Audits the codebase for ad-hoc
86400literals andconfirms all campaign-duration-in-days arithmetic goes through the
centralized
SECONDS_PER_DAYconstant.Audit findings
SECONDS_PER_DAY?lifecycle.rsduration_days.checked_mul(crate::SECONDS_PER_DAY)campaigns/create.rscalculate_deadline(...)campaigns/update.rsadditional_days * crate::SECONDS_PER_DAYcampaigns/update.rstotal_duration_seconds / crate::SECONDS_PER_DAYcampaigns/withdraw.rsdelay_days * crate::SECONDS_PER_DAYChanges
src/constants.rs— Updated docstring to note the constant isconsistently imported by all callers.
src/tests/test_lifecycle.rs— Added three unit tests forcalculate_deadline: happy path (30 days), zero days, and overflowrejection.
Verification
cargo fmt --check— passcargo clippy --all-targets --features testutils -- -D warnings— passcargo test test_calculate_deadline— 3/3 pass