Skip to content

Conversation

@irfanuddinahmad
Copy link
Contributor

This pull request addresses a production issue with circular reference errors during JSON serialization of event data involving MongoDB BSON objects. It introduces converters to handle BSON FixedOffset timezones and ObjectId fields in the PersistentCourseGradeData and CourseData classes, ensuring compatibility and preventing serialization errors. Comprehensive tests have been added to verify the new converters.

Serialization Fixes for BSON Objects:

  • Added _normalize_datetime_timezone converter to replace BSON FixedOffset timezones with standard UTC in the start, end, course_edited_timestamp, and passed_timestamp fields of CourseData and PersistentCourseGradeData to prevent circular reference errors during JSON serialization. [1] [2] [3]
  • Added _convert_objectid_to_str converter to ensure that MongoDB ObjectId values in the course_version field of PersistentCourseGradeData are converted to strings for serialization. [1] [2]

Testing:

  • Added tests/test_bson_converters.py with extensive tests for BSON FixedOffset and ObjectId conversions, including production scenario replication to ensure serialization succeeds without circular reference errors.

Documentation and Versioning:

  • Updated the changelog to document the fix for circular reference errors in event serialization and incremented the package version to 10.5.1. [1] [2]

Checklists

Check off if complete or not applicable:

Merge Checklist:

  • All reviewers approved
  • Reviewer tested the code following the testing instructions
  • CI build is green
  • Version bumped
  • Changelog record added with short description of the change and current date
  • Documentation updated (not only docstrings)
  • Integration with other services reviewed
  • Fixup commits are squashed away
  • Unit tests added/updated
  • Noted any: Concerns, dependencies, migration issues, deadlines, tickets

Post Merge:

  • Create a tag
  • Create a release on GitHub
  • Check new version is pushed to PyPI after tag-triggered build is
    finished.
  • Delete working branch (if not needed anymore)
  • Upgrade the package in the Open edX platform requirements (if applicable)

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.

1 participant