Validate channel file IDs and exercise downloads from the Slint browser
This commit is contained in:
1 parent
8d4daf4ef8
commit
a3ee6cc0c0
6 files changed
+42
-4
No files matched your search
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Reject channel IDs above the protocol's safe-integer limit in file operations before sending a request.
|
||||||
|
|
||||||
- Releasing a file chooser token no longer keeps an unused directory grant alive solely to suggest its path in a later dialog. An active download still retains its own grant until it finishes.
|
- Releasing a file chooser token no longer keeps an unused directory grant alive solely to suggest its path in a later dialog. An active download still retains its own grant until it finishes.
|
||||||
|
|
||||||
- Opening the recording panel reads the recorder status. Pause, Resume, Stop and Reveal stay bound to the selected take so delayed controls cannot affect the next recording in the same tab.
|
- Opening the recording panel reads the recorder status. Pause, Resume, Stop and Reveal stay bound to the selected take so delayed controls cannot affect the next recording in the same tab.
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Current Windows account-free checkpoint (2026-11-26)
|
## Current Windows account-free checkpoint (2026-11-26)
|
||||||
|
|
||||||
|
**Channel file list on Windows:** The guest opened the default channel's file browser from its Slint menu on private beta14. The listed filename and size matched the 46-byte fixture, and Download from that row produced the exact bytes. A separate live test rejected a stale picker after reconnect. The stdio test rejected invalid paths, unknown fields and out-of-range IDs before connection lookup; the largest valid channel ID reached the connection gate. This covers `command:file_list` on classic storage, not HTTPFT or S3.
|
||||||
|
|
||||||
**File chooser release:** The last-used directory hint retains only a path. Releasing an unused token drops the backing lease; attempting to download with the released token returns bad_request before dispatch and leaves existing bytes unchanged. A separately retained in-flight staging grant survives token release until the transfer reaches a terminal state. All 13 file-service tests passed. This verifies the native service equivalent of `preload:filesRelease`; the OS picker and reconnect case were verified separately.
|
**File chooser release:** The last-used directory hint retains only a path. Releasing an unused token drops the backing lease; attempting to download with the released token returns bad_request before dispatch and leaves existing bytes unchanged. A separately retained in-flight staging grant survives token release until the transfer reaches a terminal state. All 13 file-service tests passed. This verifies the native service equivalent of `preload:filesRelease`; the OS picker and reconnect case were verified separately.
|
||||||
|
|
||||||
**Transfer settings readback:** The Windows Slint controls saved 8 download slots, 2 upload slots and directional limits of 1.5 and 2.5 MiB/s. Restart restored all four fields, both limit switches, the prompt choice and the selected directory; a real beta14 guest download reached that directory. Four separate checks covered the numeric controls, divided rate configuration sent to two simulated core sessions, invalid or rejected changes, and persistence failure. This is UI and scheduler-command evidence, not a measured two-peer wire rate.
|
**Transfer settings readback:** The Windows Slint controls saved 8 download slots, 2 upload slots and directional limits of 1.5 and 2.5 MiB/s. Restart restored all four fields, both limit switches, the prompt choice and the selected directory; a real beta14 guest download reached that directory. Four separate checks covered the numeric controls, divided rate configuration sent to two simulated core sessions, invalid or rejected changes, and persistence failure. This is UI and scheduler-command evidence, not a measured two-peer wire rate.
|
||||||
|
|||||||
@@ -243,7 +243,10 @@ fn args<T: serde::de::DeserializeOwned>(raw: Option<&RawValue>) -> Result<T, Err
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn channel(id: u64) -> Result<u64, ErrorObj> {
|
fn channel(id: u64) -> Result<u64, ErrorObj> {
|
||||||
if id == 0 { Err(bad("channel_id must be a channel (not 0)")) } else { Ok(id) }
|
if !(1..=9_007_199_254_740_991).contains(&id) {
|
||||||
|
return Err(bad("channel_id must be a positive safe integer"));
|
||||||
|
}
|
||||||
|
Ok(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_password(p: &str) -> Result<(), ErrorObj> {
|
fn check_password(p: &str) -> Result<(), ErrorObj> {
|
||||||
@@ -263,7 +266,7 @@ fn check_host_path(field: &str, path: &Path) -> Result<(), ErrorObj> {
|
|||||||
// Channel zero is reserved for the virtual server's icons (main-owned snapshots and icon manager),
|
// Channel zero is reserved for the virtual server's icons (main-owned snapshots and icon manager),
|
||||||
// never the renderer's file browser. Only canonical `/icons/icon_<nonzero u32>` names are accepted.
|
// never the renderer's file browser. Only canonical `/icons/icon_<nonzero u32>` names are accepted.
|
||||||
fn transfer_channel(id: u64, path: &str) -> Result<u64, ErrorObj> {
|
fn transfer_channel(id: u64, path: &str) -> Result<u64, ErrorObj> {
|
||||||
if id != 0 { return Ok(id); }
|
if id != 0 { return channel(id); }
|
||||||
let icon = path.strip_prefix("/icons/icon_").unwrap_or("");
|
let icon = path.strip_prefix("/icons/icon_").unwrap_or("");
|
||||||
if icon.parse::<u32>().is_ok_and(|n| n != 0 && n.to_string() == icon) {
|
if icon.parse::<u32>().is_ok_and(|n| n != 0 && n.to_string() == icon) {
|
||||||
Ok(0)
|
Ok(0)
|
||||||
|
|||||||
@@ -290,6 +290,20 @@ fn client_menu_commands_are_validated_and_never_fake_success_offline() {
|
|||||||
core.shutdown();
|
core.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn file_browser_rejects_invalid_list_before_connection() {
|
||||||
|
let dir = TempDir::new("file-list-boundary");
|
||||||
|
let mut core = Core::start(&dir.0);
|
||||||
|
for args in [json!({"channel_id":0,"path":"/"}), json!({"channel_id":9_007_199_254_740_992u64,"path":"/"}),
|
||||||
|
json!({"channel_id":1,"path":"/a/../b"}), json!({"channel_id":1,"path":"/","unexpected":true})] {
|
||||||
|
let (reply, _) = core.request("invalid-list", "file_list", args);
|
||||||
|
assert_eq!(reply["error"]["code"], "bad_request", "{reply}");
|
||||||
|
}
|
||||||
|
let (reply, _) = core.request("valid-list", "file_list", json!({"channel_id":9_007_199_254_740_991u64,"path":"/"}));
|
||||||
|
assert_eq!(reply["error"]["code"], "not_connected", "{reply}");
|
||||||
|
core.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn publisher_commands_validate_through_real_stdio_without_server() {
|
fn publisher_commands_validate_through_real_stdio_without_server() {
|
||||||
let dir = TempDir::new("publisher");
|
let dir = TempDir::new("publisher");
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
## Возврат к разработке на ПК, 2026-11-26
|
## Возврат к разработке на ПК, 2026-11-26
|
||||||
|
|
||||||
|
Windows, база `8d4daf4`: закрыт `command:file_list` для классического хранилища. Меню канала Slint открыло список на beta14, размер строки совпал с 46 байтами файла, скачивание из этой строки дало точное содержимое. Прошли два сценария Slint и тест stdio для границы ID. Стенд остановлен.
|
||||||
|
|
||||||
Windows, база `e25263e`: закрыт `preload:filesRelease` на уровне файлового сервиса. Подсказка последней папки хранит только путь. После release повторная загрузка с этим токеном отклонена без команды ядру и без изменения прежнего файла. Активная передача удерживает собственное разрешение до завершения. Прошли 13 тестов файлового сервиса.
|
Windows, база `e25263e`: закрыт `preload:filesRelease` на уровне файлового сервиса. Подсказка последней папки хранит только путь. После release повторная загрузка с этим токеном отклонена без команды ядру и без изменения прежнего файла. Активная передача удерживает собственное разрешение до завершения. Прошли 13 тестов файлового сервиса.
|
||||||
|
|
||||||
Windows, база `ba6cae3`: проверен `preload:filesSettings`. После перезапуска в Slint восстановились папка, запрос пути, слоты 8/2 и лимиты 1,5/2,5 МиБ/с. Прошли пять тестов, включая скачивание с beta14 и проверку распределения настроек между двумя тестовыми сессиями ядра. Сетевая скорость одновременно работающих клиентов не измерялась. Стенд остановлен.
|
Windows, база `ba6cae3`: проверен `preload:filesSettings`. После перезапуска в Slint восстановились папка, запрос пути, слоты 8/2 и лимиты 1,5/2,5 МиБ/с. Прошли пять тестов, включая скачивание с beta14 и проверку распределения настроек между двумя тестовыми сессиями ядра. Сетевая скорость одновременно работающих клиентов не измерялась. Стенд остановлен.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use std::{env, fs, io::{self, Write}, path::Path, process::Command, time::Duration};
|
use std::{env, fs, io::{self, Write}, path::Path, process::Command, time::Duration};
|
||||||
use slint::ComponentHandle;
|
use slint::{ComponentHandle, Model};
|
||||||
|
|
||||||
use super::{SmokeResult, identities::{ack, category, row, run_ui, wait}, key_profiles::until, owned_folder_dialog::OwnedFolderDialog};
|
use super::{SmokeResult, identities::{ack, category, row, run_ui, wait}, key_profiles::until, owned_folder_dialog::OwnedFolderDialog};
|
||||||
use crate::{AppConfig, AppRuntime, AppWindow, DialogBridge, SettingsBridge, ShellBridge,
|
use crate::{AppConfig, AppRuntime, AppWindow, DialogBridge, SettingsBridge, ShellBridge,
|
||||||
@@ -326,7 +326,22 @@ async fn download(runtime: &AppRuntime, ui: &AppWindow, target: Target, folder:
|
|||||||
fs::remove_file(&file).map_err(|e| format!("remove collision sentinel: {e}"))?;
|
fs::remove_file(&file).map_err(|e| format!("remove collision sentinel: {e}"))?;
|
||||||
|
|
||||||
let _unexpected_picker = OwnedFolderDialog::start(None)?;
|
let _unexpected_picker = OwnedFolderDialog::start(None)?;
|
||||||
invoke_download(runtime, target.clone())?;
|
let shell = ui.global::<ShellBridge>();
|
||||||
|
let key = target.session.as_ref().ok_or("file missing its session")?;
|
||||||
|
let Entity::File { channel_id, .. } = &target.entity else {return Err("expected a file target".into())};
|
||||||
|
let channel_key = format!("{}/channel:{channel_id}",key.connection_id);
|
||||||
|
let channel = observe(runtime,"fixture channel in Slint tree",|_|shell.get_tree().iter().find(|r|r.key.as_str()==channel_key).map(Ok)).await?;
|
||||||
|
let menu = |id, op| -> SmokeResult<()> {
|
||||||
|
shell.invoke_context(id,20.,20.);
|
||||||
|
let label=runtime.snapshot().catalog.text(crate::ui::shell::forms::label_key(op));
|
||||||
|
let command=shell.get_menu_actions().iter().find(|a|a.enabled && a.label.as_str()==label)
|
||||||
|
.ok_or_else(||format!("missing enabled {op:?} action"))?;
|
||||||
|
shell.invoke_invoke(command.id);Ok(())
|
||||||
|
};
|
||||||
|
menu(channel.id,Operation::FileBrowse)?;
|
||||||
|
let listed=observe(runtime,"file listed with expected byte size",|_|shell.get_entries().iter()
|
||||||
|
.find(|r|r.title.as_str()==name && r.subtitle.as_str().parse::<usize>()==Ok(BYTES.len())).map(Ok)).await?;
|
||||||
|
menu(listed.id,Operation::FileDownload)?;
|
||||||
expect_download_publication(runtime, &target, &baseline, &file, staging).await
|
expect_download_publication(runtime, &target, &baseline, &file, staging).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user