Skip to content

Collect remote sessions on the Mac - #116

Merged
luhe19001 merged 3 commits into
mainfrom
ssh-mac/p2-manager-cache-api
Aug 31, 2026
Merged

Collect remote sessions on the Mac#116
luhe19001 merged 3 commits into
mainfrom
ssh-mac/p2-manager-cache-api

Conversation

@luhe19001

@luhe19001 luhe19001 commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Context

Remote sessions are collected on macOS through SSH/SFTP, with all coSlash parsing and caching kept local. The architecture now clarifies the privacy-preserving cache boundary and compatibility behavior.

Changes

  • Document opaque fingerprinting and bounded reparsing for remote session refreshes.
  • Specify that callers using the legacy session endpoint keep the existing local-session response.

Test

  • Not run — documentation-only PR update.

@calvintvu
calvintvu force-pushed the ssh-mac/p2-manager-cache-api branch from 48dcb0c to 62fb9c7 Compare August 28, 2026 22:01
@calvintvu

Copy link
Copy Markdown
Contributor

I found two P1 cache problems:

  1. Keep the last complete cache after a limited refresh.

When one agent fails or collection stops early, the manager saves and installs the incomplete result before it detects the limit. This action removes valid sessions from the last complete cache. Keep the last complete cache when limitedResultReason(result) reports a limit.

  1. Do not reuse a cache after an SSH alias change.

A settings change can keep the source ID and replace SSHAlias. After restart, the manager loads the old host cache and labels those sessions with the new alias. If the new host stays unavailable, the incorrect stale sessions remain visible. Clear the cache after an alias change, or store each cache by SSH alias.

@calvintvu
calvintvu marked this pull request as ready for review August 28, 2026 22:29
@luhe19001

Copy link
Copy Markdown
Collaborator Author

Addressed both P1 cache issues in 405eddf.

  • Limited refreshes now leave the installed and persisted last complete snapshot untouched, while reporting the limited state and displaying that snapshot as stale.
  • Changing the SSH alias for an existing source ID clears its cached snapshot before the new host is loaded, so unavailable replacement hosts cannot surface sessions from the old host.

Added regression coverage for both cases. Verified with cd collector && go vet ./... && go test ./....

@luhe19001
luhe19001 force-pushed the ssh-mac/p2-manager-cache-api branch from 405eddf to cd26d4a Compare August 29, 2026 22:43
@luhe19001

Copy link
Copy Markdown
Collaborator Author

Rebased onto ssh-mac/p1-parser-sftp and resolved the merge conflicts. The resolution keeps the base branch’s session-family/byte-limit behavior and retains this PR’s selected-file fingerprints for cache persistence.

Verified with cd collector && go vet ./... && go test ./....

@luhe19001 luhe19001 added the enhancement New feature or request label Aug 29, 2026
@luhe19001
luhe19001 requested review from calvintvu and milanshen and removed request for calvintvu August 30, 2026 21:06
Base automatically changed from ssh-mac/p1-parser-sftp to main August 31, 2026 18:51
Add optional remote settings, one-flight SFTP refresh, sanitized last-good caching, source-aware API responses, bounded health diagnostics, and stable unsupported action errors. All discovery and parsing runs locally; Linux only serves read-only SFTP data.
@luhe19001
luhe19001 force-pushed the ssh-mac/p2-manager-cache-api branch from a58e7f7 to 60fa8f0 Compare August 31, 2026 18:56
@luhe19001
luhe19001 merged commit e93675f into main Aug 31, 2026
3 checks passed
@luhe19001
luhe19001 deleted the ssh-mac/p2-manager-cache-api branch August 31, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants