Definitions: view an earlier version and restore it
Description
Goal
Admins can open any earlier version of a definition, see exactly how it was set up, move between versions, and bring an earlier version back as the current one.
This ticket builds on AP-2096 (change reason, version history page, Web API version endpoints). It is developed on its own branch, stacked on AP-2096, and goes to dev after AP-2096.
Product decisions
-
Viewing an earlier version. From the version history page, "View" opens the definition form for that version, read-only. Settings, steps, parallel groups and step details can all be opened, and nothing can be changed. The link to a version can be shared.
-
Banner on top of an earlier version.
-
It says: "You're viewing version N of M".
-
It shows when and by whom the version was saved, and its change reason.
-
It says it is not the current version, how many approvals still run on it, and that conditions are shown as they are now.
-
Actions: "Restore this version", "Open current version", the previous and next version, and "Version history".
-
-
Opening the current version number this way just opens the normal definition form.
-
Restore.
-
"Restore this version" opens the normal edit form, filled with the earlier version and with a warning banner "Restoring version N".
-
The user can review or adjust it and saves it as usual.
-
Saving creates a new current version marked "Restored from version N". History is never changed, and approvals that are already running keep the version they started with.
-
-
Restore is checked like any save. An archived condition, or a calendar or Slack workspace removed while the form is open, produces an error the editor can fix in the same draft. If an earlier deletion already cleared the stored reference, the restored version uses the existing fallback.
-
Space. Restore keeps the definition in its current space.
-
Who can do what. Viewing earlier versions: the same people who can see the version history (AP-2096). Restoring: only people who can edit the definition. Hidden values are masked the same way as on the current version.
-
History page. Each row gets the hover actions "View" and "Restore". Restore is not shown on the current version or to people who can't edit.
-
Conditions show their current setup on every version, because conditions have their own history.
Acceptance criteria
-
From the version history, View opens version N read-only in the full page layout, with the information banner and its actions. Previous / next switch versions without going back to the list.
-
Nothing can be edited, added, moved or deleted on an earlier version, including inside step and parallel group details.
-
Restore this version opens the edit form filled with version N and the warning banner. Saving creates version M+1 marked "Restored from version N" with the user as author, shows "Definition ... restored from version N" and returns to the version history.
-
Restoring a version that uses an archived condition shows the existing error, and after replacing the condition the save works.
-
People without edit permission don't see Restore anywhere, and the save is refused for them.
-
People who can't open the definition can't open its earlier versions, also through a crafted URL.
-
An unknown version number or a deleted definition shows the existing error state.
-
Works in the Jira and Confluence apps.
Change
The Jira and Confluence history pages open a full, read-only definition. Editors can use an earlier configuration as a draft and save it as a new version in the current space. The history records the source version and the editor.
Fixes included
-
Opening history from the editor gives a Back to definition action that returns to the same form after paging. Opening it from the list gives Back to Definitions.
-
The date link opens the displayed version in a new tab. Back from a directly opened version leads to its history. Jira’s address follows version navigation.
-
Read-only step and parallel group details open by mouse or keyboard. An unset description displays as an empty field.
-
Delegated editors can restore an unchanged masked webhook, including when the form trims whitespace. A partial replacement identifies the affected step and asks the editor to replace or clear its masked fields.
-
Restore keeps the definition in its current space. If someone moves it while the draft is open, the editor is prompted to reload. A Slack workspace removed while editing produces a correctable save error.
-
Existing compact previews keep their layout. A viewer opening the current version from history gets the full read-only form.
Manual tester notes
-
In Jira and Confluence, open an earlier version from history. Check its author, date, change reason and running approval count. Open a step and a parallel group, then move between versions.
-
From the editor, open Audit and Version history, change the page size, and use Back to definition. Repeat from the Definitions list and check that Back returns to the list.
-
Open the version date link in a new tab. Check the same version appears and Back opens its history. Open the current version and check the usual form appears.
-
Restore an earlier version with and without edits. Check the success message, the new top row and the source version. An approval already running should keep its original version.
-
Restore a version with an archived condition. Save, read the error, replace or remove the condition, and save the same draft again.
-
Check that a read-only viewer can inspect history and sees no Restore action. As a delegated editor, restore an unchanged masked webhook, then try changing its destination while keeping masked headers. The error should name the step.
-
Open an unknown version or a definition outside the account’s access. The form should show its existing error state.
Out of scope (possible follow-ups)
Comparing two versions side by side, restore through the Web API (a GET of the version plus a PUT does it), pinning the condition version, linking condition usage history to the exact definition version.