From e14a8bba789578b1dc0c891feabeee8567ca9b40 Mon Sep 17 00:00:00 2001 From: David Montero Date: Mon, 8 Jun 2026 06:14:17 +0200 Subject: [PATCH] feat(P2.1h): Library Manager 'Installed' list reads the cache, not the global volume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit list_installed_libraries() now honors VELXIO_FALLBACK_SKETCHBOOK (pro overlay) so GET /api/libraries/list enumerates the content-addressed cache instead of the shared global dir — the Installed tab survives the global volume's retirement (audit finding #3). Unset (OSS self-host) -> default sketchbook, unchanged. --- backend/app/services/arduino_cli.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/backend/app/services/arduino_cli.py b/backend/app/services/arduino_cli.py index e7d3b4cc..a4d86fa3 100644 --- a/backend/app/services/arduino_cli.py +++ b/backend/app/services/arduino_cli.py @@ -871,13 +871,24 @@ class ArduinoCLIService: async def list_installed_libraries(self) -> dict: """ - List all installed Arduino libraries + List all installed Arduino libraries. + + P2.1h: when VELXIO_FALLBACK_SKETCHBOOK is set (pro overlay), list the + content-addressed cache (its libraries/ is the cache root) instead of the + shared global volume, so the Library Manager 'Installed' view survives the + global volume's retirement. Unset (OSS) -> arduino-cli's default sketchbook. """ try: + list_env = dict(os.environ) + _fb = os.environ.get("VELXIO_FALLBACK_SKETCHBOOK") + if _fb: + list_env["ARDUINO_DIRECTORIES_USER"] = _fb + def _run(): return subprocess.run( [self.cli_path, "lib", "list", "--format", "json"], - capture_output=True, text=True, encoding='utf-8', errors='replace' + capture_output=True, text=True, encoding='utf-8', errors='replace', + env=list_env, ) result = await asyncio.to_thread(_run)