Skip to content

Workbench Schema Inspector (Phases 1 + 2) + engine EntityMap persistence fix + tooling - #260

Merged
nockawa merged 1 commit into
mainfrom
feature/258-schema-inspector
Apr 23, 2026
Merged

nockawa merged 1 commit into
mainfrom
feature/258-schema-inspector

Conversation

@nockawa

@nockawa nockawa commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Closes #255, closes #256. Resolves #258 (partially — #257 deferred on Data Browser module 06).

Schema Inspector module — Phase 1 (#255)

  • Server: SchemaService with ListComponents / GetComponentSchema; DTO records; SchemaController with [RequireBootstrapToken][RequireSession] + Invoke<T> error mapping.
  • Client: SchemaBrowserPanel (shadcn Table, fuse.js fuzzy search, 4 quick-filter chips), SchemaLayoutPanel (canvas renderer for the byte grid), useSchemaInspectorStore zustand slice.
  • Engine: DatabaseEngine.GetAllComponentTables promoted to public.
  • Tests: SchemaControllerTests, SchemaServiceTests, SchemaLayoutRenderer.test.ts, schema-inspector.spec.ts.

Schema Inspector module — Phase 2 (#256)

  • Three new panels + hooks: SchemaArchetypePanel, SchemaIndexPanel, SchemaRelationshipsPanel (with SchemaRelationshipsGraph using @xyflow/react + dagre).
  • Server: GetArchetypesForComponent, GetIndexesForComponent, GetSystemRelationships (runtime-gated envelope).
  • DatabaseEngine.GetArchetypeEntityCount / GetArchetypeClusterChunkCount, ArchetypeMetadata.GetComponentTypes / UsesClusterStorage.
  • Archetype Browser added (top-level, sibling to Component Browser).

Engine: EntityMap persistence fix

Regression: _entryCount in RawValuePagedHashMap was only flushed to disk on bucket splits — small archetypes that never split showed 0 entities after reopen. Fixed via new PagedHashMapBase.FlushMeta(cs) called from PersistArchetypeState on engine dispose. Regression test Persist_ThenReopen_EntityCount_Survives. Crash-path recomputation tracked separately as #259.

Engine cleanup

  • Removed stale [Ignore]s on Persist_ThenTamper_ComponentCount_Throws + Persist_ThenTamper_Revision_Throws.
  • Deleted dead _archetypesTable field + single assignment.
  • Refreshed misleading comments in DatabaseEngine.InitializeArchetypes + EngineLifecycle.

ALC Type-staleness fix

ArchetypeRegistry.RefreshSlotTypes() — called by EngineLifecycle after EnsureFinalized. The Workbench spins up a fresh collectible ALC each session; EnsureFinalized short-circuits on pre-registered archetype ids, leaving _slotToComponentType pointing at the first ALC's Type instances. RefreshSlotTypes replays ComponentTypeById into every archetype's slot array so the Workbench's reflection-equality lookups match the session's engine.

Fixture project migration

Typhon.Workbench.Fixtures moved from test/ to tools/. Generator logic promoted from a [Ignore]d NUnit test into internal static FixtureDatabase.CreateOrReuse(outputDir, force). InternalsVisibleTo("Typhon.Workbench") added so the Workbench (DEBUG-gated) can call it directly. FixturesController (whole file wrapped in #if DEBUG) + Dev Fixture tab in the Connect dialog + fifth "Dev Fixture" button on the Welcome screen. Capability probe via GET /api/fixtures/capability so the UI hides itself on Release builds.

UX polish (Schema Inspector area)

  • StatusBadge factored out; applied to storage pills, runtime-not-hosted, indexed/cross-boundary chips
  • Schema Layout canvas reads live CSS theme tokens (--background, --primary, --destructive, …) via MutationObserver on <html>'s class list — repaints on dark/light toggle
  • fitText binary-search ellipsis truncation instead of fillText's squish-width
  • Index glyph in bottom-right of each field cell (bookmark polygon)
  • Selection wash via rgba(0,0,255,0.15) + ::before pseudo extending ±4px beyond the row
  • Color legend overlay (Info icon → Tooltip with swatches)
  • Centered hex offset gutter
  • HoverPeek replaces the click-popover for quick field inspection
  • DetailPanel polymorphic — most-recent-touch wins between schema-field and resource-tree selection
  • simplifyTypeName renders CLR assembly-qualified names (Name``N[[...]]) as Name<Arg> + keeps full name in tooltip
  • FieldDetailPopover.tsx removed
  • Component Layout tooltip + StatusBadge-for-contrast cleanups across panels
  • Logs view newest-on-top, select-text opt-in (app default is now select-none — more app-feel, less web-feel)
  • Native title tooltip on resource-tree rows (name + kind)

Tooling

  • /new-panel skill — scaffolds a new Workbench panel (server DTOs/service/controller/tests + client hooks/store/panel/context-menu/tests + wiring + Playwright canary) that compiles on first invocation
  • /wb-dev rewritten — start | stop | status | restart with file-based PID tracking (.claude/state/wb-dev.json). Discovery via netstat poll + PowerShell Get-CimInstance command-line match; tree-kill via taskkill /F /T.
  • /create-issue skill updated with native GitHub Sub-issues API guidance
  • .claude/state/ added to .gitignore

Deferred / tracked separately

Test plan

  • dotnet test test/Typhon.Engine.Tests --filter SchemaVersioning — 11/11
  • dotnet test test/Typhon.Workbench.Tests --filter Schema — 25/25
  • cd tools/Typhon.Workbench/ClientApp && npm test -- --run — 97/97
  • npx playwright test e2e/schema-inspector.spec.ts — 9/9
  • npx tsc --noEmit + npm run lint — clean

@nockawa
nockawa merged commit 4aab184 into main Apr 23, 2026
6 checks passed
@nockawa
nockawa deleted the feature/258-schema-inspector branch April 23, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant