Description
require_report_window_open uses inclusive bounds (now >= start && now <= end), and report_revenue returns ReportingWindowClosed outside the window. Boundary coverage at now == start, now == end, now == start - 1, now == end + 1, and zero-width windows (start == end) should be explicit. Add a ledger-timestamp-driven matrix.
Requirements and context
- Must be secure, tested, and documented
- Should be efficient and easy to review
- Relevant code:
src/lib.rs (report_revenue, set_report_window, is_window_open, require_report_window_open), src/test_time_windows.rs
- Confirm an unset window means always-open
Suggested execution
- Fork the repo and create a branch
git checkout -b feat/report-window-boundary-tests
- Implement changes
- Set a window
[start, end] and drive ledger timestamp across all five boundary points
- Assert
ReportingWindowClosed outside and Ok at inclusive edges
- Add a zero-width single-second window case
- Validate security and correctness assumptions
Test and commit
- Run tests
- Cover edge cases
- Unset window, zero-width window, window reconfigured mid-flight
- Include test output and security notes
Example commit message
test: cover report window inclusive boundaries and zero-width slot
Guidelines
- Minimum 95 percent test coverage
- Clear documentation
- Timeframe: 96 hours
Description
require_report_window_openuses inclusive bounds (now >= start && now <= end), andreport_revenuereturnsReportingWindowClosedoutside the window. Boundary coverage atnow == start,now == end,now == start - 1,now == end + 1, and zero-width windows (start == end) should be explicit. Add a ledger-timestamp-driven matrix.Requirements and context
src/lib.rs(report_revenue,set_report_window,is_window_open,require_report_window_open),src/test_time_windows.rsSuggested execution
git checkout -b feat/report-window-boundary-tests[start, end]and drive ledger timestamp across all five boundary pointsReportingWindowClosedoutside andOkat inclusive edgesTest and commit
cargo testExample commit message
test: cover report window inclusive boundaries and zero-width slotGuidelines