[CONTP-2223] Cover DDGR fields and preserve monitor hash precision #3754
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 471 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.368
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3754"
general
weight: 0.35
levan-m
What does this PR do?
Follow-up to #3743, targeting
levan/monitor-force-sync-remote-hash, with three commits:1. Include supplied DDGR fields in monitor hashes. Add the top-level keys from
jsonSpecto the existing definition fields and assets. The Go SDK preserves unknown keys throughAdditionalProperties, so this detects drift in fields used before an SDK upgrade. If a supplied field is missing from the API response, keep the hash empty and retain force updates. The existing restriction-policy fallback remains.2. Preserve JSON number precision. Use
json.Decoder.UseNumberwhile building the hash projection. Adjacent integers such as9007199254740992and9007199254740993must produce different hashes, including insideoptions.3. Document response-only fields. Note in the DDGR docs and in a code comment that every top-level
jsonSpecfield is hashed, so response-only fields belong out ofjsonSpec.Motivation
Addresses the DDGR allowlist review comment on #3743. A DDGR field can be sent successfully through the typed SDK yet be absent from the fixed hash projection, allowing external edits to go unnoticed.
The number change is defensive hardening discovered during adversarial review: converting SDK-preserved JSON numbers to
float64can erase a real difference before hashing. No current writable monitor API field requiring integers of this size was identified.Additional Notes
jsonSpec(such asstateoroverall_state) are hashed too, so they cause extra updates. This is deliberate: a list of fields to filter out would bring back the risk of hiding drift if it wrongly excluded a writable field, while hashing them only costs updates. The DDGR docs now ask users to keep response-only fields out ofjsonSpec, as the migration guide'sjqstep already does.Minimum Agent Versions
No minimum Agent versions; this only affects Operator monitor hashing.
Agent: N/A
Cluster Agent: N/A
Describe your test plan
UseNumber.GOTOOLCHAIN=go1.26.10 go test ./internal/controller/datadoggenericresource ./internal/controller/datadogmonitor ./internal/controller/utils -count=1— passed.GOTOOLCHAIN=go1.26.10 make lint— passed, zero issues.These follow-up commits have not been live-tested against Datadog; the earlier kind QA covered parent commit
f39c86866.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel[1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits