Skip to content

Add Overleaf-style LaTeX version history with automatic checkpoints and visual diffs#102

Open
SmallSpider0 wants to merge 8 commits into
ResearAI:mainfrom
SmallSpider0:fix/latex-workspace-synctex-clean
Open

Add Overleaf-style LaTeX version history with automatic checkpoints and visual diffs#102
SmallSpider0 wants to merge 8 commits into
ResearAI:mainfrom
SmallSpider0:fix/latex-workspace-synctex-clean

Conversation

@SmallSpider0
Copy link
Copy Markdown

Follow-up

Follow-up to #101: Improve LaTeX workspace, SyncTeX jumps, and edit safety.

#101 makes the LaTeX editor behave like a safer Overleaf-style local workspace: one project editor, multi-file source switching, SyncTeX PDF-to-source jumps, denser editor chrome, and protection against external source edits.

This PR builds on that foundation by adding the missing version-history layer for LaTeX manuscripts.

Review note: this is intended as a stacked follow-up to #101. The follow-up-only range is:

SmallSpider0:fix/latex-workspace-synctex..SmallSpider0:fix/latex-workspace-synctex-clean

Compare link:

SmallSpider0/DeepScientist@fix/latex-workspace-synctex...fix/latex-workspace-synctex-clean

Problem

After #101, the LaTeX editor is much safer for active editing, but it still lacks an Overleaf-like way to inspect and recover historical manuscript states.

This matters because LaTeX papers are often edited over long sessions by both users and AI/file tools. Without visual version history, restore actions are risky: users can create or restore versions, but cannot easily see what changed before deciding whether to roll back.

A local-first research workspace needs more than source editing and PDF preview. It also needs lightweight, trustworthy manuscript history so users can understand changes, compare archive points, and recover earlier states without losing work.

Solution

This PR adds Git-backed LaTeX version history scoped to the current LaTeX project folder.

Backend:

  • Add LaTeX version APIs for:
    • listing versions
    • creating manual versions
    • creating policy-driven automatic versions
    • reading version metadata and files
    • comparing versions
    • restoring the active file or the whole LaTeX project
  • Store LaTeX version metadata under quest-local .ds state while keeping Git as the durable source of truth.
  • Add visible manual / automatic archive points and hidden build snapshots.
  • Add policy-driven automatic checkpoints so versions are created regularly but not too frequently.
  • Create automatic versions after meaningful source changes, long editing intervals, AI/file-diff edits, saves, visibility changes, and compile actions.
  • Fix version-history route/query handling and request-body parsing issues that caused 500 errors.

Frontend:

  • Add a LaTeX History view.
  • Make History occupy the full LaTeX content area when opened, hiding the source editor and PDF preview.
  • Remove separate “View changes” and “Compare current” buttons.
  • Automatically compare the selected history item with the latest archive point.
  • Show changed files and inline red/green unified diffs.
  • Keep restore actions for:
    • active file restore
    • whole LaTeX project restore
  • Add a toggle for hidden build snapshots.
  • Update English and Chinese workflow docs.

Test

pytest tests/test_latex_runtime.py tests/test_api_contract_surface.py -q
npm --prefix src/ui run build

Result:

38 passed
UI build passed

Local deployment smoke check:

  • daemon health OK at http://127.0.0.1:20999/api/health
  • rebuilt UI served successfully from the local daemon

@SmallSpider0
Copy link
Copy Markdown
Author

02e7beca4f669c65f791ac0f38ffbf0b

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