Skip to content

docs: idempotency contract + checkout dedup error envelope#6

Merged
mastermanas805 merged 3 commits into
mainfrom
docs/idempotency-and-checkout-dedup-2026-05-14
May 14, 2026
Merged

docs: idempotency contract + checkout dedup error envelope#6
mastermanas805 merged 3 commits into
mainfrom
docs/idempotency-and-checkout-dedup-2026-05-14

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

Backfills documentation for two in-flight InstaNode-dev/api PRs whose original briefs did not include a content-repo propagation step.

Pairs with InstaNode-dev/api#111 (server-side dedup on /api/v1/billing/checkout) and InstaNode-dev/api#112 (Idempotency middleware on all create endpoints with body-fingerprint fallback). Stacked on top of #5, which contributed the bulk of the idempotency contract documentation.

What this PR adds on top of #5

  • A worked curl example in docs/idempotency.md showing two back-to-back /db/new calls from the same caller collapsing into one resource via the fingerprint fallback. Includes the exact X-Idempotency-Source / X-Idempotent-Replay headers an agent would see on each side, and a short callout that the same shape applies to /deploy/new (multipart) and /api/v1/billing/checkout.
  • A POST /api/v1/billing/checkout concurrent-call dedup section in docs/limits.md with the full 409 checkout_in_flight envelope (retry_after_seconds: 60, agent_action copy, request_id), placed alongside the existing 400 tier_unavailable billing-error documentation. Documents the 60s TTL on the SETNX guard, that an Idempotency-Key is honoured on this route for a longer-window guarantee, and the fail-open posture on Redis brownouts.

Coverage map

Surface State after this PR
llms.txt convention #7 (idempotency on by default) already added in #5
docs/idempotency.md two-layer contract + headers + covered routes already added in #5
docs/idempotency.md worked double-click curl example added here
docs/idempotency.md callout that checkout has its own SETNX guard added here
docs/limits.md 409 checkout_in_flight envelope added here

Why one PR, not two

The user's rule is "every contract change propagates". Two parallel api PRs (#111 and #112) each introduce contract surface, and #5 already handles most of #112. Bundling the remaining bits in a single docs PR keeps the propagation traceable to a single landing event.

Notes

Test plan

  • Build the Vite SSG against this branch and confirm /docs#idempotency renders the new "Worked example" subsection and /docs#limits renders the new "POST /api/v1/billing/checkout — concurrent-call dedup" subsection.
  • Curl https://instanode.dev/docs/idempotency.md (after deploy) and confirm the worked example is present in the .md mirror.
  • Confirm the JSON envelope in limits.md matches internal/handlers/billing.go in api PR #111 byte-for-byte (error, message, retry_after_seconds, agent_action).

mastermanas805 and others added 2 commits May 14, 2026 22:14
Adds a new docs/idempotency.md covering the two-layer dedup contract
(explicit Idempotency-Key header, 24h TTL; body-fingerprint fallback,
120s TTL) and the X-Idempotency-Source response header. Extends llms.txt
convention #7 so an agent skimming /llms.txt sees the contract.

Pairs with api PR #112.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backfills two contract surfaces the in-flight api PRs introduced but did
not have a content-repo propagation step in their original briefs:

- A concrete double-click curl example in docs/idempotency.md showing
  two back-to-back /db/new calls collapse to one resource via the
  fingerprint fallback, with the response headers an agent would see.
- The full 409 checkout_in_flight envelope (server-side dedup guard on
  /api/v1/billing/checkout) in docs/limits.md alongside the existing
  billing-error documentation. Includes retry_after_seconds=60,
  agent_action copy, and the fail-open posture on Redis errors.

Pairs with api PRs #111 (checkout dedup) and #112 (idempotency
middleware on all create endpoints). Convention #7 in llms.txt and the
top-level docs/idempotency.md from b4264fe (PR #5) cover the broader
middleware story; this commit fills the worked-example + checkout-error
gap so every contract change has a docs surface.

docs/marketing copy only, no code change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…checkout-dedup-2026-05-14

# Conflicts:
#	docs/idempotency.md
@mastermanas805 mastermanas805 merged commit 067b231 into main May 14, 2026
@mastermanas805 mastermanas805 deleted the docs/idempotency-and-checkout-dedup-2026-05-14 branch May 14, 2026 17:02
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.

1 participant