agentleFS
brendadeeznuts1111brendadeeznuts1111/betting-brain-v3/.cursor/rules/coverage-thresholds.mdc

betting-brain-v3 / rules

Cursor rule8 starsChanged 14 months agoMITView on GitHub

Coverage threshold configuration patterns

The file

We split this coverage-thresholds.mdc into the rules it gives an agent

12 rules. About 0 are common, 10 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Purpose: Ensure high-quality, well-tested production code

    line 57
  2. Distinctive:

    Scope: All business logic, API endpoints, core functionality

    line 58
  3. Distinctive:

    Scope: Test helpers, stubs, analytics-specific utilities

    line 63
  4. Distinctive:

    Enforcement: No coverage requirement, focus on functionality

    line 64
  5. Distinctive:

    Keep main threshold at 80% for production quality

    line 80
  6. Distinctive:

    Use analytics config only for analytics tests

    line 81
  7. Distinctive:

    Document threshold rationale in commit messages

    line 82
  8. Distinctive:

    Test both thresholds in CI

    line 83
  9. Distinctive:

    Use analytics config for production code

    line 87
  10. Very specific:

    Solution: Use --config bunfig.analytics.toml flag

    line 94
  11. Distinctive:

    Solution: Check if using analytics config by mistake

    line 97
  12. Very specific:

    Solution: Ensure [test] section in config file

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
coverage-thresholds.mdc
---
version: "1.1.0"
globs: "bunfig.toml,bunfig.*.toml,package.json"
description: "Coverage threshold configuration patterns"
lastUpdated: "2025-10-08"
dependencies: ["quality-standards", "testing-patterns"]
---

# Coverage Threshold Rules

## Dual Threshold System

This codebase uses **dual coverage thresholds** to balance:
- Strict production standards
- Flexible analytics testing

### Main Suite: 80% Coverage (Strict)
```toml

# bunfig.toml
coverage = false  # coverage off by default
coverageThreshold = 0.8   # 80% for production code
```

### Analytics Suite: 0% Coverage (Flexible)
```toml

# bunfig.analytics.toml
coverage = true
coverageThreshold = 0  # No threshold for analytics tests
```

## Package.json Scripts

### Main Suite Commands
```json

{
  "test": "bun test --randomize",
  "test:coverage": "bun test --coverage --randomize"
}
```

### Analytics Suite Commands
```json

{
  "analytics:test": "bun test tests/unit/analytics-testing-example.test.ts --randomize",
  "analytics:test:coverage": "bun test --coverage --randomize tests/unit/analytics-testing-example.test.ts --config bunfig.analytics.toml",
  "analytics:ci": "CI=true bun run analytics:test:coverage"
}
```

## Why Dual Thresholds?

### Production Code (80% threshold)
- **Purpose**: Ensure high-quality, well-tested production code
- **Scope**: All business logic, API endpoints, core functionality
- **Enforcement**: CI fails if coverage < 80%

### Analytics Code (0% threshold)
- **Purpose**: Allow rapid iteration on analytics utilities
- **Scope**: Test helpers, stubs, analytics-specific utilities
- **Enforcement**: No coverage requirement, focus on functionality

## Configuration Hierarchy

```
bunfig.toml (root)
    ↓ (always takes precedence for critical settings)
--config flag
    ↓ (limited override capability)
Environment variables
    ↓ (minimal support)
```

## Best Practices

### ✅ Do These
- Keep main threshold at 80% for production quality
- Use analytics config only for analytics tests
- Document threshold rationale in commit messages
- Test both thresholds in CI

### ❌ Don't Do These
- Lower main threshold below 80%
- Use analytics config for production code
- Mix threshold configurations
- Ignore coverage failures in main suite

## Troubleshooting

### Issue: Analytics tests failing with 80% threshold
**Solution**: Use `--config bunfig.analytics.toml` flag

### Issue: Main tests passing with low coverage
**Solution**: Check if using analytics config by mistake

### Issue: Config file not working
**Solution**: Ensure `[test]` section in config file

## Related Rules

- [Analytics Testing](mdc:.cursor/rules/analytics-testing.mdc) - Core analytics testing patterns
- [CI Integration](mdc:.cursor/rules/ci-integration.mdc) - CI/CD automation with dual thresholds
- [Test Setup Patterns](mdc:.cursor/rules/test-setup-patterns.mdc) - Test configuration patterns

## Related Files

- [bunfig.toml](mdc:bunfig.toml) - Main configuration
- [bunfig.analytics.toml](mdc:bunfig.analytics.toml) - Analytics configuration
- [package.json](mdc:package.json) - Script definitions

---

**Status:** Production Ready ✅  
**Last Updated:** 2025-10-07  
**Enforcement:** CI/CD Required

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.