Skip to content

Comprehension Pattern Matching is Brittle #44

@richardwooding

Description

@richardwooding

Summary

analyzeComprehensionPattern() uses fragile AST pattern matching that could misidentify custom patterns.

Location

comprehensions.go:78-150

Issue

Pattern matching based on accumulator types and step structure could incorrectly classify non-standard comprehensions.

Impact

Medium - Potential misidentification leading to incorrect SQL.

Recommendation

  • Add more robust validation
  • Check result expression matches expected pattern
  • Add tests for edge cases
  • Consider using CEL metadata if available

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions