GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(backups): daily zstd full-copy leg for the OpenCode session DB (#14515) by developing-today-fleet[bot] · Pull Request #14539 · developing-today/code

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 24, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Implements the #14515 slice: the daily zstd full-copy leg for the OpenCode session DB (#9094 scheme (b), #8983 workstream B). The issue stays open — the live restore drill from the Drive artifact and the NixOS deployment of the updated scripts complete the acceptance; both are recorded on #14515.

What changed

nixos/home/opencode-db-backup.sh

  • After the restic legs, the staged, integrity-checked VACUUM INTO image of opencode.db is compressed with zstd -3 to a temp file, verified (decompressed sha256 must equal the staged image), and atomically published as opencode-db-<date>.db.zst + manifest.json (openclaw-backup shape, plus the uncompressed hash/size for restore verification) in ~/backups/opencode-db-zstd/<date>/.
  • The same artifact + manifest are uploaded to drive:Cloud/cold-store/db-backups/opencode/<date>/ and the Drive copy is verified by re-reading it (rclone cat → sha256) before success is recorded. The restic leg is untouched.
  • Retention on the dated zstd dirs only, both targets, restic GFS semantics over calendar dates: keep-daily 7 / keep-weekly 4 / keep-monthly 12, applied only after both copies verify. A failed Drive listing fails the run (the fix(cold-store-reaper): count backup bytes in project-budget accounting (#1028) #1035 lesson).
  • Marker ordering: the restic success marker now advances as soon as the restic legs verify (before the zstd leg); the zstd leg writes its own marker (.opencode-db-zstd-last-success-epoch) only after both copies verify + retention. Neither leg can mask the other. The run record gains a zstd block.
  • OPENCODE_DB_BACKUP_DATE env override (test hook in the watchdog's marker-override style; the timer never sets it) makes the artifact date deterministic for the retention tests.

nixos/home/laptop-backups-watchdog.sh

  • New check (e2) under the existing opencode-db job: the zstd-leg marker must exist and be fresh (same stale/future/unreadable treatment; LAPTOP_BACKUPS_OPENCODE_DB_ZSTD_MARKER override).

Tests (laptop worktree — these suites drive the scripts with stubbed PATH tools against a scratch HOME; repo CI runs on main only)

  • opencode-db-backup.test.sh: all scenarios passed. The rclone stub is now a functional fake remote; new scenarios cover the zstd happy path (manifest/hash agreement, decompress-to-source, Drive copy identical, zstd marker, run-record block), GFS retention over a 22-date fixture pruning exactly {2025-05-10, 2025-03-15, 2024-06-15} on both targets (weekly-only and monthly-only saves are decisive in the fixture), Drive upload failure (restic marker still advances, zstd marker doesn't, local artifact stays), Drive copy corruption (named sha256 mismatch), and corrupt compression (verify-before-publish, temp file cleaned by the exit trap).
  • laptop-backups-watchdog.test.sh: all passed (65 checks), including new zstd marker fresh/stale/missing/future scenarios and the reverse-masking case (fresh zstd marker + stale restic marker still fails).

Honest limits

  • The Drive leg's freshness SLO budgets the ≥1-day lag measured in research(atlas): OpenCode DB backup economics — copy vs zstd vs restic-delta cost + growth model #9094 (direct single-file rclone ≈56 KiB/s vs ≈1.5–2 MiB/s for restic's chunked traffic); same-day off-laptop coverage is not promised. The script header records this.
  • Deployment is the next NixOS switch on the laptop (the scripts are vendored via laptop-backups.nix readFile, so no nix change is needed); the first live run + the timed restore drill from the Drive artifact are recorded on Implement daily zstd full-copy leg for the OpenCode session DB (fast-restore path) #14515.

Refs #14515

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-24T18:36:12Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": null,
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": null,
    "auth_subject": "archer",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dezren39
feat(backups): daily zstd full-copy leg for the OpenCode session DB (#…
0bd7b62
…14515)

Implements #9094 scheme (b), the fast-restore residual under #8983
workstream B. After the restic legs, opencode-db-backup.sh now also
publishes the staged, integrity-checked VACUUM INTO image as one
dated zstd -3 full copy: ~/backups/opencode-db-zstd/<date>/ locally
and rclone:drive:Cloud/cold-store/db-backups/opencode/<date>/ on
Google Drive, each with a sha256 manifest in the openclaw-backup
shape. The artifact is verified before publish (decompressed sha256
must equal the staged image) and the Drive copy is verified by
re-reading it. Retention applies to the dated zstd dirs only, on
both targets, with restic's GFS semantics over calendar dates
(keep-daily 7 / keep-weekly 4 / keep-monthly 12).

The leg writes its own success-epoch marker
(.opencode-db-zstd-last-success-epoch) only after both copies
verify and retention has run; the restic marker now advances as
soon as the restic legs verify, before the zstd leg, so neither
leg can mask the other. laptop-backups-watchdog checks the zstd
marker separately under the opencode-db job (env override
LAPTOP_BACKUPS_OPENCODE_DB_ZSTD_MARKER, mirroring the existing
marker hooks).

Tests: opencode-db-backup.test.sh gains a functional fake rclone
remote and scenarios for the zstd happy path (manifest/hash,
decompress-to-source, Drive copy, marker, run-record block), GFS
retention over a 22-date fixture on both targets, Drive upload
failure, Drive copy corruption, and corrupt compression
(verify-before-publish + temp cleanup). The watchdog suite gains
zstd marker fresh/stale/missing/future scenarios plus the
reverse-masking case. Both suites pass on the laptop.

The freshness SLO budgets the Drive leg's measured >=1-day lag
(#9094: direct single-file rclone ~56 KiB/s vs ~1.5-2 MiB/s for
restic's chunked traffic); same-day off-laptop coverage is not
promised. The live restore drill from the Drive artifact is
recorded on #14515.

Refs #14515
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6b21351a-75ea-4661-afc3-5f550cce0e9f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@developing-today-fleet
developing-today-fleet Bot merged commit 9fc0f7b into main Nov 24, 2026
2 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@developing-today-fleet
developing-today-fleet Bot deleted the iw201/14515-zstd-leg branch November 24, 2026 18:58
@developing-today-fleet developing-today-fleet Bot mentioned this pull request Nov 24, 2026
Implement daily zstd full-copy leg for the OpenCode session DB (fast-restore path) #14515
Open
4 tasks
This was referenced Nov 24, 2026
docs(registry): register opencode-db-backup.timer with zstd fast-restore leg (#13462) #14583
Merged
impl(backups): mesh leg — OpenCode session DB backup (gated on research #9094) #13462
Closed
impl(atlas/fleet): backup mesh — all-Turso 14d restic-zstd to R2, R2/laptop/Drive mesh, D1+laptop DBs into Turso #9093
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.