From db72a67e8c12539840920fe385912fe86b2f9c5c Mon Sep 17 00:00:00 2001 From: fedorovvvv Date: Sat, 9 May 2026 17:25:30 +0400 Subject: [PATCH 1/7] fix(template): proper Retry button and Lucide arrows in Timeline toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace ghost variant with secondary on CLI error Retry button so it has a visible border and background against the danger banner - Add RotateCcw icon to the Retry button for clear affordance - Replace unicode ▴/▾ characters in Timeline toggle with ChevronUp / ChevronDown from @lucide/svelte for consistent pixel-grid alignment Co-Authored-By: Claude Sonnet 4.6 --- template/src/pages/home/ui/HomePage.svelte | 5 +++-- template/src/widgets/timeline/ui/Timeline.svelte | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/template/src/pages/home/ui/HomePage.svelte b/template/src/pages/home/ui/HomePage.svelte index 1a64997..e2c7589 100644 --- a/template/src/pages/home/ui/HomePage.svelte +++ b/template/src/pages/home/ui/HomePage.svelte @@ -25,6 +25,7 @@ import { Timeline, snapshotStore } from '@/widgets/timeline'; import { VersionFooter } from '@/widgets/version-footer'; import { Alert, Button } from '@/shared/ui'; + import RotateCcw from '@lucide/svelte/icons/rotate-ccw'; import type { ArtifactKind, ArtifactStatus } from '@/entities/artifact'; import { MosaicCanvas, @@ -291,10 +292,10 @@
{globalError} + >Retry
{/if} diff --git a/template/src/widgets/timeline/ui/Timeline.svelte b/template/src/widgets/timeline/ui/Timeline.svelte index 196156d..85282c9 100644 --- a/template/src/widgets/timeline/ui/Timeline.svelte +++ b/template/src/widgets/timeline/ui/Timeline.svelte @@ -14,6 +14,8 @@ type TimelineEvent } from '../index'; import { Button } from '@/shared/ui'; + import ChevronDown from '@lucide/svelte/icons/chevron-down'; + import ChevronUp from '@lucide/svelte/icons/chevron-up'; const SCRUBBER_DEBOUNCE_MS = 200; const TIMELINE_HEIGHT_PX = 60; @@ -166,7 +168,7 @@ aria-controls="timeline-body" aria-label={snapshotStore.collapsed ? 'Expand timeline' : 'Collapse timeline'} > - {snapshotStore.collapsed ? '▴ Timeline' : '▾ Timeline'} + {#if snapshotStore.collapsed}TIMELINE{:else}TIMELINE{/if} {#if snapshotStore.mode === 'now'} From 0c0ce796338461310336a0eec895b31c4a0f68ef Mon Sep 17 00:00:00 2001 From: fedorovvvv Date: Sat, 9 May 2026 17:55:05 +0400 Subject: [PATCH 2/7] fix(registry): heartbeat re-registers on race-lost entries; ghost combobox variant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bin/commands/start.mjs: Replace heartbeat(id) with register({...entry, heartbeatAt}) in the interval so a lost registry row (concurrent write race, ADR-004 §5) is automatically re-added within 30 s instead of staying gone forever. Extract instanceEntry once; heartbeat ticks spread it. bin/lib/registry.mjs: Add TODO on heartbeat() silent-skip-if-missing gap; fix stale "Heartbeat reconciles" comment in deregister(). template/src/shared/ui/combobox: Add ghost variant — transparent chrome that blends into the header bar. Change icon from ChevronDown to ChevronsUpDown (no rotation on open; bidirectional icon fits a select control better). Add ghost-sm + ghost-md entries to playground showcase (rule 24). template/src/entities/instance/api/store.ts: Reduce instance poll interval 3 s (was 5 s) for faster new-instance detection in the switcher combobox. template/src/widgets/health-bar/ui/HealthBar.svelte: Use ghost variant for the instance switcher so it blends into the monospace header. Co-Authored-By: Claude Sonnet 4.6 --- bin/commands/start.mjs | 39 ++++++++++--------- bin/lib/registry.mjs | 8 +++- template/src/entities/instance/api/store.ts | 2 +- template/src/routes/playground/+page.svelte | 4 ++ .../src/shared/ui/combobox/Combobox.svelte | 6 ++- .../shared/ui/combobox/ComboboxTrigger.svelte | 29 ++++++++++++-- .../widgets/health-bar/ui/HealthBar.svelte | 2 +- 7 files changed, 65 insertions(+), 25 deletions(-) diff --git a/bin/commands/start.mjs b/bin/commands/start.mjs index 8c2cb01..7a541c1 100644 --- a/bin/commands/start.mjs +++ b/bin/commands/start.mjs @@ -9,7 +9,6 @@ import { deregister, findFreePort, HEARTBEAT_INTERVAL_MS, - heartbeat, makeInstanceId, PORT_PROBE_MAX_OFFSET, register, @@ -216,23 +215,25 @@ export default defineCommand({ const webVersion = readPkgVersion() ?? "0.0.0"; const forgeplanCli = probeForgeplanCliVersion(); + // Build once; heartbeat ticks re-use this with a fresh heartbeatAt. + // child.pid is set synchronously after spawn returns; if missing (very + // rare, only when spawn failed) fall back to bin pid for a sweepable row. + const instanceEntry = { + id: instanceId, + host, + port, + pid: typeof child.pid === "number" ? child.pid : process.pid, + scope: scaffold.scope, + workspaceRoot: env.FORGEPLAN_CWD, + projectName, + startedAt, + heartbeatAt: startedAt, + webVersion, + forgeplanCli, + }; + try { - register({ - id: instanceId, - host, - port, - // child.pid is set synchronously after spawn returns; if it is missing - // (very rare, only when spawn failed) fall back to bin pid so we still - // have a sweepable row. - pid: typeof child.pid === "number" ? child.pid : process.pid, - scope: scaffold.scope, - workspaceRoot: env.FORGEPLAN_CWD, - projectName, - startedAt, - heartbeatAt: startedAt, - webVersion, - forgeplanCli, - }); + register(instanceEntry); registered = true; } catch (err) { // FIXME(registry-write-failed): non-fatal — instance still serves; UI @@ -243,7 +244,9 @@ export default defineCommand({ if (registered) { heartbeatTimer = setInterval(() => { try { - heartbeat(instanceId); + // Use register() instead of heartbeat() so the entry is re-added if + // it was lost due to a concurrent write race (ADR-004 §5 known gap). + register({ ...instanceEntry, heartbeatAt: new Date().toISOString() }); } catch { // FIXME(heartbeat-write-failed): swallow; sweep on next start fixes. } diff --git a/bin/lib/registry.mjs b/bin/lib/registry.mjs index afdb9a2..f3cfe30 100644 --- a/bin/lib/registry.mjs +++ b/bin/lib/registry.mjs @@ -124,7 +124,8 @@ export function register(entry) { export function deregister(id) { // RACE: read-modify-write window ~5ms. ADR-004 §5 acceptable for ≤10 - // instances; last-writer wins on rename. Heartbeat reconciles within 30s. + // instances; last-writer wins on rename. start.mjs re-registers on every + // heartbeat tick (30s) so any lost entry recovers automatically. const reg = readRegistry(); const next = { version: SCHEMA_VERSION, @@ -134,6 +135,11 @@ export function deregister(id) { return next; } +// TODO(registry-heartbeat-reconcile): this silently no-ops if the entry is +// missing (lost via concurrent register() race). Callers that need +// reconciliation should use register() with a fresh heartbeatAt instead. +// start.mjs was updated to do exactly that; this function is kept for +// external callers / backward-compat. export function heartbeat(id) { const reg = readRegistry(); const idx = reg.instances.findIndex((row) => row.id === id); diff --git a/template/src/entities/instance/api/store.ts b/template/src/entities/instance/api/store.ts index f8417d1..d6becff 100644 --- a/template/src/entities/instance/api/store.ts +++ b/template/src/entities/instance/api/store.ts @@ -1,7 +1,7 @@ import { createPoller } from "@/shared/api"; import type { InstancesPayload } from "../model/types"; -const INSTANCE_POLL_INTERVAL_MS = 5_000; +const INSTANCE_POLL_INTERVAL_MS = 3_000; export const instancePoller = createPoller( "/api/instances", diff --git a/template/src/routes/playground/+page.svelte b/template/src/routes/playground/+page.svelte index 3375fa0..162eb8e 100644 --- a/template/src/routes/playground/+page.svelte +++ b/template/src/routes/playground/+page.svelte @@ -85,12 +85,16 @@ { variant: 'default', size: 'md' }, { variant: 'mono', size: 'sm' }, { variant: 'mono', size: 'md' }, + { variant: 'ghost', size: 'sm' }, + { variant: 'ghost', size: 'md' }, ]; let comboboxValues = $state>({ 'default-sm': '', 'default-md': '', 'mono-sm': '', 'mono-md': '', + 'ghost-sm': '', + 'ghost-md': '', }); diff --git a/template/src/shared/ui/combobox/Combobox.svelte b/template/src/shared/ui/combobox/Combobox.svelte index 4812134..8757b82 100644 --- a/template/src/shared/ui/combobox/Combobox.svelte +++ b/template/src/shared/ui/combobox/Combobox.svelte @@ -1,5 +1,5 @@ @@ -86,4 +86,8 @@ :global(.combobox-md) { font-size: 13px; } + :global(.combobox-ghost) { + font-family: var(--font-mono); + letter-spacing: 0.02em; + } diff --git a/template/src/shared/ui/combobox/ComboboxTrigger.svelte b/template/src/shared/ui/combobox/ComboboxTrigger.svelte index c0f7457..d751d91 100644 --- a/template/src/shared/ui/combobox/ComboboxTrigger.svelte +++ b/template/src/shared/ui/combobox/ComboboxTrigger.svelte @@ -1,7 +1,7 @@ @@ -27,6 +32,7 @@ {side} {align} {sideOffset} + {customAnchor} class={`combobox-content ${className ?? ''}`} > diff --git a/template/src/widgets/health-bar/ui/HealthBar.svelte b/template/src/widgets/health-bar/ui/HealthBar.svelte index 8b053dd..e78b5e8 100644 --- a/template/src/widgets/health-bar/ui/HealthBar.svelte +++ b/template/src/widgets/health-bar/ui/HealthBar.svelte @@ -59,6 +59,7 @@ : undefined, ); const hasOtherInstances = $derived(instances.length >= 2); + let switcherEl = $state(null); function onInstancePick(nextId: string) { if (!nextId) return; @@ -230,7 +231,7 @@ >FORGEPLAN -
+
- - -
- -
+ {#if hasOtherInstances} + {#each sortedInstances as inst (inst.id)} Date: Sat, 9 May 2026 18:36:10 +0400 Subject: [PATCH 6/7] fix(health-bar): rewrite instance switcher with Popover+Command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces bits-ui Combobox with Popover.Root+Portal+Command.Root so the floating layer correctly escapes the header's backdrop-filter stacking context. Previous implementation anchored to ComboboxInput (the FloatingLayer.Anchor inside the portal), causing off-screen positioning and rendering behind the graph toolbar. Key changes: - Popover.Portal ensures content renders at body level (z-index clean) - Command.Empty auto-shows empty state when no instances listed - Command.Item with keywords for search filtering - Ghost trigger button styled via scoped .project-switcher :global() selectors — hover uses color-mix(in srgb, var(--fg) 10%, transparent) for adaptive semi-transparent overlay across all themes Co-Authored-By: Claude Sonnet 4.6 --- .../widgets/health-bar/ui/HealthBar.svelte | 239 +++++++++++++----- 1 file changed, 171 insertions(+), 68 deletions(-) diff --git a/template/src/widgets/health-bar/ui/HealthBar.svelte b/template/src/widgets/health-bar/ui/HealthBar.svelte index e78b5e8..3a33d05 100644 --- a/template/src/widgets/health-bar/ui/HealthBar.svelte +++ b/template/src/widgets/health-bar/ui/HealthBar.svelte @@ -1,4 +1,6 @@