Skip to content

refactor(posts): model idempotency keys as a domain value - #1217

Merged
mdorman merged 9 commits into
mainfrom
issue-1086-idempotency-key
Aug 27, 2026
Merged

refactor(posts): model idempotency keys as a domain value#1217
mdorman merged 9 commits into
mainfrom
issue-1086-idempotency-key

Conversation

@mdorman

@mdorman mdorman commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add the ADR-0063 IdempotencyKey domain type with validating serde/SQLx support
  • retain typed keys from the AtomPub header boundary through post creation, replay lookup, persistence, and backup restore validation
  • preserve existing empty/unreadable-header compatibility, per-user replay semantics, and transaction rollback behavior
  • update dual-backend contract coverage, ADR-0063, and the architecture projection

Verification

  • cargo xtask test-local -- -p common idempotency_key
  • cargo xtask test-local -- idempotency
  • cargo xtask check
  • pre-push gate

Closes #1086

Comment thread server/src/atompub/posts.rs Outdated
.and_then(|v| v.to_str().ok())
.map(str::trim)
.filter(|s| !s.is_empty());
.and_then(|value| value.to_str().ok()?.parse::<IdempotencyKey>().ok());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this a method on IdempotencyKey itself, something like fromHeaders?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted this as idempotency_key_from_headers in 2d7b471. I kept it at the AtomPub adapter seam rather than making it an inherent IdempotencyKey method: missing-header and HeaderValue::to_str rejection are HTTP compatibility policy, while the common domain type intentionally has no http/Axum dependency and owns only trim/non-empty canonicalization. The handler now names the whole boundary policy in one call.

@mdorman
mdorman added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 628a8aa Aug 27, 2026
7 checks passed
@mdorman
mdorman deleted the issue-1086-idempotency-key branch August 27, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(posts): model idempotency keys as a domain value

1 participant