Rebase context-scoped state on switch: exec root + LSP #47

Manually merged
ebrandt merged 1 commit from feat/047-rebase-context-scoped-state-on-switch-exec-roo into master 2026-06-19 17:14:30 +02:00
Owner

Rebase context-scoped state on switch: exec root + LSP

Touches 14 files: .claude/commands/ck-commit.md, .claude/skills/ck-commit.md, ck-testing-e2e/src/harness.rs, ckeditor-lint/baseline.toml, ckeditor-lint/baseline_CHANGELOG.md, ckeditor/src/app.rs and 8 more.

Rebase context-scoped state on switch: exec root + LSP Touches 14 files: `.claude/commands/ck-commit.md`, `.claude/skills/ck-commit.md`, `ck-testing-e2e/src/harness.rs`, `ckeditor-lint/baseline.toml`, `ckeditor-lint/baseline_CHANGELOG.md`, `ckeditor/src/app.rs` and 8 more.
ebrandt approved these changes 2026-06-19 13:19:29 +02:00
ebrandt left a comment

Approving. I would have split ck-testing-e2e/src/harness.rs differently, but not enough to hold this up.

Approving. I would have split `ck-testing-e2e/src/harness.rs` differently, but not enough to hold this up.
@ -464,0 +547,4 @@
});
let id = ctx.id;
let project = ckeditor::app::project_mut(&mut self.app)
.expect("no project open");
Owner

The expect message on expect is the only thing a user sees if this fires. Does it say what they should do, or only what we assumed?, at ck-testing-e2e/src/harness.rs:550.

The expect message on `expect` is the only thing a user sees if this fires. Does it say what they should do, or only what we assumed?, at ck-testing-e2e/src/harness.rs:550.
@ -2065,0 +2094,4 @@
let main_id = ensure_main_checkout(&mut project).unwrap().unwrap();
let wt_dir = tmp.path().join(CTX_A_DIR);
fs::create_dir_all(&wt_dir).unwrap();
Owner

fs unwraps here. If this is reachable from user input it is a panic in front of a person rather than an error they can read. Is it provably there at this point, or should it carry a ??

`fs` unwraps here. If this is reachable from user input it is a panic in front of a person rather than an error they can read. Is it provably there at this point, or should it carry a `?`?
Author
Owner

It said what I assumed. Reworded in ck-testing-e2e/src/harness.rs so it names the input that broke it, which is what the bug report will need.

It said what I assumed. Reworded in `ck-testing-e2e/src/harness.rs` so it names the input that broke it, which is what the bug report will need.
Author
Owner

It is reachable. The function in ckeditor/src/project.rs returns a Result now and the caller reports it, so the unwrap on fs is gone.

It is reachable. The function in `ckeditor/src/project.rs` returns a Result now and the caller reports it, so the unwrap on `fs` is gone.
Two bugs in `app_layout::switch_active_context`'s aftermath that
caused the active Context's working environment to drift after a
switch:

- The saved-command runner spawned subprocesses against the launch
  project root instead of the active Context's `root`. After
  switching into a worktree Context, `cargo build` ran against the
  main checkout. `panels::command_panel::show` now takes both
  `exec_root` and `store_root`; `panel_content::render_commands`
  derives `exec_root` from `project::active(...).root` (with the
  launch root as fallback when no Context is active).
- `LspManager` was anchored to the launch root and never re-anchored
  on switch, so rust-analyzer continued reporting against the wrong
  workspace tree. `context_switch::switch_active_context` now calls
  `LspManager::update_root` and re-emits `did_open` for hydrated
  buffers when the active root changes — same path that
  `restore_session` already drives at startup.

End-to-end coverage in `tests/scenarios/context_switch_isolates_
buffers_and_changes.rs`: two Contexts, A=MainCheckout / B=Worktree,
disjoint buffer sets, in-memory mutation in B, switch round-trip,
asserting buffer counts (1 / 2 / 1 / 2), no rope-bleed from B into
A, and chrome-color stability across the round-trip. Drove through
the same `app_layout::switch_active_context` funnel that
`dashboard_dispatch::dispatch` uses in production. Added Harness
primitives (`active_context_id`, `switch_to_context`,
`active_context_color`, etc.) and pub re-exports to expose the
funnel for the test.

Promoted e2e scenarios to a distinct numbered gate in
`scripts/test.sh --gates` (gate 2/4 of 4) so a scenario failure
surfaces before the broader workspace tests. `/ck-commit` now
delegates to that single gate command instead of inlining the cargo
calls, and adds the previously-missing ratchet step.

Ratchet: `app_layout::CkEditorApp::lcom1` 361 → 341 (side effect of
moving `exec_root` derivation off `self.project_root` in
`render_commands`). Changelog entry in `baseline_CHANGELOG.md`.
ebrandt manually merged commit 07a91782c1 into master 2026-06-19 17:14:30 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
northgale/ckeditor!47
No description provided.