docs: clarify Idempotency-Key is only honored on audit log event creation#128
docs: clarify Idempotency-Key is only honored on audit log event creation#128workos-tars[bot] wants to merge 2 commits into
Conversation
…tion The WorkOS API only deduplicates requests carrying an Idempotency-Key on POST /audit_logs/events. The README previously implied the key was honored on arbitrary mutations (e.g. organization creation), which could lead callers to retry mutations expecting server-side deduplication that does not happen. Scope the examples and prose to the Audit Logs endpoint and call out the limitation explicitly.
Greptile SummaryThis PR is a coordinated documentation-only fix clarifying that the WorkOS API only deduplicates requests on the
Confidence Score: 5/5Safe to merge — all changes are documentation and doc comment corrections with no logic changes. Every changed line is a comment, doc string, or README update. The technical claims were verified against the source: README.md — the new Per-Request Options code snippet references an undeclared Important Files Changed
|
| let opts = RequestOptions::new().idempotency_key("51343ada-3f0f-4372-9d24-4d0b0dfba384"); | ||
|
|
||
| let org = client | ||
| .organizations() | ||
| .create_organization_with_options( | ||
| CreateOrganizationParams::new(workos::OrganizationInput { | ||
| name: "Acme".into(), | ||
| ..Default::default() | ||
| let response = client | ||
| .audit_logs() | ||
| .create_event_with_options( | ||
| CreateEventParams::new(workos::AuditLogEventIngestion { | ||
| organization_id: "org_01EHZNVPK3SFK441A1RGBFSHRT".into(), | ||
| event, | ||
| }), | ||
| Some(&opts), | ||
| ) | ||
| .await?; | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Undefined
event variable in code snippet
The new example references event inside the AuditLogEventIngestion struct literal, but event is never declared or initialized in the snippet. The original example was fully self-contained (using ..Default::default() to fill optional fields); this replacement leaves event dangling. A reader who copies the snippet as-is will get a compile error. Consider either initializing event inline (e.g. with a minimal AuditLogEvent { .. } struct literal) or adding a // let event = …; comment stub before the let opts = … line to make the intent clear.
Prompt To Fix With AI
This is a comment left during a code review.
Path: README.md
Line: 113-126
Comment:
**Undefined `event` variable in code snippet**
The new example references `event` inside the `AuditLogEventIngestion` struct literal, but `event` is never declared or initialized in the snippet. The original example was fully self-contained (using `..Default::default()` to fill optional fields); this replacement leaves `event` dangling. A reader who copies the snippet as-is will get a compile error. Consider either initializing `event` inline (e.g. with a minimal `AuditLogEvent { .. }` struct literal) or adding a `// let event = …;` comment stub before the `let opts = …` line to make the intent clear.
How can I resolve this? If you propose a fix, please make it concise.|
Assessed the rest of the README against the codebase per the Slack thread. Fixes pushed in the follow-up commit:
All source changes are doc-comment-only (verified no code lines touched). |
Summary
The WorkOS API only deduplicates requests carrying an
Idempotency-Keyheader onPOST /audit_logs/events(Create Audit Log Event). The README previously presented idempotency keys as a general capability on arbitrary mutations (e.g. organization creation), so a client that retried a mutation with the same key could still create a duplicate — as reported publicly by a user who retriedPOST /organizationsand got two organizations.Rewrites the Per-Request Options example to use
audit_logs().create_event_with_options(the one endpoint where the key is honored), updates the Request Strategies and Retries sections to note the server-side scoping, and adds an explicit callout.This README is synced to workos.com/docs SDK pages by the
sync-sdk-readmesworkflow, so the fix propagates to the public docs on the next sync.Part of a coordinated docs fix across workos-rust, workos-ruby, workos-python, workos-kotlin, workos-go, and workos-dotnet.
Test plan
Docs-only change; rendered the Markdown and verified the referenced SDK methods exist in this repo.