Regenerate C schema headers for Policy.id string field#77
Conversation
bd89a17 to
3fee540
Compare
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 31159b8 | Docs | Datadog PR Page | Give us feedback! |
3fee540 to
cb694fe
Compare
| /** Stable identifier for this policy, used to attribute an evaluation outcome | ||
| * back to its source. For Remote Config policies this is the rule's UUID; | ||
| * for hardcoded/built-in policies it is the sentinel "hardcoded". */ | ||
| __flatbuffers_define_string_field(3, dd_wls_Policy, id, 0) |
There was a problem hiding this comment.
Are we sure this is backward compatible with existing policies already in flatbuffer?
There was a problem hiding this comment.
Yes. This would be a breaking wire-format change for any buffer where id was already populated. However, I checked both ways a Policy buffer gets built and confirmed that neither of them already populated the id field:
- dd-policy-engine's converters never called
PolicyAddIdanywhere in this repo before PR Stamp hardcoded policies with id="hardcoded" #75 - RC policies are compiled via
dd-compile-policyfrom JSON, but that JSON has never contained a real id either.
Since FlatBuffers vtables mark an unset field as explicitly absent, every buffer compiled by either path so far has that slot empty, and the new reader will correctly see the field absent rather than reinterpreting old struct bytes as a string offset. This would only be unsafe if some buffer out there already had a real non-zero id, and nothing does yet.
This PR regenerates the C schema headers (
policy_reader.h,policy_builder.h,policy_verifier.h) viaflatcc, which were stale sincePolicy.idchanged from a UUID struct to a string in #74.