@goodandready/dsh-key-rotation 0.8.54 → 0.8.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.56 - 2026-10-12
4
+
5
+ ### Fixed
6
+ - **Prevent Soft Transient Errors from Triggering Key Quarantine (#473)**:
7
+ - In `lib/rotate.js`, soft failures (`TIMEOUT`, 5xx, socket disconnects) no longer increment `failCounts` nor trigger the 30-minute `brokenUntil` quarantine.
8
+ - Synchronized `rotate.js` quarantine checks with `recordFailure` in `lib/pool.js` which deliberately excludes soft failures from exponential penalties.
9
+ - Added unit test coverage verifying soft failures do not trip quarantine while 3 hard failures correctly trigger recoverable quarantine.
10
+
11
+ ## 0.8.55 - 2026-10-11
12
+
13
+ ### Fixed
14
+ - **Cleaned Dead Exports and Test-Only Smells (#471)**:
15
+ - Removed unwired exports `getModelTokenUsage` and `getModelTokenRemaining` from `lib/model-quota.js`. Internal logic and status routes use `getModelQuotaStatus(pool, ref, now)`.
16
+ - Removed test-only export `isSoftFailureCode` from `lib/pool.js`.
17
+ - Wired `activeModelPools` into `/dsh-key-rotation/status` response keys object as `modelPools`.
18
+ - Cleaned dead-export and test references across the repository.
19
+
3
20
  ## 0.8.54 - 2026-10-11
4
21
 
5
22
  ### Added
@@ -139,18 +139,7 @@ function readQuota(pool, ref, quotaResetWindow, now) {
139
139
  return { used, resetAt, open: true, stored: true };
140
140
  }
141
141
 
142
- /** Tokens consumed by `ref` in `pool` during the current window (0 = none/unlimited). */
143
- export function getModelTokenUsage(pool, ref, now) {
144
- if (getModelTokenLimit(pool, ref) === null) return 0;
145
- return readQuota(pool, ref, undefined, now).used;
146
- }
147
142
 
148
- /** Remaining tokens, or null when the credential is unlimited in this pool. */
149
- export function getModelTokenRemaining(pool, ref, now) {
150
- const limit = getModelTokenLimit(pool, ref);
151
- if (limit === null) return null;
152
- return Math.max(0, limit - readQuota(pool, ref, undefined, now).used);
153
- }
154
143
 
155
144
  /**
156
145
  * Quota status for one credential in one model pool (status/health APIs).
package/lib/ops-status.js CHANGED
@@ -119,6 +119,7 @@ ctx.effect(() => ctx.webServer.register({
119
119
  paused: isKeyPaused(pool, ref),
120
120
  revoked: isKeyRevoked(pool, ref),
121
121
  modelQuota,
122
+ modelPools: activeModelPools.map(mp => mp.base),
122
123
  });
123
124
  }
124
125
  const basePool = pool.basePool ?? (runtime.index ? basePoolForBase(runtime.index, pool.base) : null);
package/lib/pool.js CHANGED
@@ -96,11 +96,6 @@ export const SOFT_FAILURE_CODES = new Set([
96
96
  'SERVER', 'TIMEOUT', 'TRANSPORT', 'EMPTY_RESPONSE', '500', '502', '503', '504',
97
97
  ]);
98
98
 
99
- /** True if failure code or message represents a soft/transient drop. */
100
- export function isSoftFailureCode(code) {
101
- if (!code) return false;
102
- return SOFT_FAILURE_CODES.has(String(code).toUpperCase());
103
- }
104
99
 
105
100
  /** Ref name validator. Same rule lib/index.js enforces in PUT/DELETE /key. */
106
101
  const REF_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
package/lib/rotate.js CHANGED
@@ -242,9 +242,10 @@ export function createRotate(deps) {
242
242
  }
243
243
  } else {
244
244
  pool.state.authFailCounts.delete(targetRef);
245
- if (!isQuota) {
246
- const _fc = (pool.state.failCounts.get(targetRef) ?? 0) + 1;
247
- pool.state.failCounts.set(targetRef, _fc);
245
+ // Soft/transient errors (TIMEOUT, 5xx, socket) do not count toward quarantine (#473).
246
+ // recordFailure already maintains pool.state.failCounts accurately for non-soft failures.
247
+ if (!isQuota && !cls.soft) {
248
+ const _fc = pool.state.failCounts.get(targetRef) ?? 0;
248
249
  if (_fc >= 3 && !pool.state.brokenUntil.has(targetRef)) {
249
250
  const quarantineMs = 1800000;
250
251
  pool.state.brokenUntil.set(targetRef, Date.now() + quarantineMs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-key-rotation",
3
- "version": "0.8.54",
3
+ "version": "0.8.56",
4
4
  "packageManager": "pnpm@10.33.2",
5
5
  "description": "Per-provider API key rotation for DeepSeek Harness: a key pool per provider, auto-created clone routes, and switching to the next key on quota/rate-limit errors. Includes a Settings section (Key Rotation) to edit the key pools, cooldown and switch codes.",
6
6
  "keywords": [