arrow_backRetour aux issues
moizycodes/moizy-open-source-issues
#168
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
🚨 Issue: Add Idempotency-Key Support for API Operations
ecoDébutant
help wanted
testing
backend
javascript
api
dev-experience
real-world
descriptionDescription
## ⚠️ IMPORTANT CONTRIBUTION RULE
**Create a NEW branch before starting.**
- ❌ Do not work on `main`
- ❌ Do not create the PR from `main`
- ❌ PRs from `main` will **NOT be accepted**
Required format:
```
git checkout -b your-username/issue-97
```
## 📌 Real-World Problem
Network failures can cause clients to retry the same request. For operations such as creating an order or processing a payment, this can accidentally create **duplicate records or duplicate actions**.
An idempotency key allows the server to recognize that multiple requests belong to the same operation.
## 🎯 Task
Create a dependency-free utility for generating and validating idempotency keys.
Example:
```
const key = createIdempotencyKey();
```
Expected:
```
idempotency_7f3c91a2...
```
Also provide:
```
isValidIdempotencyKey(key);
```
which returns `true` or `false`.
## 🔧 Requirements
- Generate sufficiently unique keys
- Validate key format
- Reject empty or malformed keys
- Keep the API simple
- Do not expose sensitive request data inside the key
- Add comprehensive unit tests
- Include practical API usage documentation
## 🌍 Why This Matters
Idempotency is important for real-world systems handling:
- Payments
- Orders
- Account creation
- Booking systems
- Subscription management
- Background jobs
- External API requests
A network retry should not **accidentally perform the same operation twice**.
## 🧪 Tests Should Cover
- Generated key is valid
- Multiple generated keys are different
- Empty values
- Invalid formats
- Very long keys
- Non-string input
- Repeated API requests using the same key
## ✅ Acceptance Criteria
- Utility generates unique idempotency keys
- Validation works consistently
- No request-sensitive information is encoded
- Comprehensive tests are included
- Documentation contains a real API example
- No unnecessary dependencies
- Existing functionality remains unchanged
- PR comes from a **new username/issue-number branch**
Issues similaires
MyZubster-Ecosystem/myzubster
star1
Poids du dépôt moyen
[BOUNTY · OPEN FOR CONTRIBUTORS] Crea il fumetto visuale “Come funziona MyZubster” — 300 MYZ proposed
# 🎨 Bounty — Crea il fumetto visuale “Come funziona MyZubster” ## Status **OPEN FOR CONTRIBUTORS / PROPOSED** > Quest…
JavaScript
documentation
good first issue
StudentSuite/awesome-study-resources
star8
Poids du dépôt léger
Psychology subsection has only 4 entries
The `### Psychology` subsection under By Subject currently has only 4 entries (CrashCourse, Fiveable, Seneca Learning, …
JavaScript
good first issue
content
StudentSuite/awesome-study-resources
star8
Poids du dépôt léger
Foreign Languages subsection has only 4 entries
The `### Foreign Languages` subsection under By Subject currently has only 4 entries (Duolingo, italki, Language Reacto…
JavaScript
good first issue
content