Skip to content

feat: add exact snapshot preview - #97

Merged
luhe19001 merged 2 commits into
mainfrom
feature/t2-c2-exact-preview
Aug 18, 2026
Merged

feat: add exact snapshot preview#97
luhe19001 merged 2 commits into
mainfrom
feature/t2-c2-exact-preview

Conversation

@luhe19001

@luhe19001 luhe19001 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

What this changes

This PR adds an exact, local preview of the session snapshot that a future Team sharing flow will upload. The preview is created before any data leaves the machine and from the selected saved session revision.

This PR introduces This prevents
A pre-upload preview of the exact selected session snapshot Sending session data to a server before the user can review it
One canonical serialization path whose unchanged bytes are displayed by the preview and can be passed to the future uploader A separate preview payload builder drifting from the data that is actually uploaded
A controlled preview dialog with an explicit development-only test entry point Showing Team sharing controls to users of the local-only application

What users see

The normal local-only experience is unchanged: no sharing button is shown.

When the development test entry point is enabled, a session has a Team sharing preview action. The dialog is labeled PREVIEW ONLY · TEAM FEATURE and shows:

  • the canonical JSON snapshot and its byte size and content hash;
  • repository identity, frozen cost, and any unpriced models;
  • fields that were redacted or truncated, including known credential patterns; and
  • data that is structurally excluded, including raw transcripts, assistant reasoning, tool output, file diffs, commands, environment variables, and unresolved local paths.

Other sensitive text can remain in the bounded firstPrompt, so the dialog shows its exact value for review rather than claiming that every possible credential format is removed.

The preview blocks approval when the snapshot is invalid, uses an unsupported format, no longer matches the selected revision, or exceeds the 256 KiB payload limit. This PR does not provide an approval or upload action.

Implementation boundary

The local collector owns this preview because both the session source and the existing session-snapshot/v1 serializer are local. The collector serializes the snapshot once, and the preview decodes those same bytes for display. A future Team sharing flow must upload those unchanged, already-reviewed bytes.

This PR includes:

  • the local /api/share-preview endpoint for one session ID and revision;
  • the versioned snapshot-preview/v1 response and its fail-closed states;
  • the controlled React preview dialog and byte-parity checks; and
  • privacy documentation and public/server fixture conformance.

This PR does not include Team eligibility, authentication, destination selection, multi-session selection, consent submission, upload, retry, or success navigation. Those belong to the production Team sharing flow that will consume this preview.

Try the preview

  1. From collector/, run make run.
  2. In another terminal, from frontend/, run npm run dev.
  3. Open http://127.0.0.1:5173/?team-preview=1.
  4. Select a session and click Team sharing preview.

Remove ?team-preview=1 to confirm that the local-only UI contains no sharing action.

Exact Team sharing preview showing the canonical local session snapshot

Verification

  • go test ./...
  • go vet ./...
  • 19 frontend tests
  • frontend build, lint, and format checks
  • snapshot fixture validation against coSlash Server commit c0fabc8

Follow-up requirement

The production Team sharing flow must open this controlled preview only after the user enters a sharing flow and selects what to share. It must upload the exact canonical bytes the user reviewed, rather than rebuilding the snapshot.

@luhe19001
luhe19001 marked this pull request as draft August 18, 2026 14:23
@luhe19001
luhe19001 force-pushed the feature/t2-c2-exact-preview branch 3 times, most recently from 579db39 to 0d5c113 Compare August 18, 2026 15:39
@luhe19001
luhe19001 marked this pull request as ready for review August 18, 2026 15:40
@luhe19001
luhe19001 force-pushed the feature/t2-c2-exact-preview branch from 0d5c113 to 1d90ea8 Compare August 18, 2026 15:59
Publish the snapshot-preview/v1 adapter and exact-byte parity helpers, expose a revision-bound local preview API, and add the See what gets shared dialog with privacy and failure states.

Verification: go test ./..., go vet ./..., frontend tests/build/lint/format, and pinned server snapshot conformance.
@luhe19001
luhe19001 force-pushed the feature/t2-c2-exact-preview branch from 1d90ea8 to 1ad93b1 Compare August 18, 2026 16:14
@luhe19001 luhe19001 added the enhancement New feature or request label Aug 18, 2026
Comment thread frontend/src/pages/coslash/lib/preview.ts Outdated
Comment thread frontend/src/pages/coslash/lib/preview.ts Outdated
Comment thread collector/internal/collector/collector.go Outdated
Comment thread frontend/src/pages/coslash/components/SnapshotPreviewDialog.tsx Outdated
@luhe19001
luhe19001 requested a review from calvintvu August 18, 2026 17:49
@luhe19001
luhe19001 merged commit 09a1979 into main Aug 18, 2026
3 checks passed
@luhe19001
luhe19001 deleted the feature/t2-c2-exact-preview branch August 18, 2026 19:18
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.

2 participants