Skip to content

serialize as str when field is UUID type#11

Open
juggler31 wants to merge 2 commits intomasterfrom
serialize_uuid
Open

serialize as str when field is UUID type#11
juggler31 wants to merge 2 commits intomasterfrom
serialize_uuid

Conversation

@juggler31
Copy link
Collaborator

Il y avait des warnings lors de la sérialization d'un objet UUID.

@juggler31 juggler31 force-pushed the serialize_uuid branch 4 times, most recently from 352dd6a to dfdf577 Compare March 3, 2026 10:30
@coveralls
Copy link

coveralls commented Mar 3, 2026

Coverage Status

coverage: 77.583% (-0.06%) from 77.647%
when pulling c21c3fa on serialize_uuid
into 6395159 on master.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses UUID serialization warnings by serializing uuid.UUID values as strings, and updates CI to adjust the Python/Django test matrix and GitHub Actions versions.

Changes:

  • Serialize uuid.UUID fields as str in _serialize_field to avoid JSON serialization warnings.
  • Remove Python 3.7 from the GitHub Actions matrix and update Actions used in the workflow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tracking_fields/tracking.py Adds explicit UUID handling in field serialization.
.github/workflows/python-app.yml Updates Python version matrix and bumps GitHub Actions versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 30 to +37
- django_version: '4.0'
python_version: '3.7'
python_version: '3.8'

- django_version: '4.1'
python_version: '3.7'
python_version: '3.8'

- django_version: '4.2'
python_version: '3.7'
python_version: '3.8'
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The matrix exclude list was previously excluding Python 3.7 for Django 4.x (unsupported). Now that 3.7 is removed from the matrix, these entries were changed to exclude Python 3.8 instead, which is a supported combination for Django 4.0/4.1/4.2 and is also covered in tox. This unintentionally drops CI coverage for Python 3.8 on Django 4.x; remove these exclude items (or adjust them to only exclude truly unsupported pairs, e.g. Django 4.0 with Python 3.11).

Copilot uses AI. Check for mistakes.
Comment on lines +148 to +149
if isinstance(field, uuid.UUID):
return json.dumps(str(field), ensure_ascii=False)
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

This adds special-casing for uuid.UUID serialization, but there is no test asserting the resulting stored values (and that the warning log path is no longer used). Please add/extend a test that tracks a UUIDField (or tracks the UUID primary key) and asserts the persisted TrackedFieldModification JSON contains the plain UUID string rather than a UUID('...') repr, and ideally that no serialization warning is emitted.

Copilot uses AI. Check for mistakes.
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.

3 participants