Remember the last Files folder per chat

Persist each chat session's last navigated Files folder, restore it with bounded parent fallback, and forget it when the session closes. Add persistence coverage and capture-fixture support for the reviewed behavior.
This commit is contained in:
2026-11-12 22:56:52 +00:00
parent d19a14b9f9
commit 1928cfe51b
7 changed files with 277 additions and 4 deletions
+11
View File
@@ -2,10 +2,21 @@ import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/files/files_urls.dart';
/// A static, two-level explorer fixture. Its files live in capture/fixtures/files.
/// Set [probeMissingRememberedFolder] to make the nested folder disappear so
/// browser captures can exercise the controller's parent fallback.
bool probeMissingRememberedFolder = false;
JsonMap probeFilesReply(JsonMap request) {
final fields = request['list_directory'] as Map?;
final path = '${fields?['path'] ?? '/srv/probe/release'}';
final nested = path.endsWith('/assets');
if (probeMissingRememberedFolder && nested) {
return {
'id': request['id'],
'type': 'error',
'error': 'directory does not exist: $path',
};
}
final entries = nested
? <(String, int)>[('design.png', 18432), ('icon.jpg', 23000)]
: <(String, int)>[
+4 -1
View File
@@ -806,7 +806,10 @@ Future<void> main() async {
return;
}
configurePerfFixture(params);
if (params['files'] == '1') installFilesFixture();
if (params['files'] == '1') {
probeMissingRememberedFolder = params['filesMissing'] == '1';
installFilesFixture();
}
// `?font=inter` chooses a font as Settings would; otherwise the stored one.
final font = params['font'];
unawaited(