SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Fix fields named 'read'

Open kazimuth opened this issue 8 months ago • 4 comments

Description of Changes

Fixes https://github.com/orgs/clockworklabs/projects/22?pane=issue&itemId=102392974&issue=clockworklabs%7Ccom.clockworklabs.spacetimedbsdk%7C276

by renaming internal static serializer fields so that they do not overlap with user-provided names.

Note, however, that some field names still will not work: ReadFields, WriteFields, Equals, and GetHashCode. This would require a separate fix since the error would happen in a different place. In this case we would need to change the name of the generated member to something like ReadFields_ or Equals_, which I'm not sure is a good idea.

API and ABI breaking changes

N/A

Expected complexity level and risk

0

Testing

SDK tests and dotnet-verify tests are passing.

kazimuth avatar Mar 28 '25 19:03 kazimuth

Note, however, that some field names still will not work: ReadFields, WriteFields, Equals, and GetHashCode. This would require a separate fix since the error would happen in a different place. In this case we would need to change the name of the generated member to something like ReadFields_ or Equals_, which I'm not sure is a good idea.

Makes sense. What do you think @jdetter?

joshua-spacetime avatar Mar 29 '25 02:03 joshua-spacetime

I don't super care about Equals or HashCode because I don't think we want users overriding these anyway. I think we should fix the cases for ReadFields and WriteFields because I could easily see someone creating a table that has a column with those names. (e.g. if you made a permissions table or something)

@kazimuth @joshua-spacetime does that sound good?

jdetter avatar Mar 31 '25 21:03 jdetter

@kazimuth Does this actually not have any API/ABI breaking changes? This doesn't require a C# SDK change?

jdetter avatar Apr 12 '25 19:04 jdetter

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 03 '25 18:05 CLAassistant

Needs to be rebased once https://github.com/clockworklabs/SpacetimeDB/pull/2710 is merged, that's higher priority

kazimuth avatar May 12 '25 17:05 kazimuth

Attempting to merge master with this PR ran into build issues, mostly due to conflicts with #2725 . I am working to resolve the conflicts and get another build going. I have an initial version ready that I need to test locally before pushing it to this PR.

rekhoff avatar Aug 19 '25 00:08 rekhoff

After additional fixes, all tests pass. I have tested the most recent changes against BitCraft and other minor tests, without issue. I am making myself as an Assignee, due to the additional work. With that in mind, @jdetter would you mind reviewing/approving the changes?

rekhoff avatar Aug 25 '25 23:08 rekhoff

Tested this change against the "fixture" test and adding the fields to a quickstart-chat project. Both succeeded (after a minor complication error that is now patched)

rekhoff avatar Aug 26 '25 18:08 rekhoff