Skip to content

Versioning and history#3659

Draft
Nocaxe wants to merge 19 commits intosource-academy:masterfrom
Nocaxe:Versioning-and-History
Draft

Versioning and history#3659
Nocaxe wants to merge 19 commits intosource-academy:masterfrom
Nocaxe:Versioning-and-History

Conversation

@Nocaxe
Copy link

@Nocaxe Nocaxe commented Mar 16, 2026

Description

This PR implements versioning and history for the editor in coding assignments, such as missions, quests, and paths. Currently there is no versioning, and the editor only saves and submits the latest version to the server.

This change aims to:
allow students to review or edit previous versions of their code
allow TA’s to understand their student’s coding process to better guide them
allow admins to check for suspicious coding patterns (copy pasting from AI or plagiarism)

Features:
Control Bar Changes:
The original save button has been removed, as the code is now autosaved with a 3 second debounce.
A new saving indicator shows the status of the code, between saving, saved, and saving failed. Whenever unsaved changes are detected, the indicator will show “Saving” and once the debounce expires and the code is saved, it shows “Saved” or “Saving failed” based on the response from the backend.
A new history button opens up the version history view explained below.

Saved Saving Failed

Note: The save button is NOT removed for team assessments as every save will override teammate’s code as well, so we keep the manual save. The saving indicator is removed, but the history button remains, as the version history viewing and restoring still works using manually submitted versions.

Team

Versions are stored in a linear fashion ordered and named by default by timestamp:
Timestamp 2 ← Current Version
Timestamp 1

When a previous version is restored, it is simply saved as a new version on top of the previous versions:
Timestamp 1 - restored ← Current Version
Timestamp 2
Timestamp 1

When the history button is clicked, a drawer opens up on the right of the screen, showing the versions and a preview of that version’s code. The student can restore a version by clicking the “Restore this version” button after selecting and previewing that version.

Students can rename the versions by clicking on the default timestamp name. A separate timestamp will still remain below the name.

Video.1.mov

Possible improvements:
Saving deltas for small changes and snapshots for major changes.
Only display snapshots for major changes when opening the version history panel, and show the versions saved as deltas as a drop down if detailed versions are requested by the user.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Added tests to WorkspaceSaga.test.ts, WorkspaceReducer.test.ts, and WorkspaceActions.test.ts to test changes.

Manually tested coding in the editor to see if functionality is as expected
Steps taken:
Continuously typed to ensure debounce works
Stop typing to check if debounce runs out and code is submitted and saved
Check version history panel to see if all versions are displayed correctly
Rename a version and check if change is saved correctly
Restore a version and check if code is restored, submitted and renamed correctly
Edited code but made no changes to ensure duplicates are not saved as a new version
Refresh the page to check if the initial population of the editor causes an unwanted extra save

Checklist

  • I have tested this code

@Nocaxe Nocaxe added the Enhancement New feature request label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants