feat(mutator-framework): add multi-subgraph support and fix TypeScript 6 compatibility#10685
feat(mutator-framework): add multi-subgraph support and fix TypeScript 6 compatibility#10685qiaozha wants to merge 4 commits into
Conversation
…compatibility - Add TypeEdgeSpec interface to mutation-engine for specifying type edges - Extend ModelPropertyMutation.mutate() with optional typeOverride parameter - Add buildTypeEdges() override point for multi-subgraph scenarios - Make startTypeEdge() non-abstract with a helpful error message - Fix TypeScript 6 type cast errors using intermediate unknown casts - Add documentation for replace() vs mutate() usage guidance
commit: |
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
…o TypeEdgeSpec Callers can now pass a self-contained TypeEdgeSpec (referenceToFollow or typeToFollow + halfEdge) instead of a raw Type, making topology changes expressible as pure codecs without needing to subclass or call replaceAndMutateReference() directly.
…m Type to TypeEdgeSpec" This reverts commit 4d53058.
There was a problem hiding this comment.
can you show a bit how you plan on using this?
also is the typescript 6 compatibility part relevant to this PR? we are already using typescript 6 is it just the agent fixing build errors from newly added code that trigger this change entry?
There was a problem hiding this comment.
@timotheeguerin this is to resolve an issue we found on @alternateType decorators with the mutator framework. From my limited understanding, the alternateType decorator replaces the type node itself with a completely different type that must also be traversed and mutated independently, and the current mutation framework doesn't support this. You can refer to this change for more details on how it was used.
Regarding the TypeScript 6 compatibility, it's about we removed the abstract key word of startTypeEdge method and TypeSript 6 would still require every concrete subclass to implement this startTypeEdge if we don't. Which doesn't make sense with this new change as they can just override the new buildTypeEdge method.
Summary
Extends
ModelPropertyMutationwith multi-subgraph support and fixes TypeScript 6 type cast errors that were breaking the monorepo build.Changes
mutation-engine.tsTypeEdgeSpecinterface for specifying type edges duringModelPropertymutation. Supports either atypeToFollow(direct mutate) orreferenceToFollow(reference-chain resolution viamutateReference()).model-property.tstypeOverrideparameter tomutate()— an escape hatch to redirect the type edge to an explicit type without overridingbuildTypeEdges().buildTypeEdges()override point for multi-subgraph scenarios where a property needs independent type edges per subgraph.startTypeEdge()non-abstract with a descriptive error message (throw if neither override is provided).unknowncasts (as unknown as MutationFor<...>).mutation-node.tsreplace()to clarify when to usereplace()vsmutate()and prevent misuse.Usage example