mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-04 16:34:52 +03:00
fix(nodes): prevent quota overflow in fleet counts (#7323)
Complete the remaining correctness work for #7319 on top of the SQL fleet aggregation introduced by #7342. Replace the overflowing BIGINT upload-plus-download quota comparison in countNodeFleet with a guarded subtraction-based CASE. Preserve depletion precedence, unlimited quotas, missing traffic behavior, email-based traffic attribution, host deduplication, exclusion of orphan memberships, and database error propagation. Add regression coverage for signed int64 limits, negative counters, unlimited quotas and orphan memberships. Require both fleet regression tests to execute and pass in PostgreSQL CI without weakening existing checks. Validation: reviewed head e9b344a63bdf6aa945f0e4f6b3cbe933a416fabe; all 12 CI jobs passed, including both PostgreSQL fleet tests and all seven quota subcases. Independent arithmetic comparison over 1,331 boundary combinations found zero mismatches. See https://github.com/MHSanaei/3x-ui/pull/7323#issuecomment-7388723297. The green CI is for the reviewed PR head, not a fresh post-merge run. Closes #7319.
This commit is contained in:
@@ -358,6 +358,13 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: PostgreSQL node fleet count regressions
|
||||
run: |
|
||||
set -o pipefail
|
||||
go test ./internal/web/service -run '^TestNode(FleetQuotaClassificationAtInt64Limits|OverviewCountsHostMembershipsAndUniqueFleetClients)$' -count=1 -v | tee /tmp/postgres-node-fleet.log
|
||||
grep -q '^--- PASS: TestNodeFleetQuotaClassificationAtInt64Limits ' /tmp/postgres-node-fleet.log
|
||||
grep -q '^--- PASS: TestNodeOverviewCountsHostMembershipsAndUniqueFleetClients ' /tmp/postgres-node-fleet.log
|
||||
|
||||
- name: PostgreSQL schema and migration tests
|
||||
run: |
|
||||
set -o pipefail
|
||||
|
||||
Reference in New Issue
Block a user