Skip to content

ENG-2516: Add shared clean_version utility for version string sanitization#7345

Open
NevilleS wants to merge 6 commits intomainfrom
ENG-2516-fides-version-detection
Open

ENG-2516: Add shared clean_version utility for version string sanitization#7345
NevilleS wants to merge 6 commits intomainfrom
ENG-2516-fides-version-detection

Conversation

@NevilleS
Copy link
Contributor

@NevilleS NevilleS commented Feb 9, 2026

Ticket ENG-2516

Description Of Changes

In this PR https://github.com/ethyca/fidesplus/pull/3047 we added a clean_version() function to fidesplus to clean up the sometimes-messy version numbers for displaying in the API. This refactors that approach by moving that clean_version() function to fides.common.utils, which enables fidesplus to import and reuse this utility rather than duplicating the code.

Code Changes

  • Added clean_version() function to src/fides/common/utils.py that strips:
    • The dirty suffix (.dirty or -dirty) added when there are uncommitted changes
    • The +0.gXXXXXX suffix when exactly on a git tag (zero commits past)
  • Updated src/fides/__init__.py to import clean_version from common.utils instead of defining it locally
  • Added comprehensive unit tests in tests/lib/test_version.py

Steps to Confirm

  1. Verify clean_version can be imported from fides.common.utils
  2. Run nox -s "pytest(lib)" -- tests/lib/test_version.py to verify tests pass
  3. Confirm version display remains clean in health endpoints

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Made with Cursor

@vercel
Copy link
Contributor

vercel bot commented Feb 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Feb 12, 2026 5:36pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Feb 12, 2026 5:36pm

Request Review

Add a shared clean_version() function to fides.common.utils that removes
noisy suffixes from version strings for cleaner display. This strips:
- dirty suffix (.dirty or -dirty) from uncommitted changes
- +0.gXXXXXX suffix when exactly on a tag

Update fides/__init__.py to import and use the shared utility.
Add comprehensive unit tests for the clean_version function.

Co-authored-by: Cursor <cursoragent@cursor.com>
@NevilleS NevilleS force-pushed the ENG-2516-fides-version-detection branch from 9b02f5e to 4d0ea22 Compare February 11, 2026 16:52
Co-authored-by: Cursor <cursoragent@cursor.com>
@NevilleS NevilleS force-pushed the ENG-2516-fides-version-detection branch from 4d0ea22 to 16e98e1 Compare February 11, 2026 17:14
@NevilleS NevilleS marked this pull request as ready for review February 11, 2026 18:09
@NevilleS NevilleS requested a review from a team as a code owner February 11, 2026 18:09
@NevilleS NevilleS requested review from adamsachs and removed request for a team February 11, 2026 18:09
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 11, 2026

Greptile Overview

Greptile Summary

Refactored version string cleaning by extracting the clean_version() function from local implementation into a shared utility in fides.common.utils. This enables code reuse across the fides and fidesplus repositories.

  • Added clean_version() function to src/fides/common/utils.py that strips dirty suffixes and zero-distance git tags
  • Updated src/fides/__init__.py to import and use the shared utility
  • Added comprehensive test coverage with 87 test cases covering various version string formats
  • Minor issue: test function name on line 26 has a typo (testclean_versions_unchanged should be test_clean_versions_unchanged)

Confidence Score: 4/5

  • Safe to merge after fixing the test function name typo
  • Clean refactoring with comprehensive test coverage. The only issue is a minor typo in the test function name that needs correction before merging to ensure tests run properly
  • Pay attention to tests/lib/test_version.py - fix the function name typo on line 26

Important Files Changed

Filename Overview
src/fides/init.py Refactored to use imported clean_version() from common.utils instead of defining inline
src/fides/common/utils.py Added new clean_version() utility with regex-based version string sanitization
tests/lib/test_version.py Comprehensive test coverage for version cleaning, includes typo in test function name on line 26

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@adamsachs adamsachs left a comment

Choose a reason for hiding this comment

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

nice followup. i assume you'll want a fidesplus PR to switch to using this util, right?

@NevilleS
Copy link
Contributor Author

nice followup. i assume you'll want a fidesplus PR to switch to using this util, right?

Yeah, that one goes here: https://github.com/ethyca/fidesplus/pull/3082

I'm just going to let the dust settle on our current release before merging those two in.

cursoragent and others added 4 commits February 12, 2026 02:44
- scripts/run_lib_tests.sh: runner that configures local Postgres/Redis via env vars
- IMPLEMENTATION-REPORT.md: documents setup, what worked, and what didn't

Requires: PostgreSQL, Redis, uv, Python 3.13. Services must be running locally.

Co-authored-by: Neville Samuell <NevilleS@users.noreply.github.com>
Document what passes (lib, noxfiles) and what partially passes or fails
across api, ctl, ops, service, task, util, qa, integration. Include common
failure patterns: env var leakage, taxonomy seeding, Docker hostnames.

Co-authored-by: Neville Samuell <NevilleS@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

4 participants