M3.1: PHP detection and pinned Phpactor download
- crates/lsp toolchain: PHP from php.executable or PATH, `php -v` with a 5 s timeout and capped output, version parsing (proptest), PHP >= 8.2. - Pinned Phpactor 2026.06.25.0 (SHA-256 832510fe...59e9); newer releases need ext-posix and do not start on Windows. - Download with ureq + rustls (ring, OS roots via rustls-native-certs): HTTPS only, 32 MiB cap, SHA-256 verified before an atomic write, retry with backoff. Tests use a local HTTP server only. - Engine: settings php.executable, phpactor.path, phpactor.autoDownload (bool and string setting kinds), toolchain.status, toolchain.downloadPhpactor, toolchainChanged, notifications; worker thread off the engine lock, results via the pump. Downloads only after the host calls Engine::allow_downloads (the desktop does). - Docs: architecture Toolchain section (network access, D15), G6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
78709dd76b
commit
50f36cce8b
23 changed files with 2577 additions and 10 deletions
|
|
@ -41,7 +41,17 @@ fn list_describes_the_c2_keys_with_catalog_keys_only() {
|
|||
.iter()
|
||||
.map(|s| s["key"].as_str().unwrap())
|
||||
.collect();
|
||||
assert_eq!(keys, ["appearance.theme", "editor.fontSize", "ui.language"]);
|
||||
assert_eq!(
|
||||
keys,
|
||||
[
|
||||
"appearance.theme",
|
||||
"editor.fontSize",
|
||||
"ui.language",
|
||||
"php.executable",
|
||||
"phpactor.path",
|
||||
"phpactor.autoDownload"
|
||||
]
|
||||
);
|
||||
for s in list.as_array().unwrap() {
|
||||
assert!(s.get("label").is_none());
|
||||
assert!(s["labelKey"].as_str().unwrap().starts_with("settings."));
|
||||
|
|
@ -55,6 +65,40 @@ fn list_describes_the_c2_keys_with_catalog_keys_only() {
|
|||
assert_eq!(list[1]["type"], "int");
|
||||
assert_eq!(list[1]["default"], 14);
|
||||
assert_eq!(list[2]["enumValues"], json!(["en"]));
|
||||
assert_eq!(list[3]["type"], "string");
|
||||
assert_eq!(list[3]["default"], "");
|
||||
assert_eq!(list[5]["type"], "bool");
|
||||
assert_eq!(list[5]["default"], true);
|
||||
assert_eq!(list[5]["section"], "php");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn string_and_bool_settings_are_validated() {
|
||||
let mut e = Engine::new().unwrap();
|
||||
for (key, bad) in [
|
||||
("php.executable", json!(3)),
|
||||
("php.executable", json!("x".repeat(4097))),
|
||||
("php.executable", json!(format!("a{}b", char::from(0)))),
|
||||
("phpactor.autoDownload", json!("yes")),
|
||||
] {
|
||||
let err = e
|
||||
.execute("settings.set", json!({"key": key, "value": bad}))
|
||||
.unwrap_err();
|
||||
assert_eq!(err.code(), "invalid_params", "{key}");
|
||||
}
|
||||
e.execute(
|
||||
"settings.set",
|
||||
json!({"key": "phpactor.autoDownload", "value": false}),
|
||||
)
|
||||
.unwrap();
|
||||
e.execute(
|
||||
"settings.set",
|
||||
json!({"key": "php.executable", "value": "C:/PHP/php.exe"}),
|
||||
)
|
||||
.unwrap();
|
||||
let values = get_all(&mut e);
|
||||
assert_eq!(values["phpactor.autoDownload"], false);
|
||||
assert_eq!(values["php.executable"], "C:/PHP/php.exe");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -62,7 +106,14 @@ fn get_set_reset_and_events() {
|
|||
let mut e = Engine::new().unwrap();
|
||||
assert_eq!(
|
||||
get_all(&mut e),
|
||||
json!({"appearance.theme": "system", "editor.fontSize": 14, "ui.language": "en"})
|
||||
json!({
|
||||
"appearance.theme": "system",
|
||||
"editor.fontSize": 14,
|
||||
"ui.language": "en",
|
||||
"php.executable": "",
|
||||
"phpactor.path": "",
|
||||
"phpactor.autoDownload": true
|
||||
})
|
||||
);
|
||||
let out = e
|
||||
.execute(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue