Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 15 additions & 2 deletions src/OpenIPC.Viewer.App/ViewModels/SingleCameraPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,8 +1248,21 @@ private async Task EditMajesticOverSshAsync()
{
var cfgTask = _majestic.GetConfigAsync(ep, ct);
var infoTask = _majestic.GetInfoAsync(ep, ct);
await Task.WhenAll(cfgTask, infoTask).ConfigureAwait(false);
return (await cfgTask.ConfigureAwait(false), await infoTask.ConfigureAwait(false));
var config = await cfgTask.ConfigureAwait(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Info failures go unobserved after config fails 🐞 Bug ☼ Reliability

GetMajesticStateAsync starts infoTask but awaits cfgTask before reaching the only await of
infoTask. If config fails or is canceled first and the info request also faults, the method exits
without observing that second exception, while its caller logs only the config failure.
Agent Prompt
## Issue description
The info request starts concurrently with config, but a config failure exits before the info task is observed.

## Fix Focus Areas
- src/OpenIPC.Viewer.App/ViewModels/SingleCameraPageViewModel.cs[1249-1265]

## Recommended Fix
Ensure the info task's completion or exception is observed even when the config await fails, without replacing the config error or making an info failure hide a valid config.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


// info.json is optional metadata (model/firmware) — a firmware that
// doesn't serve it must not hide an otherwise editable config.
MajesticInfo info;
try
{
info = await infoTask.ConfigureAwait(false);
}
catch (Exception ex) when (!ct.IsCancellationRequested)
{
_logger.LogInformation(ex, "Majestic info unavailable for {CameraId}", _camera.Id);
info = new MajesticInfo(null, null, null, null);
}
return (config, info);
}

[RelayCommand]
Expand Down
7 changes: 7 additions & 0 deletions src/OpenIPC.Viewer.Devices/Majestic/MajesticHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ public async Task<MajesticConfig> GetConfigAsync(MajesticEndpoint endpoint, Canc
public async Task<MajesticInfo> GetInfoAsync(MajesticEndpoint endpoint, CancellationToken ct)
{
using var resp = await SendAsync(endpoint, HttpMethod.Get, "api/v1/info.json", ct).ConfigureAwait(false);
// Newer lite builds (e.g. gk7205v200 2.6.09.24-lite) dropped info.json
// entirely and answer 404 — same meaning as the HTML fallback below.
if (resp.StatusCode == System.Net.HttpStatusCode.NotFound)
{
_logger.LogDebug("Majestic info.json not served by {Host}; skipping", endpoint.Host);
return new MajesticInfo(null, null, null, null);
}
await EnsureSuccessAsync(resp, ct).ConfigureAwait(false);
var rawJson = await resp.Content.ReadAsStringAsync(ct).ConfigureAwait(false);
// Some firmwares don't serve info.json and return the web UI's HTML
Expand Down
Loading