[PR #6524] [MERGED] feat(clients): add calendar weekly renewal and schedule previews #6333

Closed
opened 2026-11-02 04:08:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6524
Author: @JacktheRanger
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @MHSanaei

Base: main ← Head: codex/client-calendar-weekly-renewal


📝 Commits (9)

  • 5baf87c feat(clients): add calendar weekly renewal and schedule previews
  • 298f865 fix(clients): validate renewal schedules across inbound write paths
  • 17a1764 docs(clients): clarify depleted-client deletion risks on downgrade
  • c9c7277 fix(clients): bound weekly renewal date searches
  • 21df360 fix(tests): isolate weekly renewal preview timezone
  • cf3d493 Merge branch 'main' into codex/client-calendar-weekly-renewal
  • 39b6616 ci: retrigger PR checks
  • 56f9707 ci: retry PR checks and record deferred download hardening
  • 9f2f6d7 Merge branch 'main' into codex/client-calendar-weekly-renewal

📊 Changes

58 files changed (+2712 additions, -197 deletions)

View changed files

📝 .github/workflows/ci.yml (+5 -5)
📝 docs/content/docs/en/config/clients.mdx (+63 -1)
📝 docs/content/docs/en/reference/api/clients.mdx (+16 -1)
📝 docs/content/docs/zh/config/clients.mdx (+53 -1)
📝 docs/public/openapi.json (+210 -2)
📝 frontend/public/openapi.json (+210 -2)
📝 frontend/src/generated/examples.ts (+25 -0)
📝 frontend/src/generated/schemas.ts (+113 -2)
📝 frontend/src/generated/types.ts (+25 -0)
📝 frontend/src/generated/zod.ts (+27 -0)
📝 frontend/src/hooks/useClients.ts (+1 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+46 -0)
📝 frontend/src/pages/clients/ClientBulkAddModal.tsx (+10 -26)
📝 frontend/src/pages/clients/ClientFormModal.tsx (+16 -29)
➕ frontend/src/pages/clients/ClientRenewalFields.tsx (+197 -0)
📝 frontend/src/schemas/client.ts (+3 -0)
➕ frontend/src/test/client-bulk-calendar-renewal.test.tsx (+113 -0)
➕ frontend/src/test/client-calendar-renewal.test.tsx (+109 -0)
📝 frontend/src/test/client-toggle-traffic-reset.test.tsx (+20 -2)
➕ internal/database/client_weekly_renew_migration_test.go (+90 -0)

...and 38 more files

📄 Description

Motivation

#6517 handles month-end subscription-header presentation, but presentation is not an automatic-renewal schedule. Clients also need an explicit calendar-weekly option: a fixed seven-day interval is 168 hours and can move away from local midnight across DST. This follows the calendar/no-drift motivation of #6106 while preserving the billing-alignment behavior from #6457.

User-facing behavior

  • One shared selector in individual and bulk-create forms: Disabled, Fixed interval (days), Calendar weekly, and the existing Calendar monthly.
  • Weekly renewal selects Monday (1) through Sunday (7) in the panel timezone. It uses the first valid instant of that local date when midnight is skipped or repeated; an entirely skipped date advances to the next matching week, not another weekday.
  • Existing fixed-day intervals remain exactly N × 24 hours. Existing monthly day 1–31 clamping/restoration and monthly precedence over a legacy reset value are unchanged. Weekly mode cannot be combined with a positive reset or resetDay.
  • Mode changes clear the competing schedule fields, but do not rewrite an existing expiry or reset the consumed-renewal counter. New clients default to renewal disabled. Without an expiry, the form offers an explicit first-calendar-cutoff button; selecting a mode alone does not activate it. First-use clients retain their initial duration.
  • A debounced server-backed preview shows the panel timezone, renewal boundary, actual last valid second, next expiry, and allowances needed. Legacy last-second cutoffs retain free billing alignment, but the preview does not pretend the stored exclusive expiry has been changed. For full-month validity, use monthly day 1 and the next month's first midnight; day 31 is not that boundary.
  • The existing writer still charges each advanced period, including offline catch-up, once per client rather than per inbound. Remaining caps that cannot reach a future expiry do not restore traffic or service; operator-disabled client settings stay disabled.

Implementation

  • Add resetWeekday / reset_weekday to client settings, client records, and traffic records. AutoMigrate plus an idempotent NULL backfill defaults old clients to weekly renewal disabled while retaining existing limits, counters, and dates.
  • Carry the field through CRUD, bulk/import validation, projections and auto-renew filters, enable-toggle payloads, inbound settings, depleted-client protection, and node traffic reconciliation. Preserve the renewal cap/count when initially adopting node traffic.
  • Share the existing billing alignment and catch-up calculation between the renewal writer and authenticated POST /panel/api/clients/renewalPreview; reuse the existing job, without a second scheduler.
  • Regenerate Go-derived contracts/OpenAPI and the production API reference. Add the PostgreSQL regression to the existing live CI job with a top-level PASS count so skipped subtests cannot satisfy the gate.
  • Add all new keys in every locale, with English and Simplified/Traditional Chinese copy; the other locales use English for these new messages pending native translations. Weekday names use the selected UI locale.

Review follow-up (three separate commits)

  • 298f865 — validate renewal schedules on inbound add/update, imported traffic snapshots, one-client inbound applies, client/link synchronization, and traffic metadata writes. Weekly-related duplicate-record merges now select the entire schedule tuple, including zeroes, by the existing timestamp policy; empty migration snapshots and legacy non-weekly merging retain their behavior. This fixes the reproduced client-toggle rejection after saving conflicting renewal fields through the inbound API.
  • 17a1764 — document that older binaries can delete depleted weekly-only clients during cleanup, not merely stop renewal. Back up, convert to a mode supported by all participating versions, and avoid cleanup during a mixed-version rollback; simply disabling weekly renewal is not deletion protection.
  • c9c7277 — bound weekly date search to eight candidates. Exhaustion keeps the original expiry and consumes no allowances or traffic reset; the preview reports a search error when it cannot advance despite remaining allowances, instead of suggesting an expired cutoff or blaming the cap. A synthetic valid TZif with twelve absent Sundays exercises exhaustion; this is fault injection, not a reproduced production-IANA hang.

Inbound write paths now reject invalid day/weekday combinations consistently with the client API; invalid imports must be corrected rather than silently coerced. Existing reset + resetDay monthly precedence remains accepted. No new schema, route, dependency, job, telemetry, or automatic deadline conversion is added by these follow-ups.

CI race fix

21df360 fixes the test isolation failure reported by the CI race job on c9c7277. The new exhaustion test temporarily replaced time.Local, racing with background timer reads through time.Now; restoring the variable in cleanup was also unsafe. The earlier local race run passed but did not eliminate this scheduling-dependent failure.

The public service still validates requests and resolves the panel timezone, then delegates its unchanged preview calculation with explicit timezone/current-instant arguments. The regression now passes the synthetic timezone locally, uses fixed dates for both suggestion and catch-up exhaustion, and needs no database setup or global timezone writes. A bounded-lifetime background clock reader reproduced the old race before the fix and remains in the test to catch future global mutations. API contracts, renewal behavior, persistence, and privacy are unchanged. The existing race job is retained without workflow changes.

Validation

Run locally with Go 1.27.1, Node 24.19.0, and a temporary PostgreSQL 17.10 instance; no production services or databases were used.

  • make verify — passed on the CI-isolation fix 21df360: generated-file freshness, Go/frontend lint, formatting, typecheck, shuffled uncached Go tests, MSW-worker consistency, frontend/Chromium Storybook tests (156 files / 1,525 tests), production frontend/Go build, and Storybook build.
  • make race — passed on the CI-isolation fix 21df360: the full shuffled, uncached Go suite with the race detector and a 25-minute timeout.
  • GODEBUG=tlsmlkem=0,http2client=0 gh run watch 34854598284 --repo MHSanaei/3x-ui --interval 45 --exit-status — exited successfully after the remote CI run on 21df360 completed. All eight jobs passed, including the full race suite (15m 3s), Go tests, PostgreSQL 16 durable-first/schema/migration checks, frontend, code generation, lint, fuzz smoke, and vulnerability scanning.
  • GODEBUG=tlsmlkem=0,http2client=0 gh pr checks 6524 --repo MHSanaei/3x-ui — passed on 21df360; all non-skipped checks succeeded, including CodeQL, documentation, and multi-platform builds. Rolling dev-release publishing is intentionally skipped for the pull request; no release or merge was performed.
  • Independent fresh component-test runs (from frontend/) passed:
    • npx vitest run src/test/client-calendar-renewal.test.tsx --project components — 1 test.
    • npx vitest run src/test/client-bulk-calendar-renewal.test.tsx --project components — 1 test.
    • npx vitest run src/test/client-toggle-traffic-reset.test.tsx --project components — 2 tests.
  • Review regressions: GIN_MODE=release go test ./internal/database/model ./internal/web/service ./internal/web/controller -run '^Test(MergeClientRecordRenewalModes|ClientRenewalWriteValidation|InboundRenewalModesRemainEditable|WeeklyRenewalSearchFailsClosed|NextWeeklyRenewal.*|ClientRenewalPreviewHTTP|ClientWeeklyRenewCRUD)$' -count=1 — passed. Covers 27 rejected cases over nine write paths, 10 duplicate-record merge cases, valid inbound clients remaining toggleable, weekly search exhaustion and preview error handling, and the existing weekly/CRUD/HTTP cases. The write/merge regressions were red before their fix; exhaustion and incorrect preview failure reporting were also observed red before their respective guards.
  • GIN_MODE=release go test -race ./internal/web/service -run '^TestWeeklyRenewalSearchFailsClosed$' -count=1 — observed failing with concurrent clock reads before removing the global timezone writes; the report identified both assignment and cleanup races.
  • GIN_MODE=release go test -race ./internal/web/service -run '^TestWeeklyRenewalSearchFailsClosed$' -count=100 — passed after the fix, with the background clock reader active and explicit local timezone/current-instant arguments.
  • GIN_MODE=release go test -race ./internal/web/service ./internal/web/controller -run '^Test(WeeklyRenewalSearchFailsClosed|NextWeeklyRenewal.*|ClientRenewalPreviewHTTP|ClientWeeklyRenewCRUD)$' -shuffle=1789394141536984216 -count=1 — passed on the CI-isolation fix, reusing the failed CI run's shuffle seed for these targeted cases.
  • The database, documentation, fuzz, and vulnerability-check results below were last collected on c9c7277; the subsequent CI-isolation fix only changes the preview calculation boundary and its test, with no database, documentation-source, parser, or dependency changes.
  • With XUI_DB_TYPE=postgres and XUI_DB_DSN='host=127.0.0.1 port=55463 user=postgres dbname=xui_weekly_test sslmode=disable':
    • go test ./internal/database -run '^(TestHostAutoMigrateCreatesColumns_Postgres|TestMigrate_Postgres|TestClientWeeklyRenewMigration_Postgres)$' -count=1 -v — all 3 top-level tests passed, including missing and nullable weekday-column upgrades in isolated schemas.
    • go test ./internal/web/service -run 'PostgresCommitFailure' -count=1 -v — 2 tests passed, not skipped.
  • From docs/: pnpm gen:api; pnpm typecheck && pnpm lint && pnpm format:check && pnpm test — passed, 12 files / 106 tests. The typecheck/lint/format/test chain was rerun after the downgrade wording change. cmp frontend/public/openapi.json docs/public/openapi.json confirms the published specification matches.
  • go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s -parallel=2 ./internal/util/link/ and go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s -parallel=2 ./internal/web/runtime/ — both passed.
  • GODEBUG=tlsmlkem=0 GOPROXY=https://goproxy.io,direct make vulncheck — passed, 0 reachable vulnerabilities. The verbose scan reports the existing, unimported openpgp module advisory GO-2026-5932; no dependency changes are included. These overrides were only for the local checker after TLS-handshake timeouts, not application settings.

Regressions cover real renewal writes/shared inbounds, finite and unlimited catch-up, manual disable, node renewal adoption, CRUD/filter/purge behavior, read-only HTTP preview and invalid requests, DST/skipped dates, monthly clamping/leap February, legacy last-second allowance accounting, form payloads, unset cutoffs, and first-use duration preservation. Weekly renewal, node adoption, and skipped-date tests were observed failing before their respective fixes.

Initial feature-validation attempts running verify/race in parallel collided on the network tests' fixed ports. Final follow-up runs were staggered so their Go network tests did not overlap, without changing those tests.

The first local make verify attempt for the CI-isolation fix failed in the unchanged Discord test TestGatewayRequestedHeartbeatDoesNotRaceTicker with a connection reset during its heartbeat flood; the renewal/service package passed. GIN_MODE=release go test ./internal/web/service/discord -run '^TestGatewayRequestedHeartbeatDoesNotRaceTicker$' -shuffle=1789395109532532000 -count=20 then passed, followed by a successful complete make verify rerun. The CI run on c9c7277 passed this package too. No Discord source, assertions, or CI configuration was changed.

Compatibility, privacy, and scope

Upgrade the main panel and every participating node before enabling weekly mode. Older binaries ignore resetWeekday, so weekly-only schedules would not renew and can be deleted by depleted-client cleanup after expiry or quota exhaustion. Back up the database and convert them to a mode supported by every participating version before downgrading; merely disabling weekly renewal does not protect depleted clients. Avoid cleanup while mixed versions or unconverted schedules remain. There is no automatic conversion of existing deadlines or renewal modes.

The preview is authenticated and read-only. It sends only expiry/schedule/cap/count numbers to the panel, not client emails or credentials, and does not reserve allowances, mutate traffic, activate clients, or guarantee node availability. No external service, new telemetry, or new runtime dependency is introduced.

Independent periodic traffic-reset scheduling is unchanged and does not move expiry; renewal already resets traffic, so the form explains keeping the independent cycle disabled unless an extra reset is intended. The optional month-end subscription-header setting is unchanged. Quarterly, yearly, every-N-week/month schedules, and a linked quota-reset mode are intentionally left out. No live Xray/node deployment or client-app end-to-end run was performed; node reconciliation is covered with traffic snapshots. PostgreSQL 16 coverage remains for the existing upstream CI job.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6524 **Author:** [@JacktheRanger](https://github.com/JacktheRanger) **Created:** 9/14/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `codex/client-calendar-weekly-renewal` --- ### 📝 Commits (9) - [`5baf87c`](https://github.com/MHSanaei/3x-ui/commit/5baf87c291ae9ec0e0ed34f0b387f19bae78349b) feat(clients): add calendar weekly renewal and schedule previews - [`298f865`](https://github.com/MHSanaei/3x-ui/commit/298f8656e07efecbe6d3e1db94b8f2238726e75b) fix(clients): validate renewal schedules across inbound write paths - [`17a1764`](https://github.com/MHSanaei/3x-ui/commit/17a1764992847c7e1d1c83fd7f340464ed8b1c3f) docs(clients): clarify depleted-client deletion risks on downgrade - [`c9c7277`](https://github.com/MHSanaei/3x-ui/commit/c9c72774011456463ab6e4b9718b964742485c29) fix(clients): bound weekly renewal date searches - [`21df360`](https://github.com/MHSanaei/3x-ui/commit/21df3600a102a508644391a2d9b987c6747dd78b) fix(tests): isolate weekly renewal preview timezone - [`cf3d493`](https://github.com/MHSanaei/3x-ui/commit/cf3d4932a77635d3975d090dba8b862f7cf4417a) Merge branch 'main' into codex/client-calendar-weekly-renewal - [`39b6616`](https://github.com/MHSanaei/3x-ui/commit/39b6616f78d7f2dcf9042cd55beedd792cdc8db3) ci: retrigger PR checks - [`56f9707`](https://github.com/MHSanaei/3x-ui/commit/56f9707559ca375848da9f3003072ceaadc9a2e8) ci: retry PR checks and record deferred download hardening - [`9f2f6d7`](https://github.com/MHSanaei/3x-ui/commit/9f2f6d73e0c21768cc6e934bef9e3370a207ab84) Merge branch 'main' into codex/client-calendar-weekly-renewal ### 📊 Changes **58 files changed** (+2712 additions, -197 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+5 -5) 📝 `docs/content/docs/en/config/clients.mdx` (+63 -1) 📝 `docs/content/docs/en/reference/api/clients.mdx` (+16 -1) 📝 `docs/content/docs/zh/config/clients.mdx` (+53 -1) 📝 `docs/public/openapi.json` (+210 -2) 📝 `frontend/public/openapi.json` (+210 -2) 📝 `frontend/src/generated/examples.ts` (+25 -0) 📝 `frontend/src/generated/schemas.ts` (+113 -2) 📝 `frontend/src/generated/types.ts` (+25 -0) 📝 `frontend/src/generated/zod.ts` (+27 -0) 📝 `frontend/src/hooks/useClients.ts` (+1 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+46 -0) 📝 `frontend/src/pages/clients/ClientBulkAddModal.tsx` (+10 -26) 📝 `frontend/src/pages/clients/ClientFormModal.tsx` (+16 -29) ➕ `frontend/src/pages/clients/ClientRenewalFields.tsx` (+197 -0) 📝 `frontend/src/schemas/client.ts` (+3 -0) ➕ `frontend/src/test/client-bulk-calendar-renewal.test.tsx` (+113 -0) ➕ `frontend/src/test/client-calendar-renewal.test.tsx` (+109 -0) 📝 `frontend/src/test/client-toggle-traffic-reset.test.tsx` (+20 -2) ➕ `internal/database/client_weekly_renew_migration_test.go` (+90 -0) _...and 38 more files_ </details> ### 📄 Description ## Motivation #6517 handles month-end subscription-header presentation, but presentation is not an automatic-renewal schedule. Clients also need an explicit calendar-weekly option: a fixed seven-day interval is 168 hours and can move away from local midnight across DST. This follows the calendar/no-drift motivation of #6106 while preserving the billing-alignment behavior from #6457. ## User-facing behavior - One shared selector in individual and bulk-create forms: **Disabled**, **Fixed interval (days)**, **Calendar weekly**, and the existing **Calendar monthly**. - Weekly renewal selects Monday (1) through Sunday (7) in the panel timezone. It uses the first valid instant of that local date when midnight is skipped or repeated; an entirely skipped date advances to the next matching week, not another weekday. - Existing fixed-day intervals remain exactly N × 24 hours. Existing monthly day 1–31 clamping/restoration and monthly precedence over a legacy `reset` value are unchanged. Weekly mode cannot be combined with a positive `reset` or `resetDay`. - Mode changes clear the competing schedule fields, but do not rewrite an existing expiry or reset the consumed-renewal counter. New clients default to renewal disabled. Without an expiry, the form offers an **explicit** first-calendar-cutoff button; selecting a mode alone does not activate it. First-use clients retain their initial duration. - A debounced server-backed preview shows the panel timezone, renewal boundary, actual last valid second, next expiry, and allowances needed. Legacy last-second cutoffs retain free billing alignment, but the preview does not pretend the stored exclusive expiry has been changed. For full-month validity, use monthly day 1 and the next month's first midnight; day 31 is not that boundary. - The existing writer still charges each advanced period, including offline catch-up, once per client rather than per inbound. Remaining caps that cannot reach a future expiry do not restore traffic or service; operator-disabled client settings stay disabled. ## Implementation - Add `resetWeekday` / `reset_weekday` to client settings, client records, and traffic records. AutoMigrate plus an idempotent NULL backfill defaults old clients to weekly renewal disabled while retaining existing limits, counters, and dates. - Carry the field through CRUD, bulk/import validation, projections and auto-renew filters, enable-toggle payloads, inbound settings, depleted-client protection, and node traffic reconciliation. Preserve the renewal cap/count when initially adopting node traffic. - Share the existing billing alignment and catch-up calculation between the renewal writer and authenticated `POST /panel/api/clients/renewalPreview`; reuse the existing job, without a second scheduler. - Regenerate Go-derived contracts/OpenAPI and the production API reference. Add the PostgreSQL regression to the existing live CI job with a top-level PASS count so skipped subtests cannot satisfy the gate. - Add all new keys in every locale, with English and Simplified/Traditional Chinese copy; the other locales use English for these new messages pending native translations. Weekday names use the selected UI locale. ## Review follow-up (three separate commits) - [298f865](https://github.com/JacktheRanger/3x-ui/commit/298f8656e07efecbe6d3e1db94b8f2238726e75b) — validate renewal schedules on inbound add/update, imported traffic snapshots, one-client inbound applies, client/link synchronization, and traffic metadata writes. Weekly-related duplicate-record merges now select the entire schedule tuple, including zeroes, by the existing timestamp policy; empty migration snapshots and legacy non-weekly merging retain their behavior. This fixes the reproduced client-toggle rejection after saving conflicting renewal fields through the inbound API. - [17a1764](https://github.com/JacktheRanger/3x-ui/commit/17a1764992847c7e1d1c83fd7f340464ed8b1c3f) — document that older binaries can delete depleted weekly-only clients during cleanup, not merely stop renewal. Back up, convert to a mode supported by all participating versions, and avoid cleanup during a mixed-version rollback; simply disabling weekly renewal is not deletion protection. - [c9c7277](https://github.com/JacktheRanger/3x-ui/commit/c9c72774011456463ab6e4b9718b964742485c29) — bound weekly date search to eight candidates. Exhaustion keeps the original expiry and consumes no allowances or traffic reset; the preview reports a search error when it cannot advance despite remaining allowances, instead of suggesting an expired cutoff or blaming the cap. A synthetic valid TZif with twelve absent Sundays exercises exhaustion; this is fault injection, not a reproduced production-IANA hang. Inbound write paths now reject invalid day/weekday combinations consistently with the client API; invalid imports must be corrected rather than silently coerced. Existing `reset` + `resetDay` monthly precedence remains accepted. No new schema, route, dependency, job, telemetry, or automatic deadline conversion is added by these follow-ups. ## CI race fix [21df360](https://github.com/JacktheRanger/3x-ui/commit/21df3600a102a508644391a2d9b987c6747dd78b) fixes the test isolation failure reported by the [CI race job on `c9c7277`](https://github.com/MHSanaei/3x-ui/actions/runs/34851914672/job/104001716723). The new exhaustion test temporarily replaced `time.Local`, racing with background timer reads through `time.Now`; restoring the variable in cleanup was also unsafe. The earlier local race run passed but did not eliminate this scheduling-dependent failure. The public service still validates requests and resolves the panel timezone, then delegates its unchanged preview calculation with explicit timezone/current-instant arguments. The regression now passes the synthetic timezone locally, uses fixed dates for both suggestion and catch-up exhaustion, and needs no database setup or global timezone writes. A bounded-lifetime background clock reader reproduced the old race before the fix and remains in the test to catch future global mutations. API contracts, renewal behavior, persistence, and privacy are unchanged. The existing race job is retained without workflow changes. ## Validation Run locally with Go 1.27.1, Node 24.19.0, and a temporary PostgreSQL 17.10 instance; no production services or databases were used. - `make verify` — passed on the CI-isolation fix `21df360`: generated-file freshness, Go/frontend lint, formatting, typecheck, shuffled uncached Go tests, MSW-worker consistency, frontend/Chromium Storybook tests (**156 files / 1,525 tests**), production frontend/Go build, and Storybook build. - `make race` — passed on the CI-isolation fix `21df360`: the full shuffled, uncached Go suite with the race detector and a 25-minute timeout. - `GODEBUG=tlsmlkem=0,http2client=0 gh run watch 34854598284 --repo MHSanaei/3x-ui --interval 45 --exit-status` — exited successfully after the [remote CI run on `21df360`](https://github.com/MHSanaei/3x-ui/actions/runs/34854598284) completed. All eight jobs passed, including the full race suite (**15m 3s**), Go tests, PostgreSQL 16 durable-first/schema/migration checks, frontend, code generation, lint, fuzz smoke, and vulnerability scanning. - `GODEBUG=tlsmlkem=0,http2client=0 gh pr checks 6524 --repo MHSanaei/3x-ui` — passed on `21df360`; all non-skipped checks succeeded, including CodeQL, documentation, and multi-platform builds. Rolling dev-release publishing is intentionally skipped for the pull request; no release or merge was performed. - Independent fresh component-test runs (from `frontend/`) passed: - `npx vitest run src/test/client-calendar-renewal.test.tsx --project components` — 1 test. - `npx vitest run src/test/client-bulk-calendar-renewal.test.tsx --project components` — 1 test. - `npx vitest run src/test/client-toggle-traffic-reset.test.tsx --project components` — 2 tests. - Review regressions: `GIN_MODE=release go test ./internal/database/model ./internal/web/service ./internal/web/controller -run '^Test(MergeClientRecordRenewalModes|ClientRenewalWriteValidation|InboundRenewalModesRemainEditable|WeeklyRenewalSearchFailsClosed|NextWeeklyRenewal.*|ClientRenewalPreviewHTTP|ClientWeeklyRenewCRUD)$' -count=1` — passed. Covers 27 rejected cases over nine write paths, 10 duplicate-record merge cases, valid inbound clients remaining toggleable, weekly search exhaustion and preview error handling, and the existing weekly/CRUD/HTTP cases. The write/merge regressions were red before their fix; exhaustion and incorrect preview failure reporting were also observed red before their respective guards. - `GIN_MODE=release go test -race ./internal/web/service -run '^TestWeeklyRenewalSearchFailsClosed$' -count=1` — observed failing with concurrent clock reads before removing the global timezone writes; the report identified both assignment and cleanup races. - `GIN_MODE=release go test -race ./internal/web/service -run '^TestWeeklyRenewalSearchFailsClosed$' -count=100` — passed after the fix, with the background clock reader active and explicit local timezone/current-instant arguments. - `GIN_MODE=release go test -race ./internal/web/service ./internal/web/controller -run '^Test(WeeklyRenewalSearchFailsClosed|NextWeeklyRenewal.*|ClientRenewalPreviewHTTP|ClientWeeklyRenewCRUD)$' -shuffle=1789394141536984216 -count=1` — passed on the CI-isolation fix, reusing the failed CI run's shuffle seed for these targeted cases. - The database, documentation, fuzz, and vulnerability-check results below were last collected on `c9c7277`; the subsequent CI-isolation fix only changes the preview calculation boundary and its test, with no database, documentation-source, parser, or dependency changes. - With `XUI_DB_TYPE=postgres` and `XUI_DB_DSN='host=127.0.0.1 port=55463 user=postgres dbname=xui_weekly_test sslmode=disable'`: - `go test ./internal/database -run '^(TestHostAutoMigrateCreatesColumns_Postgres|TestMigrate_Postgres|TestClientWeeklyRenewMigration_Postgres)$' -count=1 -v` — all 3 top-level tests passed, including missing and nullable weekday-column upgrades in isolated schemas. - `go test ./internal/web/service -run 'PostgresCommitFailure' -count=1 -v` — 2 tests passed, not skipped. - From `docs/`: `pnpm gen:api`; `pnpm typecheck && pnpm lint && pnpm format:check && pnpm test` — passed, **12 files / 106 tests**. The typecheck/lint/format/test chain was rerun after the downgrade wording change. `cmp frontend/public/openapi.json docs/public/openapi.json` confirms the published specification matches. - `go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s -parallel=2 ./internal/util/link/` and `go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s -parallel=2 ./internal/web/runtime/` — both passed. - `GODEBUG=tlsmlkem=0 GOPROXY=https://goproxy.io,direct make vulncheck` — passed, **0 reachable vulnerabilities**. The verbose scan reports the existing, unimported `openpgp` module advisory GO-2026-5932; no dependency changes are included. These overrides were only for the local checker after TLS-handshake timeouts, not application settings. Regressions cover real renewal writes/shared inbounds, finite and unlimited catch-up, manual disable, node renewal adoption, CRUD/filter/purge behavior, read-only HTTP preview and invalid requests, DST/skipped dates, monthly clamping/leap February, legacy last-second allowance accounting, form payloads, unset cutoffs, and first-use duration preservation. Weekly renewal, node adoption, and skipped-date tests were observed failing before their respective fixes. Initial feature-validation attempts running verify/race in parallel collided on the network tests' fixed ports. Final follow-up runs were staggered so their Go network tests did not overlap, without changing those tests. The first local `make verify` attempt for the CI-isolation fix failed in the unchanged Discord test `TestGatewayRequestedHeartbeatDoesNotRaceTicker` with a connection reset during its heartbeat flood; the renewal/service package passed. `GIN_MODE=release go test ./internal/web/service/discord -run '^TestGatewayRequestedHeartbeatDoesNotRaceTicker$' -shuffle=1789395109532532000 -count=20` then passed, followed by a successful complete `make verify` rerun. The CI run on `c9c7277` passed this package too. No Discord source, assertions, or CI configuration was changed. ## Compatibility, privacy, and scope Upgrade the main panel **and every participating node** before enabling weekly mode. Older binaries ignore `resetWeekday`, so weekly-only schedules would not renew and can be deleted by depleted-client cleanup after expiry or quota exhaustion. Back up the database and convert them to a mode supported by every participating version before downgrading; merely disabling weekly renewal does not protect depleted clients. Avoid cleanup while mixed versions or unconverted schedules remain. There is no automatic conversion of existing deadlines or renewal modes. The preview is authenticated and read-only. It sends only expiry/schedule/cap/count numbers to the panel, not client emails or credentials, and does not reserve allowances, mutate traffic, activate clients, or guarantee node availability. No external service, new telemetry, or new runtime dependency is introduced. Independent periodic traffic-reset scheduling is unchanged and does not move expiry; renewal already resets traffic, so the form explains keeping the independent cycle disabled unless an extra reset is intended. The optional month-end subscription-header setting is unchanged. Quarterly, yearly, every-N-week/month schedules, and a linked quota-reset mode are intentionally left out. No live Xray/node deployment or client-app end-to-end run was performed; node reconciliation is covered with traffic snapshots. PostgreSQL 16 coverage remains for the existing upstream CI job. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:01 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6333
No description provided.