Skip to content

cleanup: remove unused sanitize_encrypted param from diff function#958

Open
VedantMadane wants to merge 1 commit intoansible:develfrom
VedantMadane:cleanup/diff-unused-param
Open

cleanup: remove unused sanitize_encrypted param from diff function#958
VedantMadane wants to merge 1 commit intoansible:develfrom
VedantMadane:cleanup/diff-unused-param

Conversation

@VedantMadane
Copy link

@VedantMadane VedantMadane commented Mar 2, 2026

Fixes #688. This PR removes the unused \sanitize_encrypted\ parameter from the \diff\ utility and its helper _sanitize_value, and corrects the return type in the docstring.

Summary by CodeRabbit

Refactor

  • Updated the diff comparison logic to consistently handle encrypted values without requiring configuration.

This PR removes the unused 'sanitize_encrypted' parameter from the 'diff' utility function and its helper '_sanitize_value'.

Also updated the return docstring to correctly state that the function returns a 'ModelDiff' object instead of a dictionary.
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

DVCS PR Check Results:

Could not find JIRA key(s) in PR title, branch name, or commit messages

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between e956f20 and 0b10a57.

📒 Files selected for processing (1)
  • ansible_base/lib/utils/models.py

📝 Walkthrough

Walkthrough

The sanitize_encrypted parameter is removed from the _sanitize_value and diff functions in the models utility module. Encryption flag handling is now always enabled during value sanitization. The diff function's docstring is corrected to reflect its return type as ModelDiff instead of dict.

Changes

Cohort / File(s) Summary
Function Signature & Logic Updates
ansible_base/lib/utils/models.py
Removed unused sanitize_encrypted parameter from _sanitize_value() and diff() function signatures. Updated all internal calls to these functions. Corrected diff() docstring to document return type as ModelDiff object rather than dict. Encryption handling now always enabled.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing the unused sanitize_encrypted parameter from the diff function.
Linked Issues check ✅ Passed The PR addresses both objectives from issue #688: removes the unused sanitize_encrypted parameter and corrects the docstring to state the function returns a ModelDiff object.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue #688: parameter removal and docstring correction. No out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

ansible_base.lib.utils.models.diff takes unused sanitize_encrypted param and has outdated return docstring

1 participant