Phase 7b: page render plans — per-page boundary optimizer

Add page-render-plan to deps.sx: given page source + env + IO names,
computes a dict mapping each needed component to "server" or "client",
with server/client lists and IO dep collection. 5 new spec tests.

Integration:
- PageDef.render_plan field caches the plan at registration
- compute_page_render_plans() called from auto_mount_pages()
- Client page registry includes :render-plan per page
- Affinity demo page shows per-page render plans

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 00:02:53 +00:00
parent a70ff2b153
commit 2da80c69ed
14 changed files with 214 additions and 5 deletions

View File

@@ -49,7 +49,7 @@
;; --- Main page component ---
(defcomp ~affinity-demo-content (&key components)
(defcomp ~affinity-demo-content (&key components page-plans)
(div :class "space-y-8"
(div :class "border-b border-stone-200 pb-6"
(h1 :class "text-2xl font-bold text-stone-900" "Affinity Annotations")
@@ -154,6 +154,35 @@
(td :class "px-3 py-2 font-bold text-orange-700" "server")
(td :class "px-3 py-2 text-stone-600" "Both affinity and IO say server"))))))
;; Per-page render plans
(~doc-section :title "Page Render Plans" :id "plans"
(p "Phase 7b: render plans are pre-computed at registration time for each page. The plan maps every component needed by the page to its render target.")
(when (> (len page-plans) 0)
(div :class "space-y-4 mt-4"
(map (fn (plan)
(div :class "rounded border border-stone-200 p-4"
(div :class "flex items-center justify-between mb-3"
(div
(span :class "font-mono font-medium text-stone-800" (get plan "name"))
(span :class "text-stone-400 ml-2 text-sm" (get plan "path")))
(div :class "flex gap-2"
(span :class "inline-block px-2 py-0.5 rounded text-xs font-bold bg-orange-100 text-orange-700"
(str (get plan "server-count") " server"))
(span :class "inline-block px-2 py-0.5 rounded text-xs font-bold bg-green-100 text-green-700"
(str (get plan "client-count") " client"))))
(when (> (get plan "server-count") 0)
(div :class "mb-2"
(span :class "text-xs font-medium text-stone-500 uppercase" "Server-expanded: ")
(span :class "text-sm font-mono text-orange-700"
(join " " (get plan "server")))))
(when (> (get plan "client-count") 0)
(div
(span :class "text-xs font-medium text-stone-500 uppercase" "Client-rendered: ")
(span :class "text-sm font-mono text-green-700"
(join " " (get plan "client")))))))
page-plans))))
;; How it integrates
(~doc-section :title "How It Works" :id "how"
(ol :class "list-decimal list-inside text-stone-700 space-y-2"