Repository navigation
C# submodules - #5974
C# submodules#5974lisandroct wants to merge 50 commits into
Conversation
7ee3c50 to
ab24ef3
Compare
03252b0 to
3d1b967
Compare
JasonAtClockwork
left a comment
There was a problem hiding this comment.
Everything works as intended but I did find some differences between how the TypeScript submodules work compared against the C#. I'm not certain if any of these are real problems so we may want a discussion around them:
- HTTP routes from submodules are ignored in TypeScript but are bound to the root in C# (which can cause collisions)
- TypeScript supports nested submodules, and generating a C# client against a TypeScript module with nested submodules causes
spacetime generateto panic - TypeScript submodules are declared, not discovered. C# discovers every referenced module and merges anything not mounted into the root (master currently just ignored them), which can cause collisions with the root's reducers, Init, or types and allows access to root env variables.
Super low priority: Codegen.Tests fails on Windows however is fine on Linux
The proposal doesn't say anything about HTTP handlers. I decided to not ignore them, but it might be better to do so.
The proposal only describes submodules being defined in root and I was under the impression that the plan was to not support nested submodules, so I just didn't add support to them. But now I'm not sure. Maybe we do want them?
The proposal states: "A library added as a dependency and otherwise ignored still has its tables register in public, exactly as today; what changes is that the consumer can redirect them to a named namespace via a mount declaration". So I understand the behavior on this branch is the desired one. All dependencies are registered in public unless root defines a namespace for them. |
3d1b967 to
6278735
Compare
jdetter
left a comment
There was a problem hiding this comment.
I think I'm only required for the CI change and that looks fine to me. I didn't review any of the other code.
ad38fb3 to
7f91b8f
Compare
Description of Changes
Implements C# submodules (namespacing), following the proposal and reusing the existing V10 submodule representation.
[Namespace(typeof(AuthLib.Marker), Accessor = "MyAuth", Name = "auth_data" )]declarations.Accessorcontrols C# access; optionalNamespecifies the canonical database namespace. When omitted, the host derives it using the root module’s case-conversion policy. Dependencies without a namespace declaration register in public.ctx.Db.MyAuth.User;library helpers retainctx.Db.Userand use the caller’s context and transaction.API and ABI breaking changes
No changes to host, it uses the existing
RawSubmoduleV10for accessor namespaces and the existingExplicitNamesnamespace mappings for canonical names.On .NET 10, contexts move from generated module types into Runtime, changing their assembly identity. Existing standalone .NET 8 modules retain generated contexts.
Rollback safety impact
n/a
Expected complexity level and risk
4/5. This PR touches a lot of systems: source generation, runtime registration, NativeAOT publication, schema composition, function dispatch, client generation, subscriptions, ... possibly more.
The main risks are incorrect assembly ownership or dispatch ordering, cross-namespace lookup mistakes, NativeAOT export/trimming behavior, and regressions in existing flat modules.
Testing
MyAuth→auth_data) and default namespace case conversion (MyAuth→my_auth).