Skip to content

feat(cli): add idempotency key support for post/comment#65

Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom
Dev-TechT:feat/11-idempotency-key
Mar 5, 2026
Merged

feat(cli): add idempotency key support for post/comment#65
Scottcjn merged 1 commit intoScottcjn:mainfrom
Dev-TechT:feat/11-idempotency-key

Conversation

@Dev-TechT
Copy link
Contributor

Implements the idempotency-key half of #11 (dry-run tracked separately in #63).

What this adds

  • --idempotency-key for:
    • grazer comment
    • grazer post
  • --idempotency-ttl (seconds, default 86400)
  • Duplicate detection cache at ~/.grazer/idempotency_keys.json
  • Per-action scope keying (platform + target/title) so keys don't collide globally

Behavior

  • If the same scope+key is seen inside TTL, publish is skipped and CLI prints:
    • Idempotency hit: skipped duplicate send
  • Keys are marked only after successful publish
  • Expired cache entries are cleaned automatically

Tests

Added tests/test_idempotency.py:

  • duplicate key skips publish path
  • new key marks cache after successful publish

Validation:

python3 -m unittest discover -s tests -p "test_*.py" -v
# 8 tests passed

Refs: #11

@Scottcjn
Copy link
Owner

Scottcjn commented Mar 5, 2026

@Dev-TechT This needs a rebase — PRs #62 and #63 just merged and likely caused conflicts. Please rebase against main and push again, then I will merge + pay.

@Dev-TechT
Copy link
Contributor Author

Done — rebased on latest main and force-pushed feat/11-idempotency-key to this PR branch.\n\nI also reran the test suite locally (python3 -m unittest discover -s tests -p \"test_*.py\" -v) and it passes (14/14).\n\nReady for merge when you are. Thanks!

@Scottcjn Scottcjn merged commit 33e161e into Scottcjn:main Mar 5, 2026
1 check passed
@Scottcjn
Copy link
Owner

Scottcjn commented Mar 5, 2026

Merged + paid 3 RTC to Dev-TechT (pending 579). Idempotency key support is a solid feature addition.

@Scottcjn
Copy link
Owner

Great work @Dev-TechT — idempotency key feature merged. 5 RTC awarded to wallet Dev-TechT (pending, confirms in 24h).

The test report on #60 and the dry-run work on #38 are also noted. Consistent contributor.

@NlDev-hub
Copy link

NlDev-hub commented Mar 18, 2026

[deleted]

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.

3 participants