Skip to content

feat: add idempotency_token special variable per resource per session#30

Merged
jeffreyaven merged 2 commits intomainfrom
claude/add-idempotency-token-XYHOD
Mar 15, 2026
Merged

feat: add idempotency_token special variable per resource per session#30
jeffreyaven merged 2 commits intomainfrom
claude/add-idempotency-token-XYHOD

Conversation

@jeffreyaven
Copy link
Copy Markdown
Member

Introduces idempotency_token, a UUID v4 that is generated once per resource at session start and remains stable for the lifetime of the invocation. This allows mutation queries (INSERT/UPDATE) to carry a provider-side client token that distinguishes genuine new requests from retries of the same request — a requirement for many async APIs such as the AWS Cloud Control API.

Implementation:

  • CommandRunner gains an idempotency_tokens: HashMap<String, String> field populated at startup (one UUID per resource in the manifest).
  • get_full_context accepts an idempotency_token: Option<&str> and injects two keys when a token is present:
    • idempotency_token (unscoped, for direct use)
    • <resource_name>.idempotency_token (scoped, for this. and downstream access)
  • this.idempotency_token inside a resource's .iql file preprocesses
    to {{ <resource_name>.idempotency_token }} via the existing
    preprocess_this_prefix mechanism.

Documentation:

  • template-filters.md: new "Special Variables" section documenting stack_name, stack_env, resource_name, and idempotency_token with usage examples and a tip contrasting it with uuid().
  • resource-query-files.md: new "Special Variables" section with a reference table and an idempotency_token usage example.

https://claude.ai/code/session_01HAXNi38tB8nY9wiDnqVNWH

Introduces `idempotency_token`, a UUID v4 that is generated once per
resource at session start and remains stable for the lifetime of the
invocation.  This allows mutation queries (INSERT/UPDATE) to carry a
provider-side client token that distinguishes genuine new requests from
retries of the same request — a requirement for many async APIs such as
the AWS Cloud Control API.

Implementation:
- `CommandRunner` gains an `idempotency_tokens: HashMap<String, String>`
  field populated at startup (one UUID per resource in the manifest).
- `get_full_context` accepts an `idempotency_token: Option<&str>` and
  injects two keys when a token is present:
    - `idempotency_token`                   (unscoped, for direct use)
    - `<resource_name>.idempotency_token`   (scoped, for `this.` and downstream access)
- `this.idempotency_token` inside a resource's `.iql` file preprocesses
  to `{{ <resource_name>.idempotency_token }}` via the existing
  `preprocess_this_prefix` mechanism.

Documentation:
- `template-filters.md`: new "Special Variables" section documenting
  `stack_name`, `stack_env`, `resource_name`, and `idempotency_token`
  with usage examples and a tip contrasting it with `uuid()`.
- `resource-query-files.md`: new "Special Variables" section with a
  reference table and an `idempotency_token` usage example.

https://claude.ai/code/session_01HAXNi38tB8nY9wiDnqVNWH
@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Mar 15, 2026

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
23248038 Triggered Generic High Entropy Secret f74fd0a src/core/config.rs View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@jeffreyaven jeffreyaven merged commit 947b0d8 into main Mar 15, 2026
8 checks passed
@jeffreyaven jeffreyaven deleted the claude/add-idempotency-token-XYHOD branch March 18, 2026 07:59
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.

2 participants