waveterm/pkg/wshrpc/wshremote
Copilot ed7fa40300
Refine RemoteFileMultiInfoCommand semantics: dedup inputs, per-path stat errors, and cancellation (#2935)
This follow-up tightens the new multi-file remote stat RPC behavior to
match expected usage: duplicate input paths are skipped, per-path stat
failures no longer fail the entire call, and cancellation is respected
during iteration.

- **RPC response model**
  - Added `staterror` to `FileInfo`:
    - `StatError string \`json:"staterror,omitempty"\``
  - Generated TS type now exposes `staterror?: string` on `FileInfo`.

- **`RemoteFileMultiInfoCommand` behavior updates**
- **Dedup:** if an input path key is already present in the result map,
the loop continues.
- **Non-fatal stat failures:** on `fileInfoInternal` error, the command
now emits a `FileInfo` entry for that input with:
    - resolved `path`, `dir`, `name`
    - `staterror` populated with `err.Error()`
    - continues processing remaining paths.
- **Cancellation:** checks `ctx.Err()` at the top of each iteration and
returns immediately if canceled.

- **PR scope cleanup**
  - Removed the previously added test file from this PR per request.

```go
if _, found := rtn[path]; found {
    continue
}
if ctx.Err() != nil {
    return nil, ctx.Err()
}
fileInfo, err := impl.fileInfoInternal(cleanedPath, false)
if err != nil {
    rtn[path] = wshrpc.FileInfo{
        Path:      wavebase.ReplaceHomeDir(cleanedPath),
        Dir:       computeDirPart(cleanedPath),
        Name:      filepath.Base(cleanedPath),
        StatError: err.Error(),
    }
    continue
}
```

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
2026-02-25 12:52:50 -08:00
..
sysinfo.go Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
wshremote.go Persistent Terminal Sessions (+ improvements and bug fixes) (#2806) 2026-01-28 13:30:48 -08:00
wshremote_file.go Refine RemoteFileMultiInfoCommand semantics: dedup inputs, per-path stat errors, and cancellation (#2935) 2026-02-25 12:52:50 -08:00
wshremote_job.go update logging for jobmanager. (#2854) 2026-02-10 18:43:54 -08:00