Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4befa67
chore: start cloud logs integration (#677)
Manel-Romero Nov 16, 2026
c632d32
fix(electron-app): update contact email
JavierRibaldelRio Nov 15, 2026
a99132a
fix(testing-view): remove unused blcu electron api from env
JavierRibaldelRio Nov 15, 2026
027b270
feat(electron-app): cloud logs uploder and downloader
JavierRibaldelRio Nov 15, 2026
589d5a1
wip(logging-view,session): cloud logs integration
JavierRibaldelRio Nov 15, 2026
ebc4342
wip(testing-view, logger): integration with cloud logs
JavierRibaldelRio Nov 15, 2026
7b32bbc
ci: update workflow triggers and pnpm dependencies
Manel-Romero Nov 23, 2026
e29c311
feat(electron-app): implement cloud logs client and ipc handlers
Manel-Romero Nov 23, 2026
a222bc6
test(electron-app): add unit tests for cloud logs and ipc
Manel-Romero Nov 23, 2026
7cbfbba
feat(logging-view): support log titles and dialog enhancements
Manel-Romero Nov 23, 2026
a6e88e8
docs(cloudLogs): document architecture and transfer workflows
Manel-Romero Nov 23, 2026
9a26c75
fix: enter-key adds tag on upload promt
Manel-Romero Nov 23, 2026
45d7c59
fix(logging-view): cloud logs importation
JavierRibaldelRio Nov 24, 2026
d615a35
fix(electron-app): fix error handling, stream safety, and session lim…
Manel-Romero Nov 25, 2026
026493d
feat(electron-app): format downloaded folders without spaces and reso…
Manel-Romero Nov 25, 2026
69092f9
feat(logging-view): enhance cloud logs dialog UX, download status, an…
Manel-Romero Nov 25, 2026
bf08b31
test(electron-app): update cloud logs test suites for no-space naming…
Manel-Romero Nov 25, 2026
17b9f02
docs(cloudLogs): update documentation for client integration and fold…
Manel-Romero Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/electron-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- "testing-view/**"
paths:
- "electron-app/**"
- "frontend/frontend-kit/**"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- ".github/workflows/electron-tests.yaml"

jobs:
Expand Down
5 changes: 3 additions & 2 deletions e2e/scripts/build-renderers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ if (!pnpmCli) throw new Error("Run this build through pnpm --dir e2e build");

for (const view of ["testing", "competition", "logging", "adj"]) {
// Preserve Testing's E2E build; do not rebuild it in normal mode afterwards.
const isJs = /\.(c|m)?js$/i.test(pnpmCli);
execFileSync(
process.execPath,
isJs ? process.execPath : pnpmCli,
Comment thread
Manel-Romero marked this conversation as resolved.
Resolved
[
pnpmCli,
...(isJs ? [pnpmCli] : []),
"--filter",
`${view}-view`,
view === "testing" ? "build:e2e" : "build",
Expand Down
60 changes: 60 additions & 0 deletions electron-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,66 @@ sudo ifconfig lo0 alias 127.0.0.9 up

- **Mode Selector**: html5 file to chose the mode of the app: testing, competition or flashing. Placed at `renderer/mode-selector`

## Cloud Logs

Cloud Logs is a desktop capability shared by Logging View and Testing View. The
renderer calls the narrow `window.electronAPI.cloudLogs` interface exposed from
`preload.js`; it does not access the filesystem, ZIP library, credentials, or
remote API directly. The IPC handlers in `src/cloudLogs/handlers.js` validate
that requests come from the local Logging or Testing window and keep local paths
inside the Electron main process.

The local folder format is `<logging_path>/logger/<app-launch>/<recording>/`.
Cloud uploads operate on one recording at a time. All regular session files
(configuration, CSVs, and metadata) are packaged and preserved in the recording
ZIP, including the root `logger_settings.json` and all current or future telemetry
subfolders. Launcher traces, symlinks, and directory traversal paths are excluded.
The date attached to a cloud record comes from the recording's
`logger_settings.json`, not from the time it was uploaded. Users must confirm
that recording has stopped; Electron checks that its files did not change while
it compressed the ZIP and reports compression progress to the requesting view.

Downloaded archives are checked and extracted into
`<logging_path>/logger/cloud-logs/<sanitized fileName or title>-<hh-mm-ss>/`. Extraction uses a staging
directory and rejects unsafe paths, links, duplicate entries, unsupported files,
encrypted ZIPs, and archives over the configured file and byte limits. Logging
View opens a downloaded recording through the same loader it uses for local
folders, so analysis works offline after download. `cloud-logs/` is created on
first use, even when the Go backend is not running.

The shared typed renderer contract is exported as `CloudLogsAPI` from
`@hyperloopupv/frontend-kit/core`. Testing View already has that type on its
Electron bridge, so it can call the same service without implementing another
network or filesystem client. The React implementation currently lives in
`frontend/logging-view/src/components/cloudLogs/CloudLogsDialog.tsx`.

Credentials are entered in the Cloud Logs dialog and managed by Electron in
`src/cloudLogs/credentials.js`. The user name and encrypted key are stored in
`<Electron userData>/cloud-logs.json` when OS secure storage is available. If
secure storage is unavailable, Electron keeps the key in memory until exit. The
key is never sent back to the renderer; the renderer only receives the user,
whether a key is configured, and whether storage is persistent.

### Cloud Logs API Integration

The remote HTTP adapter in `src/cloudLogs/client.js` is fully connected to the
Cloud Logs API (`https://cloud-logs.hyperloopupv.com/api/v1`, configurable via
`CLOUD_LOGS_API_URL` or `config.toml`) and supports direct-to-storage uploads
and downloads:

- **Catalog & Tags**: Lists paginated recordings (`listLogs`) and retrieves tag
suggestions for autocomplete (`autocompleteTags`).
- **Direct-to-Storage Uploads**: Uploads use a two-phase protocol where session
metadata is registered with the API (`POST /logs/initiate`) and the ZIP archive
is streamed directly to Google Drive via a pre-authenticated resumable upload URL,
followed by confirmation (`POST /logs/{id}/complete`).
- **Direct-to-Storage Downloads**: Downloads stream the ZIP archive directly from
storage to disk with size limit enforcement and error sanitization.

All requests are authenticated via `Bearer` token or `X-API-Key`. Detailed API
specifications, data mappings, and error formats are documented in
`src/cloudLogs/README.md`.

## Dependencies

- `electron` - Desktop application framework
Expand Down
6 changes: 4 additions & 2 deletions electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"author": {
"name": "Hyperloop UPV",
"email": "partners@hyperloopupv.com"
"email": "software@hyperloopupv.com"
},
"contributors": [
{
Expand Down Expand Up @@ -66,9 +66,11 @@
"dependencies": {
"@iarna/toml": "^2.2.5",
"ansi-to-html": "^0.7.2",
"archiver": "5.3.2",
"electron-store": "^11.0.2",
"electron-updater": "^6.7.3",
"picocolors": "^1.1.1"
"picocolors": "^1.1.1",
"yauzl": "2.10.0"
},
"devDependencies": {
"@vitest/coverage-v8": "^4.0.18",
Expand Down
40 changes: 22 additions & 18 deletions electron-app/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@

const { contextBridge, ipcRenderer } = require("electron");

/**
* Exposes Electron APIs to the renderer process via contextBridge.
* All methods use ipcRenderer.invoke for secure two-way communication with the main process.
* @type {Object}
* @property {function(): Promise<string>} getCurrentView - Gets the name of the currently loaded view.
* @property {function(string): Promise<string>} switchView - Switches to a different view.
* @property {function(Object): Promise<boolean>} saveConfig - Saves the configuration object.
* @property {function(): Promise<Object>} getConfig - Gets the current configuration object.
* @property {function(): Promise<boolean>} importConfig - Imports configuration from a file dialog.
* @property {function(): Promise<string | null>} selectFolder - Opens a folder selection dialog.
* @example
* // In renderer process:
* const view = await window.electronAPI.getCurrentView();
* await window.electronAPI.switchView("control-station");
* const config = await window.electronAPI.getConfig();
* await window.electronAPI.saveConfig({ database: { host: "localhost" } });
*/
contextBridge.exposeInMainWorld("electronAPI", {
// Cloud Logs API: credentials, sync, and transfer progress
cloudLogs: {
getCredentialsStatus: () =>
ipcRenderer.invoke("cloud-logs:credentials-status"),
setCredentials: (input) =>
ipcRenderer.invoke("cloud-logs:credentials-save", input),
clearCredentials: () => ipcRenderer.invoke("cloud-logs:credentials-clear"),
getLocalSessions: () => ipcRenderer.invoke("cloud-logs:local-sessions"),
selectSession: () => ipcRenderer.invoke("cloud-logs:select-session"),
list: (cursor) => ipcRenderer.invoke("cloud-logs:list", cursor),
autocompleteTags: (query) => ipcRenderer.invoke("cloud-logs:tags", query),
upload: (input) => ipcRenderer.invoke("cloud-logs:upload", input),
download: (input) => ipcRenderer.invoke("cloud-logs:download", input),
getDownloads: () => ipcRenderer.invoke("cloud-logs:downloads"),
// Subscribe to transfer progress; returns an unsubscribe callback
onProgress: (callback) => {
const listener = (_event, progress) => callback(progress);
ipcRenderer.on("cloud-logs:progress", listener);
return () => ipcRenderer.removeListener("cloud-logs:progress", listener);
},
},
// Get the currently loaded view name
getCurrentView: () => ipcRenderer.invoke("get-current-view"),
// Switch to a different view by name, optionally passing query params
Expand Down Expand Up @@ -61,7 +65,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
ipcRenderer.send("mode-selected", mode);
return Promise.resolve();
},
// Receive log message from backend
// Subscribes to backend log messages; returns an unsubscribe callback.
onLog: (callback) => {
const listener = (_event, value) => callback(value);
ipcRenderer.removeAllListeners("log");
Expand Down
Loading
Loading