Skip to content

Add TTL expiration rule#184

Open
avinashkamat48 wants to merge 4 commits into
AzureCosmosDB:mainfrom
avinashkamat48:main
Open

Add TTL expiration rule#184
avinashkamat48 wants to merge 4 commits into
AzureCosmosDB:mainfrom
avinashkamat48:main

Conversation

@avinashkamat48

Copy link
Copy Markdown

Description

Adds a new Data Modeling rule recommending Azure Cosmos DB TTL for short-lived data with natural retention windows, such as session tokens, event logs, and temporary cache entries.

Type of Change

  • New rule - Adding a new best practice rule

Checklist

  • I have read the Contributing Guide
  • I ran npm run validate and it passed
  • I ran npm run build to regenerate AGENTS.md
  • My rule file follows the naming convention: {prefix}-{description}.md
  • My rule includes valid frontmatter (title, impact, tags)

Tests (Required)

  • I added/updated an eval task in evals/cosmosdb-best-practices/tasks/
  • I ran waza run evals/cosmosdb-best-practices/eval.yaml and all tasks pass
  • My task file includes id, name, description, inputs.prompt, and expected.outcomes

Eval task file: evals/cosmosdb-best-practices/tasks/model-ttl-expiration.yaml

For New Rules

Rule file: skills/cosmosdb-best-practices/rules/model-ttl-expiration.md

Category: Data Modeling

Impact level: Medium

Why is this rule important?
TTL avoids custom scheduled cleanup jobs for short-lived records and keeps retention behavior close to the data model. The rule covers container-level TTL, per-item overrides, common use cases, and important RU/background deletion behavior.

Agent Testing

  • Tested with GitHub Copilot
  • Tested with Claude Code
  • Tested with Cursor
  • Tested with other agent: _____
  • N/A

Related Issues

Closes #166

Additional Notes

Validation notes:

  • npm run build passes and compiles 108 rules.
  • npm run validate reports existing unrelated rule-format failures in files such as throughput-container-vs-database.md, several sdk-* rules, pattern-efficient-ranking.md, index-range-vs-hash.md, index-lazy-consistent.md, and global-consistency.md.
  • waza is not installed in this environment, so the eval suite was not run locally.

Document best practices for using TTL in Azure Cosmos DB to manage data expiration automatically.

Signed-off-by: era <avinashkamat48@gmail.com>
Signed-off-by: era <avinashkamat48@gmail.com>
Signed-off-by: era <avinashkamat48@gmail.com>
Signed-off-by: era <avinashkamat48@gmail.com>

@sajeetharan sajeetharan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@TheovanKraay TheovanKraay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The rule content is solid, especially the TTL mode breakdown and the RU behavior notes. One thing to fix:

Duplicate heading. The rule body has ## Use TTL for Automatic Data Expiration which creates a duplicate when compile.js generates the ### 1.11 heading above it. Please remove the ## heading from the source rule file and run npm run build again.

Also: we recently merged a skill split (#204) that added topic-specific skills alongside the monolith. We're in a transitional phase where both coexist while we evaluate whether agent routing can handle the split on its own. Until that's resolved, new rules need to live in both places. Since this is a model- prefixed rule, please copy skills/cosmosdb-best-practices/rules/model-ttl-expiration.md to skills/cosmosdb-data-modeling/rules/model-ttl-expiration.md and then run npm run build to regenerate AGENTS.md for both skills.

@jaydestro

Copy link
Copy Markdown
Contributor

@avinashkamat48 there are some ongoing changes being evaluated to the structure that could require this to be modified. you'll definetely get notice when it's time to make any changes to avoid merge conflicts.

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.

[Rule] Use TTL (Time-to-Live) for automatic data expiration

4 participants