Skip to content

Workspace layer: Multi-roster management with compilation tracking #282

@amis92

Description

@amis92

Goal

Introduce a WhamWorkspace that manages the current state of catalogues and rosters, provides lazy per-roster compilation tracking, document identity, and change notifications for UI consumers. Analogous to Roslyn's Workspace / Solution / CompilationTracker infrastructure.

Parent epic: #279
Depends on: #280 (SymbolKey), #281 (Incremental compilation)

Problem

Currently there is no centralized state management above RosterEditor:

  • RosterEditor manages a single roster with undo/redo
  • No concept of "the workspace" containing catalogues + multiple rosters
  • No document identity tracking (which source trees changed between versions)
  • No lazy compilation rebuilding — everything is eager
  • No change notification mechanism for UI consumers to react to state changes

Design

Core Components

WhamWorkspace
├── Loaded catalogues (shared CatalogueCompilation from Phase 2)
├── Per-roster state:
│   ├── CompilationTracker (lazily rebuilds RosterCompilation)
│   ├── RosterEditor (undo/redo stack)
│   └── Document identity (source tree tracking)
├── Change notifications for UI
└── Background diagnostics support

WhamWorkspace Responsibilities

  • Catalogue management: Load/unload catalogues, maintain shared CatalogueCompilation
  • Roster management: Open/close rosters, each with its own CompilationTracker
  • Compilation tracking: Lazily rebuild roster compilations when source trees change
  • Document identity: Track which source trees (catalogues, rosters) are loaded, map old↔new across versions
  • Change notifications: Event-based notification when compilations change (for UI refresh, background diagnostics)

CompilationTracker (Per-Roster)

Analogous to Roslyn's RegularCompilationTracker:

internal class CompilationTracker
{
    // Lazily computed compilation, cached until invalidated
    private Lazy<RosterCompilation> lazyCompilation;
    
    // Queue of pending changes (roster tree replacements)
    private ImmutableList<TranslationAction> pendingActions;
    
    // Get or compute the current compilation
    public RosterCompilation GetCompilation();
    
    // Fork: create a new tracker with a pending change
    public CompilationTracker WithRosterTreeChange(SourceTree newTree);
}

Roslyn Analogy

Roslyn Wham
Workspace WhamWorkspace
Solution Immutable snapshot of catalogues + rosters
Project Catalogue or Roster
Document SourceTree
CompilationTracker Per-roster CompilationTracker
TranslationAction Roster tree changes
DocumentId Source tree identity

Tasks

  • Design WhamWorkspace API (load catalogues, open/close rosters)
  • Implement CompilationTracker for lazy per-roster compilation management
  • Implement document identity tracking for source trees
  • Add change notification events (CompilationChanged, RosterStateChanged)
  • Integrate with RosterEditor — workspace-aware editor operations
  • Add support for background diagnostics (compile + validate on background thread)
  • Add tests for workspace lifecycle (load, edit, close)
  • Add tests for multi-roster workspace scenarios
  • Add tests for change notification ordering and consistency

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions