fix: FilterVisibility now applies visibility filter to inherited types (extends)#11043
fix: FilterVisibility now applies visibility filter to inherited types (extends)#11043Copilot wants to merge 6 commits into
Conversation
…s (extends) When filtering a model by visibility, the filter is now also applied to base models in the inheritance chain. This ensures that properties with incompatible visibility in base types are properly filtered out. Closes #11036 Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
| ok(!arrA.properties.has("invisible")); | ||
| }); | ||
|
|
||
| it("applies visibility filter to base model (extends)", async () => { |
There was a problem hiding this comment.
Ensure that there is a test over a self referential model, for example, if some type ihas s efl link, it should not produce infinite regress.
There was a problem hiding this comment.
Added a test for a self-referential model (LinkedNode with next?: LinkedNode property) that verifies no infinite regress occurs. The cachedMutateSubgraph cache and the internal seen map in mutateSubgraphWorker prevent infinite recursion. Commit: a7de7ad.
…r-visibility Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Done — merged latest from main, added the self-referential model test, verified all 61 visibility tests pass, and confirmed formatting is correct. The diff only contains the 3 expected files. |
| ok(!baseFiltered.properties.has("id")); | ||
| }); | ||
|
|
||
| it("does not produce infinite regress for self-referential models", async () => { |
There was a problem hiding this comment.
Not quite what I meant. Here I mean a test in which the target test model extends a model that has a self-referential property.
There was a problem hiding this comment.
Updated the test so Child extends LinkedNode where LinkedNode has next?: LinkedNode. This verifies the visibility filter correctly handles the base model's self-referential property without infinite regress. Commit: 1e6c9a4.
…r-visibility Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Co-authored-by: markcowl <1054056+markcowl@users.noreply.github.com>
Done — merged latest main, updated the self-referential test so the target model extends a base with a self-link property, all 61 visibility tests pass, formatting is correct, and the diff contains only the 3 expected files. |
commit: |
FilterVisibilityonly filtered properties directly on a model but ignoredbaseModel, so inherited properties with incompatible visibility passed through unfiltered.Changes
packages/compiler/src/lib/visibility.ts— IncreateVisibilityFilterMutator'sModel.replacehandler, recursively apply the visibility filter mutator tomodel.baseModelwhen presentpackages/compiler/test/visibility.test.ts— Added test cases covering:applyVisibilityFilterAPI with inheritancenext?: LinkedNode) does not produce infinite regress