Skip to content

Commit c4ef327

Browse files
committed
test(gateway): pin coexistence — reported roots still map, header wins
Lock in the requirement that folder-path/roots-reporter mapping keeps working alongside the X-Mcpmux-Workspace header, with the header taking priority. One session: with no pin it resolves via its reported root; pinning a header root for a different folder then overrides it. Guards against the pin ever becoming unconditional and breaking roots-reporting clients. Claude-Session: https://claude.ai/code/session_01Baan9JmzR43uxxRUh7CAMF Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 5629eb6 commit c4ef327

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

tests/rust/tests/integration/feature_set_resolver.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,49 @@ async fn pinned_header_root_overrides_a_conflicting_reported_root() {
725725
assert_ne!(r.feature_set_ids, vec![f.fs_a_id]);
726726
}
727727

728+
#[tokio::test]
729+
async fn header_takes_priority_but_reported_roots_still_map_without_one() {
730+
// The two mechanisms coexist by design: a session that only reports MCP
731+
// roots (no header) keeps mapping via those roots; pinning a header root
732+
// then overrides them. This guards against the pin ever becoming
733+
// unconditional and breaking roots-reporting clients (VS Code, Claude Code).
734+
let f = Fixture::new().await;
735+
let (root_a, root_b) = if cfg!(windows) {
736+
("d:\\work\\a", "d:\\work\\b")
737+
} else {
738+
("/work/a", "/work/b")
739+
};
740+
f.binding_repo
741+
.create(&WorkspaceBinding::new(
742+
normalize_workspace_root(root_a),
743+
f.space_id,
744+
f.fs_a_id.clone(),
745+
))
746+
.await
747+
.unwrap();
748+
f.binding_repo
749+
.create(&WorkspaceBinding::new(
750+
normalize_workspace_root(root_b),
751+
f.space_id,
752+
f.fs_b_id.clone(),
753+
))
754+
.await
755+
.unwrap();
756+
757+
// No header pinned → the reported root drives resolution (FS A).
758+
f.session_roots.set("s", [root_a]);
759+
f.session_roots.set_roots_capable("s", true);
760+
let reported = f.resolver.resolve(Some("s"), None).await.unwrap();
761+
assert_eq!(reported.source, ResolutionSource::WorkspaceBinding);
762+
assert_eq!(reported.feature_set_ids, vec![f.fs_a_id.clone()]);
763+
764+
// Pin a header root for a different folder → it takes priority (FS B).
765+
f.session_roots.set_pinned("s", root_b);
766+
let pinned = f.resolver.resolve(Some("s"), None).await.unwrap();
767+
assert_eq!(pinned.source, ResolutionSource::WorkspaceBinding);
768+
assert_eq!(pinned.feature_set_ids, vec![f.fs_b_id.clone()]);
769+
}
770+
728771
#[tokio::test]
729772
async fn pinned_header_root_without_binding_falls_back_to_space_default() {
730773
// A header root for an as-yet-unmapped folder still works out of the box on

0 commit comments

Comments
 (0)