Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

refactor(unify): §8 Phase B4 — surface DeploymentSnapshot as "Config Checkpoint"

Juan Denisd87e69b44fb4
diff --git a/backend/app/api/snapshots.py b/backend/app/api/snapshots.py
index 2327ee7a..af1c0811 100644
--- a/backend/app/api/snapshots.py
+++ b/backend/app/api/snapshots.py
@@ -36,7 +36,11 @@ def _get_snapshot_or_404(app_id, snap_id):
return snap, None
+# "Config Checkpoint" is the user-facing name for a deployment config snapshot
+# (§8 decision: rename in the UI; keep /snapshots working). Every route below is
+# also reachable under /config-checkpoints so the API matches the new wording.
@snapshots_bp.route('/<int:app_id>/snapshots', methods=['GET'])
+@snapshots_bp.route('/<int:app_id>/config-checkpoints', methods=['GET'])
@jwt_required()
def list_snapshots(app_id):
"""List config snapshots for an app, newest first."""
@@ -62,6 +66,7 @@ def list_snapshots(app_id):
@snapshots_bp.route('/<int:app_id>/snapshots/<int:snap_id>', methods=['GET'])
+@snapshots_bp.route('/<int:app_id>/config-checkpoints/<int:snap_id>', methods=['GET'])
@jwt_required()
def get_snapshot(app_id, snap_id):
"""Fetch a single snapshot, including its resolved config."""
@@ -75,6 +80,7 @@ def get_snapshot(app_id, snap_id):
@snapshots_bp.route('/<int:app_id>/snapshots/<int:snap_id>/diff', methods=['GET'])
+@snapshots_bp.route('/<int:app_id>/config-checkpoints/<int:snap_id>/diff', methods=['GET'])
@jwt_required()
def diff_snapshot(app_id, snap_id):
"""Diff a snapshot against another (default: the previous snapshot).
@@ -123,6 +129,7 @@ def diff_snapshot(app_id, snap_id):
@snapshots_bp.route('/<int:app_id>/snapshots/<int:snap_id>/restore', methods=['POST'])
+@snapshots_bp.route('/<int:app_id>/config-checkpoints/<int:snap_id>/restore', methods=['POST'])
@jwt_required()
@developer_required
def restore_snapshot(app_id, snap_id):
diff --git a/backend/tests/test_config_checkpoint_alias.py b/backend/tests/test_config_checkpoint_alias.py
new file mode 100644
index 00000000..c625b02b
--- /dev/null
+++ b/backend/tests/test_config_checkpoint_alias.py
@@ -0,0 +1,25 @@
+"""§8 Phase B4 — /config-checkpoints aliases /snapshots.
+
+"Config Checkpoint" is the user-facing name for a deployment config snapshot.
+The snapshots blueprint serves every route under both /snapshots and
+/config-checkpoints so the API matches the new wording while old callers keep
+working.
+"""
+
+
+def test_config_checkpoints_resolves_same_handler(app, client, auth_headers):
+ # Both prefixes hit the same view, so a missing app produces the identical
+ # 404 response on either — proof the alias resolves to the same handler.
+ snaps = client.get('/api/v1/apps/999999/snapshots', headers=auth_headers)
+ ckpts = client.get('/api/v1/apps/999999/config-checkpoints', headers=auth_headers)
+ assert snaps.status_code == 404
+ assert ckpts.status_code == 404
+ assert ckpts.get_json() == snaps.get_json()
+
+
+def test_both_route_spaces_registered():
+ from app import create_app
+ application = create_app('testing')
+ rules = {r.rule for r in application.url_map.iter_rules()}
+ assert any('/snapshots' in r for r in rules)
+ assert any('/config-checkpoints' in r for r in rules)
diff --git a/frontend/src/components/appdetail/DeployTab.jsx b/frontend/src/components/appdetail/DeployTab.jsx
index ed79ed0f..92acce9a 100644
--- a/frontend/src/components/appdetail/DeployTab.jsx
+++ b/frontend/src/components/appdetail/DeployTab.jsx
@@ -238,11 +238,11 @@ const DeployTab = ({ appId, appPath }) => {
{/* Config snapshot timeline + diff — additive, independent of git
config so it shows the deploy history & config changes for any app. */}
<div className="card deploy-timeline-card">
- <h3>Deployment Timeline</h3>
+ <h3>Config Checkpoints</h3>
<p className="deploy-timeline-card__hint">
- An immutable configuration snapshot (env keys, domains, image, build
+ An immutable config checkpoint (env keys, domains, image, build
method, volumes) is captured before each deployment. Secret values are
- masked. Open a snapshot to diff it against the previous one or restore it.
+ masked. Open a checkpoint to diff it against the previous one or restore it.
</p>
<DeploymentTimeline appId={appId} />
</div>
diff --git a/frontend/src/components/backups/ProtectionStatusCard.jsx b/frontend/src/components/backups/ProtectionStatusCard.jsx
index a4008b3d..40c67734 100644
--- a/frontend/src/components/backups/ProtectionStatusCard.jsx
+++ b/frontend/src/components/backups/ProtectionStatusCard.jsx
@@ -62,7 +62,7 @@ const ProtectionStatusCard = ({
const statusPill = <Pill kind={kind}>{label}</Pill>;
const subtitle = enabled
- ? 'Snapshots run on the configured schedule.'
+ ? 'Backups run on the configured schedule.'
: 'Turn on to back up this site automatically.';
// Inline status line (and, for the failed state, a deep-link to Jobs).
diff --git a/frontend/src/components/deployments/ConfigDiffModal.jsx b/frontend/src/components/deployments/ConfigDiffModal.jsx
index 7b036558..4a0a0453 100644
--- a/frontend/src/components/deployments/ConfigDiffModal.jsx
+++ b/frontend/src/components/deployments/ConfigDiffModal.jsx
@@ -132,7 +132,7 @@ const ConfigDiffModal = ({ appId, snapId, against = 'previous', onClose, onResto
<p className="config-diff__summary">
{meta.hasChanges && meta.summary
? meta.summary
- : 'No configuration changes vs the compared snapshot.'}
+ : 'No configuration changes vs the compared checkpoint.'}
</p>
</div>
</div>
diff --git a/frontend/src/components/deployments/DeploymentTimeline.jsx b/frontend/src/components/deployments/DeploymentTimeline.jsx
index cba2f99f..3dbc2e4a 100644
--- a/frontend/src/components/deployments/DeploymentTimeline.jsx
+++ b/frontend/src/components/deployments/DeploymentTimeline.jsx
@@ -62,7 +62,7 @@ const DeploymentTimeline = ({ appId }) => {
return (
<div className="deploy-timeline deploy-timeline--empty">
<Clock size={20} />
- <p>No configuration snapshots yet. One is captured before each deployment.</p>
+ <p>No config checkpoints yet. One is captured before each deployment.</p>
</div>
);
}
diff --git a/frontend/src/services/api/snapshots.js b/frontend/src/services/api/snapshots.js
index 33e67fec..10826141 100644
--- a/frontend/src/services/api/snapshots.js
+++ b/frontend/src/services/api/snapshots.js
@@ -19,3 +19,22 @@ export async function restoreSnapshot(appId, snapId) {
method: 'POST',
});
}
+
+// "Config Checkpoint" is the user-facing name for a deployment config snapshot
+// (§8). These aliases let new UI code use the new term; the backend serves both
+// /snapshots and /config-checkpoints.
+export async function getConfigCheckpoints(appId, limit = 50) {
+ return getAppSnapshots.call(this, appId, limit);
+}
+
+export async function getConfigCheckpoint(appId, id) {
+ return getAppSnapshot.call(this, appId, id);
+}
+
+export async function getConfigCheckpointDiff(appId, id, against = 'previous') {
+ return getSnapshotDiff.call(this, appId, id, against);
+}
+
+export async function restoreConfigCheckpoint(appId, id) {
+ return restoreSnapshot.call(this, appId, id);
+}