Skip to content

fix: preserve native login identity and resume automatic renewal - #31

Open
iiijiashu wants to merge 1 commit into
pjpv:mainfrom
iiijiashu:fix/native-login-renewal
Open

iiijiashu wants to merge 1 commit into
pjpv:mainfrom
iiijiashu:fix/native-login-renewal

Conversation

@iiijiashu

@iiijiashu iiijiashu commented Oct 1, 2026 •

Copy link
Copy Markdown

Switching accounts currently overwrites ZCode's installation device MID and RUM identity/session. It also generates a new device identity for OAuth. Preserve native state during cold, hot and already-active restores, read the current installation MID without caching, and reject explicitly expired saved JWTs before stopping ZCode or writing login files.

Renewal must retain the existing saved-login claim context: a limited read-only comparison of expired snapshots returned no eligibility with the installation MID but an available plan with the existing saved MID. Preview, activation and submission now use that same context without generating an identity or writing it into ZCode. Native captures/OAuth record the actual MID used, token archival retains the saved context, and encrypted bundles preserve the optional context while accepting older bundles.

Automatic claiming now resumes from the persisted enabled setting, retains due work while another operation is busy, runs serially and schedules its next round after completion. Closing the toggle immediately cancels future work. Each claim registers its waiter before verification starts and carries one request ID through submit/result/cancel/window-close; stale events cannot consume another attempt. Automatic interactive verification synchronously stops late SDK success callbacks before cancellation. SDK configuration is installed before loading, setup failures are bounded, and empty quota/failed eligibility are shown distinctly.

Validation on a clean branch based on upstream main:

  • 29 Node regressions for scheduling, toggle operations, request receipts and actual CAPTCHA renderer callbacks.
  • 6 Rust tests for native/saved device context, bundle round trips and pending claim ownership.
  • 6 isolated synthetic CLI checks on the optimized Windows executable for restore, already-active token sync, missing telemetry, expired snapshots, unsaved account preservation and token archival.
  • Production desktop build, 199 bilingual i18n keys, and diff whitespace checks pass.
  • Final clean executable queried all five saved accounts successfully; each has positive quota and no additional eligible plan. One earlier preview request hit a transient TLS EOF; a bounded recheck succeeded for all five.
  • The installed build (which retains the user's separately existing keepalive feature) restored enabled auto claim and completed a round without toggling. Earlier real renewal succeeded after the user toggled auto claim and restored quota for all five accounts; that observation is not treated as proof of the old scheduler.

The user confirmed on 2026-10-02 that the updated application runs normally and requested submission for review. This PR excludes the separate keepalive and refresh-performance work. That confirmation does not separately establish elimination of service-side 3012, hot reload, new OAuth authorization or the next eligible renewal window; those remain external acceptance boundaries.

@iiijiashu
iiijiashu marked this pull request as ready for review October 2, 2026 04:48
Copilot AI balanced review requested due to automatic review settings October 2, 2026 04:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants