Restore

O Operator
Restore

Restore file to captured state

Every captured change carries its SHA-256-addressed content in BLOB_STORE. Restoring writes that content back to the original path — current file gets backed up to <path>.drift_restore_backup_<epoch> before overwrite.

What will change
Preview -- nothing has been written yet.
Target file/var/www/vhosts/3dshawn.com/site1/TEMPLATES/named_releases.html
SiteDriftSense self-monitor on local
Kindlocal
Captured at2026-07-12 00:35:33
Captured SHA2de1e6efad1f72309af9267a2ac806094049368d496e644f3780ccd8931d6707
Current state on disk
Live check just now. If SHAs match, the restore is a no-op.
File presentyes
Size12553 bytes
Current SHA61256b30cf27
Same as captured?no -- restore will change it
What restore will change — live diff
Left column shows current on-disk content; right shows what restore will write. +16 additions, -102 deletions, 103 unchanged context lines.
11<div class="page-head">
22 <span class="page-eyebrow"><span class="dot"></span> Bookmark</span>
33 <h1 class="page-title">Named releases</h1>
44 <p class="page-subtitle">Retroactively bookmark a moment. "Before the schema refactor." "Customer verified this worked." "Before I fired the intern." Every blob referenced by a named release is protected from auto-purge, so restore-to-moment always works &mdash; scoped portfolio-wide or to a single site.</p>
55</div>
66
77<div class="ds-guide">
88 <div class="dsg-icon">i</div>
99 <div>
1010 <span class="dsg-title">Three ways to pin content:</span>
1111 (1) <strong>Portfolio-wide</strong>: leave scope as "All monitored sites" &mdash; protects every blob captured up to <em>now</em>. (2) <strong>Per-site</strong>: pick a monitor &mdash; only that site's blobs are pinned. (3) <strong>Explicit pins</strong><span class="ds-help" data-help-title="Explicit pins" data-help-body="Instead of pinning &quot;everything captured before this moment&quot;, explicit pins tie a release to specific <code>NAMED_RELEASE_PINS</code> rows &mdash; each pointing at a chosen <code>file_changes_id</code>. Auto-purge always keeps those specific blobs. Use <a href='/pin_hotspots.cgi'>Pin hotspots</a> to create one." data-help-link="/pin_hotspots.cgi" data-help-link-label="Pin hotspots"></span>: use <a href="/pin_hotspots.cgi">Pin hotspots</a> to freeze the current-latest blobs of the churniest files. Set a <strong>Drift alert URL</strong> below and DriftSense will page you when any pinned file's current SHA no longer matches its pinned SHA.
1212 </div>
1313</div>
1414
1515<div class="module glow-emerald" style="margin-bottom:16px">
1616 <div class="module-head"><div class="left">
1717 <div class="module-icon"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 13V7a2 2 0 0 0-2-2h-4l-2-3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h5"/><path d="M14 19l2 2 4-4"/></svg></div>
1818 <div class="module-title">Create a bookmark</div>
1919 <span class="module-subtitle">Names the current moment. Everything captured up to now becomes restorable from this label forever.</span>
2020 </div></div>
2121 <div class="module-body">
2222 <form method="post" action="/named_releases.cgi" style="display:flex;flex-direction:column;gap:12px">
2323 <input type="hidden" name="save" value="1">
2424
2525 <div style="display:flex;gap:12px">
2626 <label style="flex:1;display:flex;flex-direction:column;gap:4px">
27 <span class="rb-label">Internal name</span>
27 <span class="rb-label">Name</span>
2828 <input type="text" name="name" required placeholder="e.g. before-schema-refactor"
29 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-family:var(--mono);font-size:12.5px">
30 </label>
31 <label style="flex:1;display:flex;flex-direction:column;gap:4px">
32 <span class="rb-label">Version label
33 <span class="ds-help" data-help-title="What's a version label?" data-help-body="Display name shown across the UI (e.g. <code>v1.0</code>, <code>working v2.4</code>, <code>stable Nov-2026</code>). If left blank we fall back to the internal name."></span>
34 </span>
35 <input type="text" name="version_label" placeholder="e.g. v1.0 or Working 2.4"
3629 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-family:var(--mono);font-size:12.5px">
3730 </label>
38 <label style="width:150px;display:flex;flex-direction:column;gap:4px">
39 <span class="rb-label">Tier
40 <span class="ds-help" data-help-title="Tier decides how visible this release is" data-help-body="<strong>Draft</strong> = a plain bookmark. <strong>Working</strong> = a milestone you've verified but might revise. <strong>Stable</strong> = production-ready, elevated in the sidebar and dashboard, one-click rollback target."></span>
41 </span>
42 <select name="tier" style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
43 <option value="draft">Draft</option>
44 <option value="working">Working</option>
45 <option value="stable">Stable</option>
46 </select>
31 <label style="flex:2;display:flex;flex-direction:column;gap:4px">
32 <span class="rb-label">Description</span>
33 <input type="text" name="description" placeholder="Optional context"
34 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
4735 </label>
48 <label style="width:140px;display:flex;flex-direction:column;gap:4px">
36 <label style="width:160px;display:flex;flex-direction:column;gap:4px">
4937 <span class="rb-label">By</span>
5038 <input type="text" name="released_by" value="Operator"
5139 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
5240 </label>
5341 </div>
54
55 <label style="display:flex;flex-direction:column;gap:4px">
56 <span class="rb-label">Description</span>
57 <input type="text" name="description" placeholder="Optional context -- what this checkpoint represents"
58 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
59 </label>
6042
6143 <label style="display:flex;flex-direction:column;gap:4px">
62 <span class="rb-label">Scope <span class="dim" style="text-transform:none;letter-spacing:0;font-size:10.5px">&mdash; primary site (leave "All" for portfolio-wide)</span></span>
44 <span class="rb-label">Scope <span class="dim" style="text-transform:none;letter-spacing:0;font-size:10.5px">&mdash; leave "All monitored sites" for a portfolio-wide bookmark</span></span>
6345 <select name="scope_monitor_id" style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
6446 <option value="0">All monitored sites (portfolio-wide)</option>
65 [loop:@monitors]
66 <option value="$mid">$label</option>
67 [/loop]
68 </select>
69 </label>
70
71 <label style="display:flex;flex-direction:column;gap:4px">
72 <span class="rb-label">Additional scopes
73 <span class="ds-help" data-help-title="Cross-scope releases" data-help-body="A release can cover multiple sites at once. Ctrl+click / Cmd+click to add extra monitors. Great for &quot;stable v1.0 across PTMatrix + AffSoft + ContactForge&quot; without creating three separate releases."></span>
74 <span class="dim" style="text-transform:none;letter-spacing:0;font-size:10.5px">&mdash; Ctrl/Cmd-click to add more (optional)</span>
75 </span>
76 <select name="extra_monitor_ids" multiple size="4"
77 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
7847 [loop:@monitors]
7948 <option value="$mid">$label</option>
8049 [/loop]
8150 </select>
8251 </label>
8352
8453 <div style="display:flex;gap:12px">
8554 <label style="flex:1;display:flex;flex-direction:column;gap:4px">
8655 <span class="rb-label">Drift alerts <span class="dim" style="text-transform:none;letter-spacing:0;font-size:10.5px">(optional)</span></span>
8756 <select name="alert_delivery_kind" style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-size:12.5px">
8857 <option value="none">Off</option>
8958 <option value="generic_webhook">Generic HTTP webhook</option>
9059 <option value="slack">Slack webhook</option>
9160 <option value="discord">Discord webhook</option>
9261 </select>
9362 </label>
9463 <label style="flex:2;display:flex;flex-direction:column;gap:4px">
9564 <span class="rb-label">Delivery URL <span class="dim" style="text-transform:none;letter-spacing:0;font-size:10.5px">&mdash; fires when any pinned file drifts from its pinned SHA</span></span>
9665 <input type="text" name="alert_delivery_url" placeholder="https://hooks.slack.com/... (leave blank to disable)"
9766 style="background:var(--bg-1);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:8px 12px;font-family:var(--mono);font-size:11.5px">
9867 </label>
9968 </div>
10069
10170 <div style="display:flex;justify-content:flex-end">
10271 <button type="submit" class="tr-chip is-active" style="border:none;padding:8px 18px">Save bookmark</button>
10372 </div>
10473 </form>
10574 </div>
10675</div>
10776
10877<div class="module glow-teal">
10978 <div class="module-head"><div class="left">
11079 <div class="module-icon"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2"><line x1="4" y1="9" x2="20" y2="9"/><line x1="4" y1="15" x2="20" y2="15"/><line x1="10" y1="3" x2="8" y2="21"/><line x1="16" y1="3" x2="14" y2="21"/></svg></div>
11180 <div class="module-title">All bookmarks</div>
11281 <span class="module-subtitle">$total bookmarks. Protected ones (default) survive auto-purge; unlocked ones are eligible for cleanup after the retention window.</span>
11382 </div></div>
11483 <div class="module-body tight">
11584 [if:$has_rows]
11685 <table class="tbl">
11786 <thead><tr>
118 <th>Version</th>
119 <th style="width:90px">Tier</th>
120 <th style="width:140px">Scope</th>
87 <th>Name</th>
88 <th style="width:150px">Scope</th>
89 <th style="width:110px">By</th>
90 <th style="width:110px">Protection</th>
12191 <th style="width:130px">Moment</th>
122 <th style="width:260px">Actions</th>
92 <th style="width:150px">Actions</th>
12393 </tr></thead>
12494 <tbody>
12595 [loop:@rows]
12696 <tr>
127 <td>
128 <strong>$display_label</strong>
129 <div class="dim" style="font-size:11.5px;margin-top:2px">$description</div>
130 <div class="mono dim" style="font-size:10.5px;margin-top:2px">by $released_by &middot; internal: $name</div>
131 </td>
132 <td><span class="pill $tier_pill">$tier_lbl</span></td>
97 <td><strong>$name</strong><div class="dim" style="font-size:11.5px;margin-top:2px">$description</div></td>
13398 <td>
13499 <span class="pill $scope_pill" style="font-size:10px">$scope_lbl</span>
135100 <div class="mono dim" style="font-size:10.5px;margin-top:3px">$scope_h</div>
136101 </td>
102 <td class="dim">$released_by</td>
103 <td><span class="pill $lock_pill">$lock_lbl</span></td>
137104 <td class="mono dim"><span class="ts" data-ts="$released_epoch" data-fmt="datetime">$released_h</span></td>
138105 <td>
139 <a href="$restore_url" class="tr-chip" style="padding:3px 10px;font-size:11px">Restore all</a>
140 [if:!$is_stable]
141 <form method="post" action="/named_releases.cgi" style="display:inline">
142 <input type="hidden" name="promote" value="1">
143 <input type="hidden" name="release_id" value="$id">
144 <input type="hidden" name="to_tier" value="stable">
145 <button type="submit" class="tr-chip" style="padding:3px 10px;font-size:11px;background:rgba(52,211,153,.14);color:#86efac;border-color:rgba(52,211,153,.35)">&uarr; Mark stable</button>
146 </form>
147 [/if]
148 <button type="button" onclick="dsTestAlert($id, this)" class="tr-chip" style="padding:3px 10px;font-size:11px" title="Send synthetic drift payload">Test alert</button>
149 [if:$is_stable]
150 <form method="post" action="/named_releases.cgi" style="display:inline">
151 <input type="hidden" name="promote" value="1">
152 <input type="hidden" name="release_id" value="$id">
153 <input type="hidden" name="to_tier" value="working">
154 <button type="submit" class="tr-chip" style="padding:3px 10px;font-size:11px">&darr; Working</button>
155 </form>
156 [/if]
106 <a href="/restore_release.cgi?release_id=$id" class="tr-chip" style="padding:3px 10px;font-size:11px">Restore all</a>
157107 </td>
158108 </tr>
159109 [/loop]
160110 </tbody>
161111 </table>
162112 [/if]
163113 [if:!$has_rows]
164114 <div style="padding:36px 14px;text-align:center;color:var(--text-dim);font-size:13.5px">
165115 No bookmarks yet. Save your first one above.
166116 </div>
167117 [/if]
168118 </div>
169119</div>
170
171<script>
172window.dsTestAlert = async function (id, btn) {
173 var orig = btn.textContent;
174 btn.textContent = 'Sending...';
175 btn.disabled = true;
176 try {
177 var r = await fetch('/named_releases.cgi?op=test_alert&release_id=' + id, { cache: 'no-store' });
178 var j = await r.json();
179 if (j.ok) {
180 btn.textContent = 'Sent ✓';
181 btn.style.background = 'rgba(52,211,153,.14)';
182 btn.style.color = '#86efac';
183 btn.style.borderColor = 'rgba(52,211,153,.35)';
184 alert('Test alert delivered\nHTTP ' + j.http_code);
185 } else {
186 btn.textContent = 'FAIL';
187 btn.style.background = 'rgba(244,63,94,.14)';
188 btn.style.color = '#fda4af';
189 btn.style.borderColor = 'rgba(244,63,94,.35)';
190 alert('Test alert failed:\n' + (j.message || 'unknown'));
191 }
192 } catch (e) {
193 alert('Error: ' + e.message);
194 btn.textContent = orig;
195 } finally {
196 setTimeout(function () {
197 btn.disabled = false;
198 btn.textContent = orig;
199 btn.style.background = '';
200 btn.style.color = '';
201 btn.style.borderColor = '';
202 }, 3000);
203 }
204};
205</script>
Confirm restore
Backs current content to <target>.drift_restore_backup_<epoch>, writes the captured content, verifies SHA post-write.
Cancel Logged to RESTORE_LOG regardless of outcome.