-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookup lifecycle reducers by lifecycle flag, not by name #2132
Conversation
Considering we were able to add windows to CI, how difficult would it be to add CSharp modules to the smoketests? |
I think @RReverser was working on that? That might've been the wrong impression though |
Windows is not a requirement for that, as we already run unit and integration tests for C# modules in Linux-based Github Actions with no issues. It's just a matter of someone actually writing said tests. Here we don't even need smoketests actually, integration tests are enough. C# modules were already emitting correct modules and we have a test for connect/disconnect events. The problem is that Rust counterpart wasn't (isn't?) ready yet, so our tests have to match Rust naming, which hid the issue that occurs when using custom reducer names. Once Rust is fixed to preserve custom reducer names as well (#1891), we'll just need to change the names of reducers in SpacetimeDB/modules/sdk-test-connect-disconnect-cs/Lib.cs Lines 19 to 30 in c240426
|
That might be outdated comment. They used to be sort, but they must not be - in fact, that was the cause of an issue fixed by #1987. |
If I just make that change as part of this, it'll fix the testing issue, and it's really pretty straightforward. |
That does sound great. Once you fix the Rust bindings to preserve reducer names, the |
b120386
to
e7917dd
Compare
@RReverser they seem to not be failing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on my codeowned files (I didn't review the rest of the PR).
Hmm. Probably because those reducers are ignored by ponder_auto_migrate because we filter them out now.
We used to preserve them so they were exposed both as regular reducers and as event handlers, but the filtering logic changed as part of this PR. We'll need to enhance the diffing test to account for those hidden reducers in the future, but for now can you change connect-disconnect's Lib.cs to match the rust version regardless please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved once my caveat is addressed.
(In retrospect I wish we'd just done reducer_id_from_name
but it's too late now.)
Description of Changes
I uplifted the
ReducerId
lookup stuff frommodule_host
intoschema
, so that it lets theModuleHost
look up lifecycle reducers by their ids. I was a bit confused aboutReducersMap
, since it claimed to sort the reducer names but afaict did nothing of the sort. Is it that theRawReducerDefV9
s supposed to be sorted? Cause if so I can't find any validation code enforcing it.Expected complexity level and risk
2
Testing
It's not possible to fully test this since we don't have csharp modules in smoketests yet, but the
test_lifecycle_reducers_cant_be_called
test still passes andhost
doesn't mention the dunderscore names at all.