Skip to content

Fixup Ontology#24

Merged
nedtwigg merged 8 commits intomainfrom
ontology
Apr 24, 2026
Merged

Fixup Ontology#24
nedtwigg merged 8 commits intomainfrom
ontology

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

Set a canonical vocabulary for states, entities, and transitions in mouseterm.

nedtwigg and others added 6 commits April 23, 2026 15:01
Introduce docs/specs/ontology.md as the canonical vocabulary for
Session states across six orthogonal layers (Process, Registry, View,
Link, Activity, Snapshot). Define state names, transition verbs, and
the Liskov contract for Registry APIs.

Rewrite layout.md and vscode.md to use ontology vocabulary: resume vs
restore (was overloaded "reconnect"), mount/unmount (was DOM-level
"attach/detach"), dispose (was "destroyTerminal"), ActivityState (was
"SessionUiState"), layoutAtMinimize (was "restoreLayout"), doors
(was "detached"), exact/neighbor reattach (was "restore").

Code identifiers unchanged — this commit is spec prose only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
terminal-registry.ts exports renamed to match the ontology:
  SessionUiState       → ActivityState
  DEFAULT_SESSION_UI_STATE → DEFAULT_ACTIVITY_STATE
  subscribeToSessionStateChanges → subscribeToActivity
  getSessionStateSnapshot → getActivitySnapshot
  getSessionState      → getActivity
  primeSessionState    → primeActivity
  clearPrimedSessionState → clearPrimedActivity
  attachTerminal       → mountElement
  detachTerminal       → unmountElement
  reconnectTerminal    → resumeTerminal
  destroyTerminal      → disposeSession
  destroyAllTerminals  → disposeAllSessions
  focusTerminal        → focusSession
  refitTerminal        → refitSession

Module-level:
  reconnectFromInit    → resumeOrRestore
  reconnectLivePtys    → resumeLiveSessions
  alert-manager.restore() → seed()

Shared types:
  DetachedItem         → DooredItem
  PersistedDetachedItem → PersistedDoor
  DetachDirection      → DoorDirection
  toDetachedItem       → toDooredItem

Pond.tsx identifiers:
  detachPanel          → minimizePane
  onDetach prop        → onMinimize
  'detachChange' event → 'minimizeChange'
  [detached, setDetached] state → [doors, setDoors]
  detachedRef, detachedItems, initialDetached, restoredDetached
    → doorsRef, doorItems, initialDoors, restoredDoors
  findRestoreNeighbor  → findReattachNeighbor (in spatial-nav.ts)

Persisted schema field names (PersistedDoor.restoreLayout,
detachedLayoutSignature, PersistedSession.detached) are unchanged —
they are kept on disk format until Phase D's migration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Storybook:
  WithDetached story         → WithDoors
  DetachedRingingSession     → MinimizedRingingSession
  detachSelectedPane helper  → minimizeSelectedPane

Tests:
  detachSession helper       → minimizeSession
  "detach preserves state"   → "minimize preserves state"

Pond.tsx local variables and comments:
  initialDetachedRef → initialDoorsRef
  nextDetached       → nextDoors
  currentDetached    → currentDoors
  Comments aligned to use "minimize" / "door" vocabulary.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rename fields in the on-disk PersistedSession shape to match the
ontology:

  PersistedSession:
    version               1 → 2
    detached              → doors

  PersistedDoor (was PersistedDetachedItem):
    remainingPanelIds     → remainingPaneIds
    restoreLayout         → layoutAtMinimize
    detachedLayoutSignature → layoutAtMinimizeSignature

Migration path: readPersistedSession(raw) normalizes v1 and v2 blobs
into the current v2 shape. Both session-save (write) and session-restore
and reconnect (read) route through it. Writes are always v2; reads
accept v1 and translate. v1 support can be removed after two releases.

Added session-migration.test.ts covering:
  - v1 → v2 field translation
  - missing optional detached field
  - readPersistedSession accepting v1, v2, and rejecting malformed blobs

In-memory DooredItem interface and downstream consumers (Pond.tsx,
reconnect.ts, session-save.ts, session-restore.ts, stories, tests)
use the v2 field names throughout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Collapse DooredItem into a PersistedDoor-derived type alias, remove
  toDooredItem adapter and the manual reverse-map in doSave.
- Extract PondSelectionKind = 'pane' | 'door' and replace inline unions.
- Route vscode-ext session-state reads through readPersistedSession so
  the extension host accepts v1 blobs and normalizes to v2. Fixes a
  version-check bug (isPersistedSession was still asserting v1).
- Finish retired-term cleanup: rename leftover panelIds locals and
  reconnect/detach comments in Pond.tsx, terminal-registry.ts, and
  platform/types.ts to the ontology vocabulary.
- Drop migration JSDoc that recited the field-rename table.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sweep stragglers missed by Phases A-E so the specs and code fully
match the retired-terms table in ontology.md.

- docs/specs/layout.md: destroyTerminal -> disposeSession;
  findRestoreNeighbor -> findReattachNeighbor;
  PersistedDetachedItem -> PersistedDoor.
- docs/specs/vscode.md: update session schema block to v2 shape
  (doors?: PersistedDoor[], with renamed subfields).
- docs/specs/tutorial.md: detachChange -> minimizeChange.
- website/src/lib/tutorial-detection.ts: hasDetached -> hasMinimized.
- lib/src/lib/terminal-registry.ts: JSDoc/comment verbs align with
  function names (Resume, Unmount).
- vscode-ext/src/extension.ts: drop unused getSavedSessionState and
  saveSessionState imports (both still used in webview-view-provider).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 24, 2026

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 23a25c2
Status: ✅  Deploy successful!
Preview URL: https://c670e24b.mouseterm.pages.dev
Branch Preview URL: https://ontology.mouseterm.pages.dev

View logs

@nedtwigg nedtwigg merged commit 30320ec into main Apr 24, 2026
6 checks passed
@nedtwigg nedtwigg deleted the ontology branch April 24, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant