Skip to content

test(auth): verify recovery after exhausted rate-limit retries - #1

Open
yifei-ambr wants to merge 1 commit into
YingzuoLiu:fix/refresh-rate-limit-backofffrom
yifei-ambr:test/auth-429-upstream-quality-20261109
Open

yifei-ambr wants to merge 1 commit into
YingzuoLiu:fix/refresh-rate-limit-backofffrom
yifei-ambr:test/auth-429-upstream-quality-20261109

Conversation

@yifei-ambr

Copy link
Copy Markdown

Summary

Add a regression for a login recovering on the next token lookup after its previous lookup exhausted both HTTP 429 retries. This contributes directly to the branch behind larksuite#2881; it changes no production behavior.

Changes

  • Use the existing isolated credential store and scripted HTTP transport to return a plain-text 429 followed by a JSON 429.
  • Assert the first lookup returns a retryable api/rate_limit with code 429, makes exactly two requests, retains the original refresh credential and grant metadata, and does not request authorization.
  • Create a fresh HTTP client/options for the next lookup. Assert it reads the retained login, succeeds with one request, and persists the rotated refresh credential while preserving the original grant and scopes.

The existing tests cover retry exhaustion and success within one lookup separately. This covers recovery after the exhausted lookup has returned, including reuse of persisted state and release of the account lock. It is an in-process lookup test, not a claim of separate-process or live-endpoint coverage. The UTC fixture correction from the review suggestion is already in the base (f6eaf122) and is not duplicated here.

Test Plan

  • New regression passes with -race against the locally deployed v1.0.98 backport.
  • Negative control: replace the implementation with the unpatched v1.0.98 source via a Go overlay; the same regression fails with authentication/token_missing instead of api/rate_limit.
  • Auth, credential, identity diagnostics and auth command tests pass in the complete suite.
  • make vet, make fmt-check, make build, git diff --check.
  • go mod tidy; go.mod and go.sum remain unchanged.
  • Pinned golangci-lint v2.1.6 against the base: zero issues; source guards, lint-module tests, and go-licenses v2.0.1 pass.
  • make unit-test: 133 packages pass; shortcuts/apps/gitcred fails at the unchanged TestLockGlobalConfigSerializesWriters with acquire global Git config lock: lockfile: lock already held. An isolated rerun fails identically. The same isolated test also fails on the exact unmodified base f6eaf122; this PR changes only an auth test file and leaves that package unchanged. No full-suite pass is claimed.
  • Local deployed backport verification: the actual CLI entry point and installed binary checksum match the patched artifact; live auth verification and an authenticated Base record read succeed using the existing grant. No production 429 was forced, and no real credentials are used by this regression.

The PR was rebased onto the accepted UTC fixture correction; the tested tree is unchanged (b067ec248a6d55f60ecb285ba20cf143e9bec375).

Related Issues

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.

1 participant