Skip to content

Let users keep the instance's env vars when rolling back to a snapshot - #9009

Open
andypalmi wants to merge 6 commits into
mainfrom
9007-rollback-merge-env-vars
Open

andypalmi wants to merge 6 commits into
mainfrom
9007-rollback-merge-env-vars

Conversation

@andypalmi

@andypalmi andypalmi commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #9007

Description

  1. Rolling back always replaced the instance's env vars with the snapshot's. For a snapshot that came from another instance, such as one a pipeline stored on the target, that copied the other instance's env vars, hidden ones included, with no warning.
  2. The rollback endpoint accepts an optional mergeEnvVars boolean and passes it to importProjectSnapshot. It defaults to false, so API callers that omit it behave as before.
  3. The rollback dialog has a "Keep the instance's current environment variables" checkbox, ticked by default. Unticked gives the old replace behaviour.
  4. Keep uses the existing merge: keys only in the snapshot are added, existing keys keep their values, keys only on the instance are left alone.
  5. The rolled-back audit entry records which option was used and the audit log screen shows it.
Screenshot 2026-10-23 at 12 14 10

Testing

  1. New unit test in projectSnapshots_spec.js covers mergeEnvVars true and false, with a key only on the instance and a key only in the snapshot, and checks the audit entry.
  2. New audit log unit test for the info field.
  3. The Cypress rollback spec checks the checkbox is shown and that the request sends mergeEnvVars: true. I haven't run it.

The rollback endpoint accepts an optional mergeEnvVars flag, defaulting to false. The rollback dialog has a checkbox to keep the instance's env vars, ticked by default, and the rolled-back audit entry records the option used.
@andypalmi andypalmi added this to the 3.3 milestone Oct 21, 2026
@andypalmi andypalmi self-assigned this Oct 21, 2026
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.54%. Comparing base (107cc8c) to head (39b4ba0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9009   +/-   ##
=======================================
  Coverage   79.54%   79.54%           
=======================================
  Files         475      475           
  Lines       26076    26076           
  Branches     6950     6950           
=======================================
  Hits        20741    20741           
  Misses       5335     5335           
Flag Coverage Δ
backend 79.54% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@andypalmi
andypalmi requested review from Steve-Mcl, cstns and knolleary and removed request for cstns October 21, 2026 12:15
andypalmi added 2 commits October 23, 2026 12:13
The checkbox was ambiguous about what happens to the snapshot's variables. A radio group now spells out what Merge and Replace each do, and the radio button gains a multiline description variant.
@Steve-Mcl

Copy link
Copy Markdown
Contributor

@knolleary - I am happy to do review and testing on this if it has your blessing.

Comment thread frontend/src/components/dialogs/RollbackSnapshotDialog.vue Outdated
@knolleary

Copy link
Copy Markdown
Member

@Steve-Mcl I've added one suggested change to the dialog text based purely on something that caught my eye. I haven't done a deep dive on the implementation - happy for you to handle that.

Co-authored-by: Nick O'Leary <nick.oleary@gmail.com>

This branch was successfully deployed

1 active deployment
staging — 39b4ba0c Deployed Oct 23, 2026 by andypalmi via Deploy application #12701
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.

Let users choose whether a snapshot rollback keeps or replaces the instance's environment variables

3 participants