Skip to content

fix(operator): name Workspaces mounted past the first Branch page - #490

Merged
yifanxuaaa merged 1 commit into
Ephemeral-AI-Lab:mainfrom
YidaWeng:fix/480-workspace-branch-names
Oct 28, 2026
Merged

yifanxuaaa merged 1 commit into
Ephemeral-AI-Lab:mainfrom
YidaWeng:fix/480-workspace-branch-names

Conversation

@YidaWeng

Copy link
Copy Markdown
Contributor

Fixes #480.

Problem

snapshot() (engine/crates/layerfs-store-service/src/operator/inspect.rs) reads one page of 64 Branches and builds the id -> name map from that page only. sandbox.list_workspaces and the project page's Workspace views then answer branch: null for a Workspace mounted on any later Branch. The same map feeds headMovedSinceMount, so it also compared against the page's head instead of the Branch's current head.

Fix

The page still lists Branches and still sets moreBranches. After it loads, each mounted Branch id that the page does not hold is resolved once through the history catalog (store.history().branch(id)), so both branch and headMovedSinceMount are correct regardless of how many Branches the project has. Ids already on the page cost no extra read, and the work is bounded by the mounted Workspaces this daemon reports, not by the Branch count.

Names still cannot be missing for a mounted Branch, so sandbox.list_workspaces does not need to pass moreBranches through.

Tests

New workspaces_name_branches_beyond_the_first_page in engine/crates/layerfs-api/tests/operator_history.rs: 70 Branches, a seeded Workspace view bound on b70 before a later Commit, then asserts moreBranches: true, branch: "b70" and headMovedSinceMount: true.

On the parent commit the same test fails with:

left: None
right: Some("b70")

Checks (macOS, Rust 1.85.1)

  • cargo test -p layerfs-api --test operator_history — 2 passed.
  • cargo test --locked --all-targets --no-run — builds.
  • cargo clippy --locked --all-targets -- -D warnings — clean.
  • cargo fmt --all -- --check — clean.
  • python3 -B tools/check_product_boundary.py — PASS (956 files).
  • python3 -B -m unittest discover -s tools -p 'test_*.py' — 155 passed.

Gap: this host's system SQLite is 3.54.0, which the overlay profile does not qualify, so the fixture panics before any test body. For the local runs above I temporarily enabled rusqlite's bundled feature (SQLite 3.53.2, already allowlisted) and did not commit that change. Linux CI uses the bundled build already. Not run: Linux FUSE/daemon mount targets and the Node SDK surface.

Production LOC: 102,763 -> 102,775 (delta +12), layerfs-store-service only; tests and comments are not counted.

…hemeral-AI-Lab#480)

`snapshot` built the Branch id -> name map from one 64-Branch page, so
`sandbox.list_workspaces` answered `branch: null` for a Workspace mounted on
any later Branch, and the project page's own Workspace views had the same
gap. The page still lists the Branches and sets `moreBranches`, but a mounted
id it does not hold is now resolved through the history catalog by id, so a
Workspace's `branch` no longer depends on how many other Branches the project
has. The same map feeds `headMovedSinceMount`, so that answer is now the
Branch's current head rather than the page's.

Tests:
- added workspaces_name_branches_beyond_the_first_page in
  engine/crates/layerfs-api/tests/operator_history.rs: 70 Branches, a view
  bound on b70 before a later Commit, asserting `moreBranches: true`,
  `branch: "b70"` and `headMovedSinceMount: true`. It fails on the parent
  with `branch: null`.
- deleted: none.

Production LOC: 102763 -> 102775 (delta +12)
  first-parent comparison (upstream/main 582bc78 -> this commit); engine
  layerfs-store-service +12. Scopes: api 2659 -> 2659 (0), core 38395 ->
  38395 (0), engine 61709 -> 61721 (+12); reference absent (retired R9c;
  last counted 65,417 at tree 498dd19). Counted with
  tools/production_loc.py (blob 3341e4d) --root on a checkout of the
  parent commit and on the staged tree.
@yifanxuaaa
yifanxuaaa merged commit 9af53da into Ephemeral-AI-Lab:main Oct 28, 2026
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.

sandbox.list_workspaces reports branch: null for Workspaces on Branches past the project's first 64

2 participants