Check for previous null values in filtered diffs#640
Conversation
Signed-off-by: Steven Borrelli <steve@borrelli.org>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesTerraform Plan Diff Filtering
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels: Suggested reviewers:
Thanks for the change — any preference on adding a comment in-code explaining the explicit-removal rationale for future readers? 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4cb93d8 to
c743f23
Compare
c743f23 to
1b008da
Compare
Description of your changes
Summary
filteredDiffExistsinpkg/controller/external_tfpluginfw.godiscarded anydiff where the planned value (
Value1) was null, on the assumption that a nullplanned value means "field was never specified." This is correct for fields that
were never set, but it is wrong for Optional non-Computed attributes that a
user explicitly removes: the prior state is non-null, the planned state is null,
and that transition is a real diff that must trigger an Update.
for example:
The result was that removing an optional nested attribute through a Crossplane
claim had no effect — Upjet concluded the resource was up-to-date and never
called the provider's Update RPC.
Fix
Add a second keep-condition to the filter: retain a diff when the planned value
(
Value1) is null and the prior value (Value2) is non-null. This is theunambiguous signature of an explicit removal.
The existing behavior is preserved for all other cases:
Value1nil (child attributes of a null parent object) → still filteredValue1unknown (computed fields) → still filteredFixes #
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
Added table-driven tests in
TestFilteredDiffExistscover the core removal case,the "never specified" case that must stay filtered, and the nested-object removal
scenario where child-attribute diffs have nil
Value1but the parent-level diffcarries the null/non-null transition.