Skip to content

Revert Policy.id back to UUID struct#81

Merged
annacai21 merged 1 commit into
mainfrom
anna.cai/revert-id-schema-change
Jul 13, 2026
Merged

Revert Policy.id back to UUID struct#81
annacai21 merged 1 commit into
mainfrom
anna.cai/revert-id-schema-change

Conversation

@annacai21

@annacai21 annacai21 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

#74 changed Policy.id from a UUID struct ({hi:ulong, lo:ulong}) to a string, so RC-delivered policies could carry a real rule UUID instead of an always absent field. This looked backwards-compatible on the read side (FlatBuffers absent-field guarantee covers old binaries being read by new code), but breaks on the compile side: dd-compile-policy's JSON parser has the schema hardcoded in, and there's no current way to remotely update the compiler binary. It's vendored into datadog-agent via a version pin here, not delivered via Remote Config.

I tested against the currently released dd-compile-policy binary (v0.1.13):

  • A policy JSON with "id": "<uuid-string>" fails: Failed to parse JSON: ... expecting: { instead got: string constant.
  • A policy JSON with any new/unrecognized field (e.g. rule_id) also fails: Failed to parse JSON: ... unknown field: ....

Both failure modes mean any host running an already-deployed dd-compile-policy would start failing to compile policies the moment RC starts emitting the new content in the JSON payload, with no way to force those hosts to upgrade first.

Reverting to the UUID struct avoids this: the field shape is unchanged from what's already deployed everywhere, so instead of a string, the real rule UUID gets encoded into hi/lo.

Hardcoded/built-in policies are identified as hardcoded because they simply omit id.

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 13, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 21.66%

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4f36291 | Docs | Datadog PR Page | Give us feedback!

@natitsechanski natitsechanski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@annacai21 annacai21 merged commit b4378cb into main Jul 13, 2026
14 checks passed
@annacai21 annacai21 deleted the anna.cai/revert-id-schema-change branch July 13, 2026 19:26
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.

2 participants