@@ -121,10 +121,10 @@ test("trigger renders a wide row or a rail icon from the wide flag", () => {
121121 ) ;
122122} ) ;
123123
124- // The entry lives ABOVE the workspaces region : the real button is portalled
125- // just before the host's regionArea container (below New Session, above the
126- // workspace list ), while the sidebar.footer.action registration remains as
127- // the React anchor and the in-place fallback when the host markup changes.
124+ // The entry lives at the top of the plugin-entry group : the real button is
125+ // portalled right after the host's New- Session row ( above the entries other
126+ // plugins inject there ), while the sidebar.footer.action registration remains
127+ // as the React anchor and the in-place fallback when the host markup changes.
128128test ( "sidebar entry portals above the workspaces region with footer fallback" , ( ) => {
129129 assert . ok (
130130 clientSource . includes ( 'ctx.slots.inject("sidebar.footer.action"' ) ,
@@ -139,8 +139,8 @@ test("sidebar entry portals above the workspaces region with footer fallback", (
139139 "the portal must anchor at the host's regionArea container"
140140 ) ;
141141 assert . ok (
142- clientSource . includes ( "insertBefore(created, region )" ) ,
143- "the entry must sit immediately above the workspaces region "
142+ clientSource . includes ( "insertBefore(created, target )" ) ,
143+ "the entry must be placed through the idempotent place() helper "
144144 ) ;
145145 assert . ok (
146146 clientSource . includes ( "if (!host) return fallback;" ) ,
@@ -160,6 +160,33 @@ test("sidebar entry portals above the workspaces region with footer fallback", (
160160 ) ;
161161} ) ;
162162
163+ // Issue #130: ecosystem plugins (task board, skill explorer, …) inject their
164+ // own entries right after the New-Session row, and late inserters land above
165+ // earlier ones — a fixed "before regionArea" slot degrades into the tail of
166+ // that group, detaching the memory button from its familiar top spot. The
167+ // entry therefore (a) resolves the same anchor as the ecosystem's shared
168+ // sidebar-entry-core (logoRow row, legacy direct-child button), (b) re-asserts
169+ // its slot from the existing observer, and (c) stays idempotent — the anchor
170+ // check short-circuits before any DOM write, so observers never ping-pong.
171+ test ( "entry re-asserts the New-Session-adjacent slot against ecosystem entries" , ( ) => {
172+ assert . ok (
173+ clientSource . includes ( `btn.closest('[class*="logoRow"]')` ) ,
174+ "the anchor must resolve the New-Session logo row like the ecosystem core"
175+ ) ;
176+ assert . ok (
177+ clientSource . includes ( "const target = anchor ? anchor.nextSibling : region;" ) ,
178+ "the entry must sit right after the New-Session row, falling back before regionArea"
179+ ) ;
180+ assert . ok (
181+ clientSource . includes ( "if (created.parentElement === parent && created.nextSibling === target) return;" ) ,
182+ "placement must be idempotent so the observer never writes on steady state"
183+ ) ;
184+ assert . ok (
185+ / p l a c e \( c u r \) ; \s * \n \s * c o n s t c l s = f i n d N a t i v e \( c u r \) / . test ( clientSource ) ,
186+ "the observer must re-place the entry on childList churn, not just re-sync the class"
187+ ) ;
188+ } ) ;
189+
163190// Three alignment/softness guarantees born from field feedback: (a) the
164191// portalled entry keeps tracking the live New-Session class (host and skin
165192// rewrite it asynchronously, so a mount-time snapshot goes stale), (b) it
0 commit comments