debugger beta: Fix regression where we sent launch args twice to any dap (#31325)

This regression happens because our tests weren't properly catching this
edge case anymore. I updated the tests to only send the raw config to
the Fake Adapter Client.

Release Notes:

- debugger beta: Fix bug where launch args were sent twice
This commit is contained in:
Anthony Eid 2025-05-24 09:52:36 +03:00 committed by GitHub
parent 7fb9569c15
commit 6f918ed99b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 39 deletions

View file

@ -400,32 +400,6 @@ impl FakeAdapter {
pub fn new() -> Self {
Self {}
}
fn request_args(
&self,
task_definition: &DebugTaskDefinition,
) -> StartDebuggingRequestArguments {
use serde_json::json;
let obj = task_definition.config.as_object().unwrap();
let request_variant = obj["request"].as_str().unwrap();
let value = json!({
"request": request_variant,
"process_id": obj.get("process_id"),
"raw_request": serde_json::to_value(task_definition).unwrap()
});
StartDebuggingRequestArguments {
configuration: value,
request: match request_variant {
"launch" => dap_types::StartDebuggingRequestArgumentsRequest::Launch,
"attach" => dap_types::StartDebuggingRequestArgumentsRequest::Attach,
_ => unreachable!("Wrong fake adapter input for request field"),
},
}
}
}
#[cfg(any(test, feature = "test-support"))]
@ -473,7 +447,7 @@ impl DebugAdapter for FakeAdapter {
async fn get_binary(
&self,
_: &Arc<dyn DapDelegate>,
config: &DebugTaskDefinition,
task_definition: &DebugTaskDefinition,
_: Option<PathBuf>,
_: &mut AsyncApp,
) -> Result<DebugAdapterBinary> {
@ -483,7 +457,10 @@ impl DebugAdapter for FakeAdapter {
connection: None,
envs: HashMap::default(),
cwd: None,
request_args: self.request_args(&config),
request_args: StartDebuggingRequestArguments {
request: self.validate_config(&task_definition.config)?,
configuration: task_definition.config.clone(),
},
})
}
}