Skip to main content

gate

Function gate 

Source
pub fn gate(
    global: &[McpServerConfig],
    overrides: &ProjectOverrides,
    project_path: &Path,
) -> (Vec<McpServerOverride>, Vec<McpIssue>)
Expand description

Split the project’s table into overrides the resolver may see and refusals.

Why: the single place the repo-content trust decision is made, so no caller can reach trusty_mcp::config::resolve with an ungated project entry. What: every disabled name becomes a Disable unconditionally. Every servers entry becomes a Set only when a global entry of the same name exists AND transport_equivalent holds — which still lets the project flip enabled, because that field is outside the transport. Everything else is refused with an McpIssue and a tracing::warn!. project_path names the file in the finding and is never read here.

An accepted Set is emitted with the GLOBAL entry’s extensions, not its own: only name and enabled cross the boundary. See the module doc.

Disables are emitted BEFORE sets, matching trusty_agents::assistants::mcp::McpOverrides::as_overrides, so a name in both lists resolves as the more specific Set under the resolver’s left-to-right fold. Test: super::tests::trust_tests::a_matching_set_is_accepted, super::tests::trust_tests::a_set_with_a_new_command_is_refused, super::tests::trust_tests::a_set_naming_no_global_server_is_refused, super::tests::trust_tests::a_set_may_re_enable_a_disabled_global_entry, super::tests::trust_tests::a_set_cannot_smuggle_its_own_extensions, super::tests::trust_tests::a_disable_always_passes.