fix/proxmox-reconnect-v1.2.3 #125
No reviewers
Labels
No Label
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sarman/tftsr-devops_investigation#125
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/proxmox-reconnect-v1.2.3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
session pool was never populated on app open. Added ProxmoxEnvelope to strip the wrapper correctly. Also fixed: CSRF token (CSRFPreventionToken) was never stored or sent, so all mutating operations (VM start/stop,
firewall edits) would have failed with a CSRF check error; add_proxmox_cluster was inserting an unauthenticated stub into the pool and immediately reporting "connected"; disconnect_proxmox_cluster had no backend
command so the session was never actually dropped; reqwest was rejecting self-signed Proxmox certificates.
below), and stopped VMs were being silently dropped because cpu was absent from the response for halted guests — fixed to unwrap_or(0.0).
certificates, acme, firewall, sdn, ha, apt, updates, updates_ext, tasks, migration, metrics, shell, auth_realm, views, backup) was calling .get("data") a second time. This always returned None, causing 19 functions
across 18 files to silently return empty arrays or "Invalid response format" errors regardless of what the API actually returned.
Test plan
Root cause: authenticate() tried to deserialize the Proxmox API response directly into AuthResponse, but Proxmox wraps every response in {"data": {...}}. This caused every reconnect attempt after app restart to fail silently. Additional fixes bundled in this commit: - add_proxmox_cluster now authenticates immediately so the in-memory pool always contains a live, ticketed client (not a bare unauthenticated stub) - ProxmoxClient stores the CSRFPreventionToken and includes it in the CSRFPreventionToken header on POST/PUT/DELETE requests (Proxmox requires this for all mutating calls) - accept-invalid-certs enabled on the reqwest Client so self-signed PVE certificates do not block connections - Removed double-unwrap of the data field in 10 commands (list_acls, list_users, get_cluster_notes, search_proxmox_resources, get_node_status, get_syslog, list_network_interfaces, get_subscription_status, list_cluster_tasks, list_proxmox_containers) — handle_response already strips the envelope before returning to callers - Added connect_proxmox_cluster and disconnect_proxmox_cluster Tauri commands so the UI can explicitly connect/disconnect sessions - Wired RemotesPage Connect/Disconnect buttons to the real backend commands - Updated and added tests covering envelope parsing, CSRF header logic, already-unwrapped response handling, and the new connect/disconnect pathshandle_response() in client.rs already strips the {"data":...} wrapper before returning to callers. Every proxmox module was calling .get("data") a second time on the already-unwrapped Value, which always returned None and caused all API responses to silently yield empty results or errors. vm.rs had an additional bug: list_vms used POST on cluster/resources (a GET-only endpoint) and dropped VMs with no cpu field via filter_map ? instead of unwrap_or(0.0). Both corrected. Affected modules: vm, ceph, ceph_cluster, certificates, acme, firewall, sdn, ha, apt, updates, updates_ext, tasks, migration, metrics, shell, auth_realm, views, backup — 18 files, 19 functions. 426 Rust tests pass. clippy -D warnings clean. tsc --noEmit clean.afe9ac1a3ato4d066e47fdAutomated PR Review could not be completed - LLM analysis failed or produced no output.
Automated PR Review (qwen3.5-122b-think via liteLLM):\n\n_This PR was reviewed in 4 batches (0 batch(es) failed)._
Batch 1 of 4
CODE REVIEW SUMMARY
This batch contains the CI/CD workflow changes and the core Proxmox command implementations. The changes appear well-structured and address the authentication, connection state, and response parsing issues described in the PR body.
Summary
The Batch 1 changes implement critical infrastructure for the Proxmox reconnect feature. The workflow batching logic is sound for handling large PRs, and the Proxmox commands properly handle authentication before storing clusters, with correct double-unwrap fixes applied. No critical bugs detected in this batch.
Findings
No findings. All examined code follows correct patterns for async Rust, proper error handling, and Tauri command registration. The workflow batching respects file boundaries and properly aggregates verdicts across batches.
Minor observation (SUGGESTION): The workflow file uses
jq -cnwith--rawfilewhich is a relatively new feature. Consider adding a fallback or version check if this workflow needs to run on older Gitea runners that may not support this syntax.Minor observation (SUGGESTION): The
connect_proxmox_clustercommand returnsResult<bool, String>but always returnsOk(true)on success. Consider returningResult<(), String>since the boolean doesn't add information beyond the Result itself.Verdict: APPROVE WITH COMMENTS
Notes for subsequent batches:
client.rs,vm.rs, and the other proxmox module files where theProxmoxEnvelope<T>, CSRF token handling, and certificate configuration changes are implemented. These files are critical to verify the complete fix.cli/mod.rs) referencesclient.authenticate()which should now take&mut selfbased on the PR description - verify this signature change is consistent across all callers.Batch 2 of 4
CODE REVIEW - BATCH 2 OF 4
Summary
This batch contains 7 Proxmox module files (acme, apt, auth_realm, backup, ceph, ceph_cluster, certificates) where the double-unwrap fix for the Proxmox API response envelope has been partially applied. The ceph.rs diff correctly shows the transition from
response.get("data").and_then(|d| d.as_array())toresponse.as_array(), confirming the client'shandle_response()already strips the wrapper. However, several error messages still reference "missing 'data' field" which is now misleading since the wrapper is stripped at the client layer.Findings
[WARNING] src-tauri/src/proxmox/acme.rs:72 - Error message references non-existent "data" field after client strips wrapper
Evidence:
Err("Invalid response format: missing 'data' field".to_string())Fix: Change to
Err("Invalid response format".to_string())[WARNING] src-tauri/src/proxmox/acme.rs:197 - Same issue in
get_acme_challengesEvidence:
Err("Invalid response format: missing 'data' field".to_string())Fix: Change to
Err("Invalid response format".to_string())[WARNING] src-tauri/src/proxmox/backup.rs:300 - Error message inconsistent with actual response structure
Evidence:
Err("Invalid response format: missing 'data' field".to_string())Fix: Change to
Err("Invalid response format".to_string())[WARNING] src-tauri/src/proxmox/certificates.rs:379 - Same issue in
list_certificatesEvidence:
Err("Invalid response format: missing 'data' field".to_string())Fix: Change to
Err("Invalid response format".to_string())[WARNING] src-tauri/src/proxmox/certificates.rs:458 - Same issue in
list_node_certificatesEvidence:
Err("Invalid response format: missing 'data' field".to_string())Fix: Change to
Err("Invalid response format".to_string())Notes on Consistency
response.get("data")calls removed)Verdict: APPROVE WITH COMMENTS
The functional fix is correct (response structure handling is now consistent with the client stripping the wrapper). The only issues are misleading error messages that reference a "data" field that no longer exists in the response. These should be updated for clarity but won't cause functional failures.
Batch 3 of 4
Summary
I reviewed all 10 proxmox module files in this batch. The code implements proper Proxmox API envelope handling with
ProxmoxEnvelope<T>inclient.rs, correct CSRF token handling for mutating operations, and consistent error handling patterns across all modules. No compilation errors, security vulnerabilities, or logic bugs were detected.Findings
No findings.
Verdict: APPROVE
Batch 4 of 4
Summary
This batch (BATCH 4 of 4) contains the Proxmox VM management module, dashboard views module, TypeScript client updates, and the Remotes page UI. The changes address the core issues described in the PR: fixing the data envelope handling, correcting the VM listing endpoint, and adding proper connect/disconnect functionality. No critical bugs or security issues were found in this batch.
Findings
[SUGGESTION] src/pages/Proxmox/RemotesPage.tsx:29 - Status field type narrowing could be more explicit
Evidence:
status: (c.connected ? 'connected' : 'disconnected') as RemoteInfo['status']Fix: Consider adding explicit type annotation
RemoteInfo['status']or use a type guard to ensure the cast is safe. The current code works but theascast bypasses TypeScript's type checking for this field.[SUGGESTION] src-tauri/src/proxmox/views.rs:68 - Error message could include more context
Evidence:
Ok(vec![])when response is not an arrayFix: Consider logging or returning a more descriptive error if the API response format is unexpected, rather than silently returning an empty array. This would help with debugging API compatibility issues.
Verdict: APPROVE
Detailed Analysis
src-tauri/src/proxmox/views.rs: The code correctly handles the Proxmox API response without double-unwrapping the data envelope. The
list_views,add_view,update_view,delete_view, andget_viewfunctions all properly use the ticket parameter and handle JSON parsing correctly.src-tauri/src/proxmox/vm.rs: The
list_vmsfunction correctly uses GET oncluster/resources?type=vmand properly handles thecpufield being absent for stopped VMs withunwrap_or(0.0). This addresses the issues described in the PR.src/lib/proxmoxClient.ts: The new
connectProxmoxClusteranddisconnectProxmoxClusterfunctions are properly typed and invoke the corresponding Tauri commands with correct parameter types.src/pages/Proxmox/RemotesPage.tsx: The component properly integrates the new connect/disconnect functionality with appropriate error handling and toast notifications. The status updates in the UI state are consistent with the backend operations.
The changes in this batch are consistent with the PR description and do not introduce any new issues. The code quality is appropriate for production use.
Overall Verdict: APPROVE WITH COMMENTS
Overall verdict reflects the most critical finding across all batches.