mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-19 07:46:51 +00:00
Part 3 of Policy API Redesign - updated both tests and implementation:
**Test changes (policy_transforms_test.go):**
- Updated all 25 PolicyDefinition templates to use new API syntax
- Old: `enabled: true` at root level
- New: `config: { enabled: true }`
**Implementation changes (policy_transforms.go):**
- Added PolicyConfig struct with enabled and cacheDuration fields
- Updated extractEnabled() to support both new and old API:
- Tries config.enabled first (new API)
- Falls back to root enabled (old API, backwards compatible)
- Defaults to true if neither exists
**Testing:**
- Tests now pass with new API syntax
- Backwards compatibility maintained for old API
- TDD approach: updated tests first, then implementation
**Next:**
- Part 4: Per-output-type refresh control (config.refresh)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>