fix(submit): compact missing-client and active-time preservation warnings

AZ
2d ago
+376-36

Summary

Extends the submit warning compaction introduced in #1581 to recognize and group missing-client (Preserved {client} because it disappeared from this same-device resubmit; kept {kept} tokens.) and active-time (Preserved {stored}ms active time because this same-device resubmit reported only {incoming}ms.) preservation warnings alongside daily token decrease warnings.

  • Groups missing-client warnings per client when 4 or more occur, displaying a single heading with compact date: kept pairs.
  • Groups active-time preservation warnings across days when 4 or more occur, displaying a single heading with compact date: stored -> incoming pairs.
  • Preserves every date, token count, and millisecond value without alteration or loss.
  • Warnings with fewer than 4 items and unrecognized messages remain uncompacted and are emitted verbatim.
  • Server-side accounting, high-water mark protection, and merge logic are untouched.

Closes #1593

Evidence

  • Unit tests in crates/tokscale-cli/src/submission_warnings.rs verify compaction for disappeared clients, active-time decreases, short groups (< 4), invalid dates/values, and mixed warning lists preserving relative order.
  • CLI integration test test_submit_compacts_missing_client_and_active_time_preservation_warnings in crates/tokscale-cli/tests/cli_tests.rs tests synthetic HTTP submit response containing mixed warnings.
  • cargo fmt --check passes.
  • cargo clippy --locked -p tokscale-cli --all-features --all-targets -- -D warnings passes without warnings.
  • cargo test -p tokscale-cli --bin tokscale passes (1,764 passed, 1 ignored).
  • TZ=UTC cargo test -p tokscale-cli --test cli_tests passes (221 passed).

Summary by cubic

Extends submit warning compaction to also group missing-client and active-time preservation warnings alongside daily token decreases. Closes #1593.

When 4 or more warnings of the same kind occur, they're now compressed into a single heading with date: kept or date: stored -> incoming details. Groups under 4 items and unrecognized messages are still printed verbatim. All dates, token counts, and millisecond values are preserved; server-side accounting, high-water mark protection, and merge logic are untouched.