Skip to content

fix(auth): configure provider endpoint rate limits - #2642

Merged
rickylabs merged 6 commits into
mainfrom
fix/auth-sign-in-rate-limit
Nov 17, 2026
Merged

rickylabs merged 6 commits into
mainfrom
fix/auth-sign-in-rate-limit

Conversation

@rickylabs

@rickylabs rickylabs commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Auth configuration now accepts validated provider-native endpoint quotas and forwards them to better-auth as customRules. Applications can change the sign-in limit while absent configuration retains the provider's effective production default.

Scope

  • Archetype / area: integration and contract schema; plugin-auth-core and auth plugin backend composition.
    Closes [auth] Sign-in rate limit is the provider default and cannot be configured #2634
  • Decisions: rateLimit.customRules uses native window (seconds) and max; both positive integers, paths/patterns slash-prefixed. The section is data-only; enablement, storage and global defaults stay provider-owned. auth.rateLimit takes precedence over Auth.RateLimit.

Slices

  • S1 Design and genuine red schema/provider regressions — c70f6e5.
  • S2 Schema/types, validated provider forwarding and public docs — e1a6085.
  • S3 Generated consumers and local gates — 86ffff9.
  • Independent evaluation, current-head required checks and review-thread gate verified.

Validation

  • Main baseline: schema2pass/8fail; real production provider1pass/2fail (configured max1 ignored on both appsettings styles).
  • Repaired core/service/provider suite:69 passed,0 failed. Native Deno scoped import-map observation calls the real provider factory used by the plugin registry, then sends real sign-in Fetch requests. Configured max1 returns429 on the second request; absent configuration returns429 on the fourth. Development remains unthrottled; casing precedence and invalid-config rejection pass.
  • Structured changed-source check/lint/fmt, quality:gate, release:preflight, docs:accuracy: pass.
  • JSR audits/dry-runs: pass with pre-existing slow-type/cardinality warnings. Full export-map doc-lint core3/plugin12 private references exactly matches base per file/entrypoint after path normalization; changed config adds no finding.
  • Canonical agent docs/site, MCP corpus and publish assets refreshed; corpus/publish freshness checks pass. No lock changes.
  • Full scaffold.runtime not applicable: no scaffold output, Aspire helper or executable launch changes; it does not install auth. The focused real-provider test proves this configuration boundary directly.
issue: 2634
entries:
  - box-index: 1
    evidence: "AuthConfigSchema validation cases; 69/69 suite and baseline failures: https://github.com/rickylabs/netscript/pull/2642#issuecomment-6925735082"
  - box-index: 2
    evidence: "rate-limit-production_test.ts observes the real registry-created provider returning429 at configured max1 for both appsettings styles: https://github.com/rickylabs/netscript/pull/2642#issuecomment-6925735082"
  - box-index: 3
    evidence: "Production no-config3/10 control, unchanged development enablement, and documented defaults: https://github.com/rickylabs/netscript/pull/2642#issuecomment-6925735082"
  - box-index: 4
    evidence: "Auth guide, better-auth page, core README and reference updates: https://github.com/rickylabs/netscript/commit/e1a60851186b23f99d6c32d69a1277ddec3a8b93"
  • Independent evaluation PASS; no blocking findings. The follow-up commits only evaluator/run evidence and preserves the evaluated production tree.

  • Current head required quality PASS; deps-report and legacy check-test policy-SKIPPED. All checks:17SUCCESS/16SKIPPED; review threads0/0. Required quality job.

Harness

  • Run dir: .llm/runs/fix-auth-sign-in-rate-limit--issue-2634/.
  • Straightforward tier; PLAN-EVAL N/A for narrow native data passthrough with locked defaults; independent IMPL-EVAL PASS.

Drift / Debt

  • Existing measured doc-lint/JSR warnings remain disclosed above.
  • No production injection hook or auth-flow change; better-auth owns these sign-in endpoints.
  • No saga transport changes or Redis Streams dependency.

Definition of Done

  • Schema/provider regressions fail on main and pass after the fix.
  • All issue acceptance boxes have linked evidence; public docs state defaults and the option.
  • Local scoped/static/publication/docs gates pass with measured baseline findings disclosed.
  • Independent evaluation and review-thread gate pass; required head checks pass or are skipped by workflow policy.
  • Taxonomy and milestone0.0.10; no lock or unrelated source churn.

🤖 Generated with Codex

@rickylabs rickylabs added this to the 0.0.10 milestone Nov 16, 2026
@rickylabs rickylabs added type:fix status:impl ci:skip-e2e area:auth priority:p2 Medium ci:skip-scaffold Skip the scaffold-static (deno-only) scaffold gate labels Nov 16, 2026
@rickylabs

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL]

Red baseline committed at c70f6e5 before product changes. Schema regressions:2pass/8fail because rateLimit is discarded and invalid rule data ignored. Real production provider regressions:1pass/2fail; absent config retains3 requests/10seconds, while both configured appsettings styles ignore max1 and return a second400 instead of429. A native scoped import-map wrapper observes the real factory invoked by the shipped plugin registry and calls the original provider, with no product injection hook. Initial loader-fixture failure is excluded from evidence.

Next: add schema/type contract and validated customRules forwarding, preserving no-config provider options, then documentation and scoped gates.

@rickylabs rickylabs removed ci:skip-e2e ci:skip-scaffold Skip the scaffold-static (deno-only) scaffold gate labels Nov 16, 2026
@rickylabs

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL]

S2 committed at e1a6085: optional typed/validated rateLimit.customRules, lower auth.rateLimit and upper Auth.RateLimit appsettings, native provider forwarding, public docs and no-config omission. Windows are seconds, counts/windows positive integers, patterns slash-prefixed; data-only overrides preserve production enablement and storage defaults. No production injection hook or auth flow change.

Core/service/provider tests69/69 pass. Real production requests observe max1 on both casing styles; absent retains3/10; lowercase wins and development stays unthrottled. Schema/main red baseline is in the preceding comment. Structured check/lint/fmt, quality:gate, release:preflight and docs:accuracy pass. JSR dry-runs/audits pass with existing warnings; full export-map doc lint core3/plugin12 matches base per file/entrypoint after path normalization.

Initial docs-only CI skip labels removed. No full scaffold.runtime is applicable: no scaffold/Aspire/executable wiring changes. Next: generated consumer freshness, independent straightforward IMPL-EVAL and final head checks.

@rickylabs

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL-EVAL] [VERDICT: PASS]

Independent straightforward-tier IMPL-EVAL of issue #2634 at head 86ffff9a61bf784840f3a744404c7cf960c14816 (verified exact; base b0eb0795). Evaluator session is separate from the generator and a different vendor family: requested/pinned glm_5_3_flash/provider_default with options {}, observed as the mapped opencode-go GLM route — no substitution, fallback deepseek_v4_pro not needed. Generator remains Codex gpt-6.1-sol/xhigh per the run supervisor record.

Process. PLAN-EVAL: N/A was recorded in the run worklog before implementation (narrow native JSON passthrough, locked defaults) and the Design checkpoint precedes the commit slices. Slices S1 c70f6e564 (red tests committed before source), S2 e1a608511, S3 86ffff9a6 match the approved plan.

Scope verified against source, not asserted. AuthConfig/AuthConfigInput.rateLimit with native customRules, positive-integer seconds window and max, slash-prefixed patterns, absent-section omission; registry reads lower auth.rateLimit with upper Auth.RateLimit fallback (lower wins), validates through the shared AuthConfigSchema, and forwards only customRules through the existing betterAuthOptions passthrough (spread into the composed options that reach betterAuth(); installed provider resolves to better-auth 1.7.14). No enabled/global/storage override, no production seam, no scaffold/Aspire/executable/lock changes — the full scaffold.runtime non-applicability decision is confirmed, and the focused real-provider boundary test is the correct proof for this fix.

Oracle validity. The test wrapper scopes the import-map override to the real registry module (the confirmed import site of @netscript/auth-better-auth), always calls the original factory, and sends real Fetch sign-in requests to the real constructed provider handler inside the disposable child process — no fake limiter, no product injection hook.

Independent runs (evaluator's own, Deno 2.9.7):

  • Schema tests 10/10; real-provider rate-limit test 6/6 (absent → 400,400,400,429; configured max:1 both casing styles → 400,429; both → lower wins; development unthrottled; invalid config rejected before construction).
  • plugin-auth-core full suite 54/54. Adjacent plugin service tests re-run from repo root as a control: 8/8 (a working-directory artifact of the full-suite invocation was environmental and passes from the repo root; not product-related).
  • Targeted deno check --unstable-kv over the five changed source/test files: pass. Structured lint/fmt wrappers over both changed roots: 0 findings.
  • quality:scan 0 findings (7 pre-existing unrelated allowances); doctrine fitness check exit 0 (FAIL=0, pre-existing warnings only).
  • release:preflight PASS; docs:accuracy PASS; JSR publish dry-run for the changed package succeeds; doc lint: the changed config entrypoint has 0 findings and package totals match the claimed measured base (3 private-type references).
  • Export corpus and CLI assets freshness checks pass with no asset diff; no lock changes.

Gates/close-gate pre-check. Review-thread gate: PASS (0 threads, 0 unanswered). All four #2634 acceptance boxes are checked with linked evidence; PR body carries Closes #2634 and one acceptance-evidence block; milestone 0.0.10; taxonomy labels correct with exactly one status:; forbidden ready-merge label absent.

Findings. No blocking findings and no unrecorded doctrine violation. Non-blocking: the issue's evidence link points at the S2 phase comment rather than a dedicated evidence comment; the linked content plus the PR-body acceptance block satisfy the evidence requirement.

State. Draft checks are currently policy-skipped (build and docs-site classification SUCCESS; the docs style workflow was still in progress at evaluation time). Remaining PR DoD is the generator's post-review transition and required head checks at this head. Verdict per protocol: PASS. Run evaluation artifact: .llm/runs/fix-auth-sign-in-rate-limit--issue-2634/evaluate.md.

@rickylabs
rickylabs marked this pull request as ready for review November 16, 2026 19:01
@rickylabs

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL]

Ready for independent review at c65adf5. Independent IMPL-EVAL PASS; the evidence-only follow-up leaves production/tests/docs/generated consumers unchanged from the evaluated tree.

Required quality PASS; deps-report and legacy check-test SKIPPED by workflow policy. Current checks17SUCCESS/16SKIPPED, review-thread gate PASS0/0. All issue acceptance and PR DoD boxes are checked with linked evidence. No merge, auto-merge, ready-merge label or publication.

@rickylabs

rickylabs commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner Author

[PHASE: IMPL]

Evaluated head: 86ffff9a61bf784840f3a744404c7cf960c14816 (approved tip c65adf52701bbe6f5415e145b8366403410f208b). New head: 95ee5f5e39ba5353d34d534eca284dc14f859742, after merging main 84b269459c82c9551332f1a106ac697210d135c1. The PR's own handwritten diff against main is byte-identical before and after: the delta is merge plus canonical regeneration only, with no handwritten conflict resolution. Prose/corpus/publish freshness, release:preflight and docs:accuracy pass; the existing acceptance-evidence block is unchanged.

@rickylabs
rickylabs merged commit d122121 into main Nov 17, 2026
31 checks passed
@github-actions github-actions Bot added the canary:0.0.10-canary.4 Published NetScript prerelease 0.0.10-canary.4 label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:auth canary:0.0.10-canary.4 Published NetScript prerelease 0.0.10-canary.4 priority:p2 Medium status:shipped type:fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[auth] Sign-in rate limit is the provider default and cannot be configured

1 participant