[GH-ISSUE #4919] [Feature]: Easy Viewer for Professor Mari's edits (readable before/after diff on the review card) #2724

Closed
opened 2026-10-21 05:53:55 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Aug 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4919

Originally assigned to: @kolacheee on GitHub.

What problem does this solve?

When Professor Mari edits something, her Keep/Restore review card shows the change as a raw app_data … {JSON} command. Users can't tell what they're looking at — a character rewrite, a lorebook entry edit, and a preset change all appear as an opaque one-line JSON blob. The card already renders created and deleted rows in a friendly collapsible way, but it has no rendering at all for update/replace rows, so every edit falls through to the raw command string.

Proposed solution

Add an Easy Viewer for Mari's edits on the review card (DatabaseWorkspaceApprovalCard), shipped in phases. This issue covers phases 1–3 (a follow-up will cover phase 4):

  • Phase 1 — update field diff. Render update/replace rows as a per-field before/after diff (red for removed, green for added), with inline word-level highlighting. All the data is already client-side on approval.diffPreview[].before/.after (full row snapshots), so this needs no server change. Covers characters, presets, and lorebooks generically.
  • Phase 2 — lorebook Easy Viewer. For lorebook_entries changes, lay the edit out like the entry editor users know (name, keys, content, toggles) with the field-level red/green diff, instead of a generic key/value diff.
  • Phase 3 — per-entry approve + declutter. An Easy Viewer toggle on the card, and a per-entry "approve" (dismiss) control that hides a reviewed entry from the display so a multi-row change isn't cluttered; the existing whole-card Keep/Restore still governs the batch.

Word-level highlighting will use a small self-contained diff utility (no new dependency).

Alternatives considered

  • Reusing "Peek Prompt" to render characters/presets exactly as they'd appear in the assembled prompt. Deferred to the phase-4 follow-up: the prompt assembly is server-side (assemblePrompt reads persisted rows by ID), and apply:false returns before/after row objects rather than a rendered prompt, so a faithful Peek-Prompt view needs a new server endpoint. The phase-1 field diff already makes character/preset edits readable without it.
  • True per-entry reject (reverting a single row). Deferred to phase 4: reverting one row of a pending approval touches the audited durable-undo/reject path (#4813/#4828/#4852) and referential ordering, so it warrants its own scoped change.

Additional context

Follow-up to the Professor Mari memory/edit-review work (#4851, #4852). The review card is packages/client/src/components/chat/HomeProfessorMariChat.tsx; the diff data is MariDbPendingApproval.diffPreview (packages/shared/src/types/professor-mari-workspace.ts).

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Aug 11, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4919 Originally assigned to: @kolacheee on GitHub. ## What problem does this solve? When Professor Mari edits something, her Keep/Restore review card shows the change as a raw `app_data … {JSON}` command. Users can't tell what they're looking at — a character rewrite, a lorebook entry edit, and a preset change all appear as an opaque one-line JSON blob. The card already renders *created* and *deleted* rows in a friendly collapsible way, but it has **no rendering at all for `update`/`replace` rows**, so every edit falls through to the raw command string. ## Proposed solution Add an **Easy Viewer** for Mari's edits on the review card (`DatabaseWorkspaceApprovalCard`), shipped in phases. This issue covers **phases 1–3** (a follow-up will cover phase 4): - **Phase 1 — update field diff.** Render `update`/`replace` rows as a per-field before/after diff (red for removed, green for added), with inline word-level highlighting. All the data is already client-side on `approval.diffPreview[].before`/`.after` (full row snapshots), so this needs no server change. Covers characters, presets, and lorebooks generically. - **Phase 2 — lorebook Easy Viewer.** For `lorebook_entries` changes, lay the edit out like the entry editor users know (name, keys, content, toggles) with the field-level red/green diff, instead of a generic key/value diff. - **Phase 3 — per-entry approve + declutter.** An Easy Viewer toggle on the card, and a per-entry "approve" (dismiss) control that hides a reviewed entry from the display so a multi-row change isn't cluttered; the existing whole-card Keep/Restore still governs the batch. Word-level highlighting will use a small self-contained diff utility (no new dependency). ## Alternatives considered - Reusing "Peek Prompt" to render characters/presets exactly as they'd appear in the assembled prompt. Deferred to the phase-4 follow-up: the prompt assembly is server-side (`assemblePrompt` reads persisted rows by ID), and `apply:false` returns before/after row objects rather than a rendered prompt, so a faithful Peek-Prompt view needs a new server endpoint. The phase-1 field diff already makes character/preset edits readable without it. - True per-entry **reject** (reverting a single row). Deferred to phase 4: reverting one row of a pending approval touches the audited durable-undo/reject path (#4813/#4828/#4852) and referential ordering, so it warrants its own scoped change. ## Additional context Follow-up to the Professor Mari memory/edit-review work (#4851, #4852). The review card is `packages/client/src/components/chat/HomeProfessorMariChat.tsx`; the diff data is `MariDbPendingApproval.diffPreview` (`packages/shared/src/types/professor-mari-workspace.ts`). ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2724
No description provided.