Skip to content

Prepare datamodel for multi-environment - #1765

Merged
juliusmarminge merged 58 commits into
mainfrom
t3code/remote-host-model
Apr 9, 2026
Merged

Prepare datamodel for multi-environment#1765
juliusmarminge merged 58 commits into
mainfrom
t3code/remote-host-model

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Apr 5, 2026

Copy link
Copy Markdown
Member

prep work for multi-environments

Summary

  • Adds a persistent server environment descriptor with stable environment IDs, platform info, server version, and capability flags.
  • Resolves repository identity from Git remotes and threads that metadata into project snapshots, websocket events, and replayed orchestration data.
  • Updates desktop bootstrap plumbing so the UI can read local environment metadata from the host runtime.
  • Expands server and shared contract coverage with new tests for environment persistence, repository identity resolution, and event enrichment.

Testing

  • Not run (PR content drafted from the diff only).
  • bun fmt - Not run.
  • bun lint - Not run.
  • bun typecheck - Not run.
  • bun run test - Not run.

Note

High Risk
High risk because it changes server->client contract payloads (server config/lifecycle + orchestration events), introduces new persisted identifiers, and touches core orchestration snapshot/event plumbing plus client routing/state keys.

Overview
Prepares the app for multi-environment support by introducing a persistent server ExecutionEnvironmentDescriptor (stable environmentId, platform, version, capability flags) and threading it into ServerRuntimeStartup lifecycle events and subscribeServerConfig payloads.

Adds a server-side RepositoryIdentityResolver (git-remote based, cached) and uses it to enrich project snapshot data and orchestration WS replay/live events with repositoryIdentity, including concurrent resolution in ProjectionSnapshotQuery.

Updates desktop IPC/preload to expose a getLocalEnvironmentBootstrap payload, expands tests to wire the new layers, and adjusts timeouts where needed; the web app starts adopting environment-scoped APIs/keys (e.g., environmentApi, scoped refs/keys) and updates related browser/logic tests accordingly.

Reviewed by Cursor Bugbot for commit aa92532. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Scope all project, thread, and API state to discrete environments to support multi-environment

  • Introduces a new @t3tools/client-runtime package with ScopedProjectRef, ScopedThreadRef, KnownEnvironment, and scoped key utilities for identifying resources across environments.
  • Restructures AppState in store.ts so projects, threads, and related state live under environmentStateById instead of globally; selectors and reducers updated throughout.
  • Splits NativeApi into LocalApi (desktop shell/dialogs) and EnvironmentApi (per-environment backend operations); all components and hooks updated to use the appropriate API.
  • Adds a RepositoryIdentityResolver server service that resolves a project's canonical git remote identity from its workspace root, enriching project.created and project.meta-updated events and snapshot data.
  • Adds a ServerEnvironment service that persists a stable EnvironmentId per server installation and exposes an ExecutionEnvironmentDescriptor (platform, version, capabilities) included in WS handshake and lifecycle events.
  • Introduces draft-session routes (/draft/$draftId) and environment-scoped thread routes (/$environmentId/$threadId), replacing the previous /$threadId route; draft promotion to server threads is now a two-step lifecycle.
  • Terminal, git status, composer draft, and thread-selection stores are rekeyed from raw ThreadId/ProjectId to environment-scoped string keys; persisted state versions are bumped with migration paths.
  • Risk: breaking change to all route shapes, stored state schemas (v2 migrations for terminal and composer draft stores), and store/API call signatures across the frontend.

Macroscope summarized aa92532.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants