fix(adminui): register the /dev/context-menu-demo route only in DEBUG builds (R04 S7)

The dev-only demo page shipped routable in the production assembly. Its route
moves from @page to a code-behind [Route] under #if DEBUG, so a Release build
keeps the component type (nothing referencing it breaks) but has no /dev/*
route. The page-authorization guard classifies it under #if DEBUG, and
DevRouteGatingTests asserts each configuration's half (Debug: exactly the demo
route; Release: none) with a positive control. Both configurations pass.

Refs #745
Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
This commit is contained in:
Joseph Doherty
2026-10-22 17:57:54 -04:00
parent 746267c2a2
commit f12573d3fa
4 changed files with 64 additions and 1 deletions
@@ -1,4 +1,5 @@
@page "/dev/context-menu-demo"
@* The /dev/context-menu-demo route lives in ContextMenuDemo.razor.cs behind #if DEBUG (R04 S7), so a
Release build ships the component but no route to it. *@
@* Dev-only host page to live-verify the reusable ContextMenu component. *@
@attribute [Authorize(Policy = AdminUiPolicies.AuthenticatedRead)]
@rendermode InteractiveServer
@@ -0,0 +1,16 @@
namespace ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Dev;
/// <summary>
/// Dev-only host page that live-verifies the reusable <c>ContextMenu</c> component. The route is
/// compiled only into DEBUG builds (R04 S7): a Release (production) build keeps the component type —
/// so nothing that references it breaks — but registers no <c>/dev/*</c> route, and the router never
/// serves it.
/// </summary>
#if DEBUG
[Microsoft.AspNetCore.Components.Route(RoutePath)]
#endif
public partial class ContextMenuDemo
{
/// <summary>The DEBUG-only route.</summary>
public const string RoutePath = "/dev/context-menu-demo";
}