Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Conversation

@mattjohnsonpint
Copy link
Contributor

This fixes a bug found with JSON serialization of the Point and Location types used with Postgres and MySQL databases in the AssemblyScript SDK.

@mattjohnsonpint mattjohnsonpint requested review from a team and Copilot May 22, 2025 21:33
@linear
Copy link

linear bot commented May 22, 2025

Copy link
Contributor

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 fixes a bug with JSON serialization and deserialization of the Point and Location types to work correctly with Postgres and MySQL databases. Key changes involve updating the serializer/deserializer methods in both classes to ensure valid JSON strings are output and processed, as well as corresponding adjustments to the test suite.

  • Updated Point and Location classes to use the @JSON decorator.
  • Modified serializer and deserializer methods to throw errors on invalid input.
  • Added comprehensive tests to verify serialization and deserialization functionality.

Reviewed Changes

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

File Description
sdk/assemblyscript/src/tests/database.run.ts Added a new test runner file for database serialization tests.
sdk/assemblyscript/src/assembly/database.ts Updated the Point and Location classes to throw errors in deserializers and corrected the return type in fromString.
sdk/assemblyscript/src/assembly/tests/database.spec.ts Added tests for both Point and Location serialization/deserialization.
CHANGELOG.md Updated changelog to reflect the fix in serialization logic.

@trunk-io
Copy link

trunk-io bot commented May 22, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) May 22, 2025 21:35
@mattjohnsonpint mattjohnsonpint merged commit 21b18f5 into main May 22, 2025
40 checks passed
@mattjohnsonpint mattjohnsonpint deleted the mjp/hyp-3404-serialization-bug-in-db-types branch May 22, 2025 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants