Skip to content

refactor: unify CLI and browser share code paths#304

Merged
tomasz-tomczyk merged 1 commit intomainfrom
refactor/302-unify-share-paths
Apr 18, 2026
Merged

refactor: unify CLI and browser share code paths#304
tomasz-tomczyk merged 1 commit intomainfrom
refactor/302-unify-share-paths

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

What changed

  • share.go: Removed buildShareFromSession (-34 lines)
  • session.go: Added LoadShareFilesFromDisk() — copies file paths under read lock, reads content from disk outside the lock
  • server.go: handleShare now uses loadCommentsForShare + LoadShareFilesFromDisk instead of the removed function
  • share_test.go: Updated TestHandleShare_* tests to set up real files on disk and a .crit.json review file

Net: -89 lines.

Test plan

  • go test ./... — all pass
  • go vet ./... — clean
  • make e2e-share — all 18 share integration tests pass (including TestShareSyncReviewLevelComments and TestShareSyncFullLifecycle)

Closes #302

Replace the browser share path (buildShareFromSession) with the same
disk-based approach used by `crit share` CLI. handleShare now reads file
content from disk via LoadShareFilesFromDisk and comments from the
review file via loadCommentsForShare, eliminating the buggy in-memory
path that missed review comments and would need duplicated updates for
future features like orphaned file support.
@tomasz-tomczyk tomasz-tomczyk merged commit 125e1fb into main Apr 18, 2026
4 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the refactor/302-unify-share-paths branch April 18, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify CLI and browser share code paths Review-level comments dropped when sharing from live session

1 participant