Skip to content

fix: cache nowSeconds() and handle negative BigInt in format functions - #89

Open
Sertug17 wants to merge 1 commit into
tempoxyz:mainfrom
Sertug17:fix/session-and-format-bugs
Open

Sertug17 wants to merge 1 commit into
tempoxyz:mainfrom
Sertug17:fix/session-and-format-bugs

Conversation

@Sertug17

Copy link
Copy Markdown

Summary

Changes

  • src/commands/sessions.ts: Cache nowSeconds() in a local variable before the ternary, matching the pattern already used in closeOneSession
  • src/shared/utils.ts: Extract absolute value before division/remainder, prepend - prefix for negative inputs

- Cache nowSeconds() in sessionItem to prevent TOCTOU race producing negative remaining_secs
- Handle negative BigInt values in formatTokenUnits and formatCreditBalance

Fixes tempoxyz#87
Fixes tempoxyz#88

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant