Skip to content

feat: render orphaned files in shared reviews#91

Merged
tomasz-tomczyk merged 4 commits intomainfrom
feat/291-orphaned-file-rendering
Apr 18, 2026
Merged

feat: render orphaned files in shared reviews#91
tomasz-tomczyk merged 4 commits intomainfrom
feat/291-orphaned-file-rendering

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

@tomasz-tomczyk tomasz-tomczyk commented Apr 18, 2026

Summary

Ports orphaned file rendering from crit local to crit-web shared reviews.

  • Migration: Added status column (Ecto enum: added|modified|deleted|renamed|removed, default modified) to review_round_snapshots. No separate orphaned boolean — removed status indicates orphaned files.
  • Backwards compat: API accepts orphaned: true in old payloads and maps it to status: "removed"
  • API: POST /api/reviews persists status per file; GET /api/reviews/:token/document returns it
  • Rendering (document-renderer.js):
    • "Removed" badge on file header when status === "removed"
    • No "add comment" button for removed files
    • All comments rendered as file-level (not line-anchored)
    • Italic placeholder instead of content body
    • Collapsed by default
  • CSS: .file-header-badge.removed and .orphaned-placeholder styles with theme variables in all 4 blocks

Test plan

  • mix test — 387 tests pass
  • mix compile --warnings-as-errors — clean
  • Visual verification: orphaned file renders with badge, placeholder, and comments
  • Backwards-compat test for orphaned: true payloads

See also: tomasz-tomczyk/crit#305 — companion PR for share payload

Add status and orphaned columns to review_round_snapshots table.
When the CLI shares files with orphaned: true, crit-web now persists
and surfaces this through the API and frontend:

- Migration adds status (string) and orphaned (boolean) columns
- Schema relaxes content validation for orphaned files (empty content)
- Document API and LiveView init include orphaned/status for flagged files
- Frontend renders "Removed" badge, italic placeholder, no add-comment
  button, and all comments as file-level for orphaned files
- CSS styles match crit local (badge-removed variables already existed)
Replace the separate `status` (string) + `orphaned` (boolean) fields with
a single `status` Ecto.Enum field with values: :added, :modified, :deleted,
:renamed, :removed. The :removed status replaces the orphaned boolean.

- Migration only adds the status column (no orphaned column)
- Schema uses Ecto.Enum with default :modified
- Reviews context maps legacy orphaned:true payloads to status:"removed"
- API and LiveView always include status per file
- JS checks file.status === 'removed' instead of file.orphaned
@tomasz-tomczyk tomasz-tomczyk merged commit 4b5b8f7 into main Apr 18, 2026
1 check passed
@tomasz-tomczyk tomasz-tomczyk deleted the feat/291-orphaned-file-rendering branch April 18, 2026 10:18
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.

1 participant