fix(templates): handle unlimited traffic limit in trafficLeft#185
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Greptile SummaryThis PR fixes a display bug in the
Confidence Score: 4/5Safe to merge — the unlimited-traffic crash is fixed. The remaining gap (no clamp when used bytes exceed limit for non-unlimited users) is unlikely in normal operation but worth addressing. The unlimited-traffic fix is correct. The non-unlimited subtraction can still return a negative src/common/utils/templates/replace-templates-values.ts — specifically the non-unlimited branch of Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[trafficLeft called] --> B{trafficLimitBytes === 0n?}
B -- Yes\nUnlimited --> C[return 0n]
B -- No\nLimited --> D[trafficLimitBytes - usedTrafficBytes]
D --> E{result < 0n?}
E -- Yes\nover-limit --> F[⚠ returns negative bigint\ncurrent behaviour]
E -- No --> G[return positive bigint]
G --> H[prettyBytesUtil formats value]
C --> H
Reviews (1): Last reviewed commit: "fix(templates): handle unlimited traffic..." | Re-trigger Greptile |
No description provided.