Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: avoid spurious tautology pruning when dealing with certain recursive messages #142

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/evaluator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (bldr *Builder) load(desc protoreflect.MessageDescriptor) MessageEvaluator
}

// loadOrBuild either returns a memoized MessageEvaluator for the given
// descriptor, or lazily constructs a new one. This method is thread-safe via
// descriptor or lazily constructs a new one. This method is thread-safe via
// locking.
func (bldr *Builder) loadOrBuild(desc protoreflect.MessageDescriptor) MessageEvaluator {
if eval, ok := (*bldr.cache.Load())[desc]; ok {
Expand Down
7 changes: 6 additions & 1 deletion internal/evaluator/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ func (m *message) EvaluateMessage(msg protoreflect.Message, failFast bool) error
}

func (m *message) Tautology() bool {
return m.Err == nil && m.evaluators.Tautology()
// returning false for now to avoid recursive messages causing false positives
// on tautology detection.
//
// TODO: use a more sophisticated method to detect recursions so we can
// continue to detect tautologies on message evaluators.
return false
}

func (m *message) Append(eval MessageEvaluator) {
Expand Down
Loading
Loading