Skip to content

fix: increase writeAuditEntry 412 retries to 5 and remove dead retry loop in put.js#274

Merged
kptdobe merged 1 commit into
mainfrom
worktree-agent-a47888252e9bbd4ad
May 5, 2026
Merged

fix: increase writeAuditEntry 412 retries to 5 and remove dead retry loop in put.js#274
kptdobe merged 1 commit into
mainfrom
worktree-agent-a47888252e9bbd4ad

Conversation

@kptdobe
Copy link
Copy Markdown
Contributor

@kptdobe kptdobe commented May 4, 2026

Summary

  • audit.js: Increases the writeAuditEntry 412 retry limit from 1 to 4 additional retries (5 total attempts). Adds random jitter delay (Math.random() * 50 * (attempt + 1) ms) before each retry to reduce thundering-herd contention under high concurrency.
  • put.js: Removes the dead AUDIT_WRITE_RETRIES for-loop and auditErr variable. Since writeAuditEntry already catches all errors internally (returning { status: 500 } on failure, never throwing), the outer retry loop never fired. Replaced with a single await writeAuditEntry(...) call.

Test plan

  • Updated test/storage/version/audit.test.js: new tests verify 5-total-attempt exhaustion and success on the 5th attempt; updated existing retry test to reflect multi-retry behaviour
  • Updated test/storage/version/put.test.js: removed tests that verified the dead retry loop; added tests confirming put.js calls writeAuditEntry exactly once and that a 500 return does not affect the main PUT result
  • Updated test/storage/object/conditionals.test.js: adjusted PUT command count to reflect 5 audit attempts (was 3 = 1 original + 1 retry + 1 main; now 6 = 5 audit attempts + 1 main)
  • npm run lint passes with no errors
  • npm test — 370 tests passing

🤖 Generated with Claude Code

…loop in put.js

Under high concurrency a single retry was insufficient to survive 412 PreconditionFailed
on audit writes. writeAuditEntry now retries up to 4 times (5 total) with random jitter
to reduce thundering-herd contention. The dead for-loop retry in put.js (AUDIT_WRITE_RETRIES)
is removed since writeAuditEntry already catches and handles all errors internally.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kptdobe kptdobe requested a review from bosschaert May 4, 2026 09:30
@kptdobe kptdobe merged commit 2aca684 into main May 5, 2026
6 checks passed
@kptdobe kptdobe deleted the worktree-agent-a47888252e9bbd4ad branch May 5, 2026 09:50
adobe-bot pushed a commit that referenced this pull request May 5, 2026
## [1.7.2](v1.7.1...v1.7.2) (2026-05-05)

### Bug Fixes

* handle NoSuchKey error name in copyFile catch block ([#272](#272)) ([939b491](939b491))
* increase writeAuditEntry 412 retries to 5 and remove dead retry loop in put.js ([#274](#274)) ([2aca684](2aca684))
* return 400 when label is missing in POST /versionsource ([#273](#273)) ([36acb2b](36acb2b))
@adobe-bot
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@adobe-bot
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.8.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants