Skip to content

Commit

Permalink
🐛 Include query prop checksums in execution checksum (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaym authored Jul 15, 2024
1 parent c3d3224 commit 3efe9a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ func (p *Policy) updateAllChecksums(ctx context.Context,
if err != nil {
return err
}

for _, p := range check.Props {
executionChecksum = executionChecksum.Add(p.Checksum)
}
}

// DATA (must be sorted)
Expand Down Expand Up @@ -521,6 +525,10 @@ func (p *Policy) updateAllChecksums(ctx context.Context,
if err != nil {
return err
}

for _, p := range query.Props {
executionChecksum = executionChecksum.Add(p.Checksum)
}
}

// FILTERs (also sorted)
Expand Down
8 changes: 8 additions & 0 deletions policy/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ func TestPolicyChecksums(t *testing.T) {
// effective if the query is taking the mql bits from its base.
b.Queries[0].CodeId = "12345"
},
"query prop changed": func() {
b.Queries[0].Props = []*explorer.Property{
{
Mql: "1 == 1",
Checksum: "1234",
},
}
},
"mrn changed": func() {
p.Mrn = "normal mrn"
},
Expand Down

0 comments on commit 3efe9a3

Please sign in to comment.