Skip to content

feat: defer description template resolution - #288

Open
nieomylnieja wants to merge 2 commits into
mainfrom
defer-description-template-resolution
Open

feat: defer description template resolution#288
nieomylnieja wants to merge 2 commits into
mainfrom
defer-description-template-resolution

Conversation

@nieomylnieja

Copy link
Copy Markdown
Collaborator

Motivation

Built-in rules rendered description templates during construction, even when no validation error or validation plan needed the description. This caused avoidable work during rule construction.

Summary

  • Added lazy, cached description-template rendering for failed validations and validation plans.
  • Migrated all template-backed built-in rules and removed the eager rendering helper.
  • Kept static and custom rule descriptions unchanged.

Testing

  • Added unit coverage for deferred and single execution, validation and plan consumers, template failures, setter precedence, and concurrent rule copies.

Release Notes

Added Rule.WithDescriptionTemplate for lazy, cached rule descriptions. Updated built-in template-backed rules to avoid rendering descriptions during construction.

Add cached lazy rendering for rule descriptions and migrate built-in rules to use it. Preserve template errors as panics and share resolution across rule copies.
@github-actions github-actions Bot added enhancement New feature or request go Pull requests that update Go code minor New functionality with at most minor brekaing changes labels Aug 18, 2026
@github-actions

Copy link
Copy Markdown

Test coverage changes:

Package Before After Diff
github.com/nobl9/govy/cmd/govy 0% 0% ✔️
github.com/nobl9/govy/internal 73% 73% ✔️
github.com/nobl9/govy/internal/collections 100% 100% ✔️
github.com/nobl9/govy/internal/inferpath 76% 76% ✔️
github.com/nobl9/govy/internal/messagetemplates 89% 89% ✔️
github.com/nobl9/govy/internal/stringconvert 86% 86% ✔️
github.com/nobl9/govy/internal/typeinfo 94% 94% ✔️
github.com/nobl9/govy/pkg/govy 94% 94% ✔️
github.com/nobl9/govy/pkg/govytest 100% 100% ✔️
github.com/nobl9/govy/pkg/jsonpath 85% 85% ✔️
github.com/nobl9/govy/pkg/rules 99% 99% ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code minor New functionality with at most minor brekaing changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant