Skip to content

Workspace-local storage: collections must travel with the repo, not the user profile #591

Closed

Description

@thomas-stegemann

Make the VS Code extension store a workspace's Bowire data inside that workspace, so collections and environments actually travel with the repo.

The problem

This is the headline claim of the VS Code extension (#101), and as built it is not true.

The extension starts the CLI with the workspace folder as its working directory, and the README concluded from that that .bowire/ lands next to the code. The working directory has nothing to do with it. The storage root is computed once per process from the user profile:

// src/Kuestenlogik.Bowire/Auth/IBowireUserStore.cs:65-67
private static readonly string Root = Path.Combine(
    Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
    ".bowire");

Collections, environments, recordings and presets all route through BowireUserContext and land in ~/.bowire/workspaces/<id>/… regardless of where the process was started. Verified at runtime: starting the CLI in an empty directory serves the workbench and creates nothing there at all.

Consequences today:

  • Two repos open in two windows share one set of collections
  • Nothing is committed, reviewed or shared — the repo-travelling story does not happen
  • The extension's smoke test cannot assert the behaviour the README describes, because it does not occur

--auto-create-initial-workspace does not change this. It is a browser-side first-run hint (wwwroot/js/prologue.js:2044-2087) that pushes an in-memory workspace and deliberately does not persist it.

What exists to build on

Per-workspace storageRoot already exists for git-backed workspaces (#147/#196): BowireUserContext.GetWorkspacePath(workspaceId, storageRoot, relativePath) honours it (IBowireUserStore.cs:159-167), FileEntityStore reads and writes under it (Workspace.Git/FileEntityStore.cs:71-82), and bowire workspace init <path> creates one from the CLI (Tool/Cli/WorkspaceCommand.cs:962-969). So the mechanism is there; nothing wires it to "the folder the editor has open".

Options

  1. Extension-driven — on first open, detect whether the workspace has a Bowire workspace rooted at it, and offer to create one (workspace init). Only the extension changes; the CLI is untouched. But the same folder opened outside the editor still gets the user-profile store, so behaviour depends on how Bowire was launched.
  2. A CLI switch — something like --workspace-root <path> that roots the active workspace at a directory. The extension passes the folder; a developer can pass it by hand and get the identical result. Fixes the inconsistency in option 1 and is useful well beyond VS Code (CI, containers, the JetBrains plugin Tugboat — JetBrains plugin (IntelliJ platform) #588).
  3. Project-file driven — .bowire/project.json already exists as a checked-in, walked-up-to project manifest (Tool/Cli/ProjectCommand.cs:40). Rooting storage at whichever directory holds it would make the behaviour a property of the repo rather than of the launcher, and would need no per-surface wiring at all.

Option 3 fits the existing convention most closely and option 2 is the smallest useful step; they are not exclusive. This needs a decision before implementation.

Acceptance criteria

  • A decision recorded on which mechanism roots storage at a workspace
  • Opening a repo in VS Code stores its collections/environments under that repo, not the user profile
  • Two repos open at once keep separate collections
  • The same repo opened via the plain CLI resolves to the same store, so the editor is not a special case
  • Existing ~/.bowire data keeps working — no silent relocation, and a documented path for moving a workspace into a repo
  • The extension's smoke test asserts the storage location again (the check is currently removed, pointing here)
  • extensions/bowire-vscode/README.md describes what actually happens

Related

Activity

  1. changed the issue type fromtoon Aug 21, 2026
  2. thomas-stegemann commented on Aug 22, 2026

    @thomas-stegemann
    MemberAuthor

    Shipped in ef4ac90, with the last gap closed in de30772.

    The mechanism is a manifest key, not an editor setting: .bowire/project.json with "storage": "project". The answer therefore comes from the repository, which is what makes the editor stop being a special case — the same checkout resolves to the same store whether it was opened here, run through bowire in a terminal, or replayed in CI. BowireStorageRoot.Resolve walks up for the manifest and BowireServiceCollectionExtensions applies it, so every host gets the same answer without knowing it asked.

    Opt-in, deliberately. A manifest that says nothing keeps ~/.bowire, so nobody's existing data moves under them. NoManifest_ResolvesToTheUserProfile, ManifestWithoutStorageKey_KeepsTheUserProfile and SaveAll_with_storageRoot_does_not_touch_per_user_folder pin that from both directions.

    The criteria are covered by tests rather than by inspection:

    Criterion Where it is pinned
    Repo-local storage when opted in StorageProject_RootsAtTheProject, plus smoke step 5 asserting .bowire/environments.json in the workspace
    Two repos stay separate TwoProjects_ResolveToDifferentStores
    Same store from the plain CLI resolution lives in Core, applied by BowireServiceCollectionExtensions; ResolvesFromASubdirectory_BecauseDiscoveryWalksUp
    Existing ~/.bowire untouched the three tests above
    Smoke test asserts the location again test/smoke.js step 5, with run-smoke.mjs writing the opting-in manifest

    One criterion needed work rather than a tick: a documented path for moving a workspace into a repo. The README explained that nothing moves on its own and then left the obvious follow-up question unanswered. de30772 adds it — there is no migration to describe, since Bowire reads whatever is in the store it resolves to, so copying the two files is the whole operation. Copy rather than move, so nothing is lost if the repo turns out not to be the right home. File names were checked against a real profile instead of assumed.

    Also worth recording: UnreadableManifest_FallsBackRatherThanTakingStorageDown. A malformed project.json must not be able to take storage down — the fallback is the machine-wide store, which always works.

  3. moved this from Backlog to Done in Bowireon Aug 22, 2026
  4. added a commit that references this issue on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions