Skip to content

Comments

Preserve source information during CEL policy composition.#1253

Merged
TristonianJones merged 2 commits intogoogle:masterfrom
abenea:sourceinfo
Jan 29, 2026
Merged

Preserve source information during CEL policy composition.#1253
TristonianJones merged 2 commits intogoogle:masterfrom
abenea:sourceinfo

Conversation

@abenea
Copy link
Contributor

@abenea abenea commented Jan 6, 2026

The old implementation outputs the wrong source information for policy files derived from the dummy AST created by RuleComposer.Compose. This change fixes that by preserving the correct source and merging the offset ranges of the rule match expressions inserted by the composer optimizer into the final AST.

@seirl
Copy link
Collaborator

seirl commented Jan 7, 2026

/gcbrun

@abenea abenea force-pushed the sourceinfo branch 5 times, most recently from 2d1165f to 720efc8 Compare January 23, 2026 09:48
The old implementation outputs the wrong source information for policy files derived from the dummy AST created by RuleComposer.Compose. This change fixes that by preserving the correct source and merging the offset ranges of the rule match expressions inserted by the composer optimizer into the final AST.
@TristonianJones
Copy link
Collaborator

/gcbrun

Copy link
Collaborator

@TristonianJones TristonianJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, looks good to me, just one question related to offset computations as it could lead to surprising results in change-detector tests.

@TristonianJones TristonianJones merged commit 450089b into google:master Jan 29, 2026
3 checks passed
@abenea abenea deleted the sourceinfo branch January 30, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants