Skip to content

Auto-update: daily GitHub check for memd and the Meilisearch engine - #1

Merged
qdequele merged 21 commits into
mainfrom
qdequele/inspiring-varahamihira-477a5b
Jun 10, 2026
Merged

Auto-update: daily GitHub check for memd and the Meilisearch engine#1
qdequele merged 21 commits into
mainfrom
qdequele/inspiring-varahamihira-477a5b

Conversation

@qdequele

Copy link
Copy Markdown
Owner

Summary

  • A daily in-daemon check against GitHub Releases keeps both memd and its managed Meilisearch engine current, fully automatically ([update] auto = true, opt-out supported).
  • memd self-update: download the platform asset → --version sanity check (10s timeout, off-runtime) → atomic swap over ~/.local/bin/memd → restart via launchd KeepAlive (or re-exec without a supervisor).
  • Engine migration via Meilisearch's official dump → --import-dump path: dump the live instance, download the new versioned binary, restart, migrate at startup with version + document-count verification. On any failure: full rollback to the previous engine and data dir, version blacklisted, memories never lost.
  • Safety hardening: stale-marker expiry (1h), stranded-backup self-heal, exclusive update lock with stale reclaim, meili-data.mismatch.* isolation so memd doctor --fix backups are never auto-restored, honest network-failure reporting.
  • New memd update [--check] command, Updates: line in memd status, docs for the command and [update] config.

Design spec: docs/superpowers/specs/2026-06-10-auto-update-design.md · Plan: docs/superpowers/plans/2026-06-10-auto-update.md

Test Plan

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (31 tests), cargo build --release
  • memd update --check against live GitHub (correctly reported Meilisearch v1.46.1 available vs pinned v1.45.1)
  • Manual self-update: build with a lowered version, run memd update, confirm swap + service restart (plan Task 11, step 5)
  • Manual engine migration: pin the previous Meilisearch release, run memd update, confirm dump → import with unchanged memory count

🤖 Generated with Claude Code

qdequele added 21 commits June 10, 2026 11:21
…ification

- Restore failure no longer wedges the daemon; logs a CRITICAL message instead
- Recover a stranded backup automatically on startup after a mid-migration crash
- Discard engine-migration markers older than 1 hour to avoid silent data loss
- Stats failure aborts prepare() (except index_not_found); warns when expected_docs=0
- Delete the dump file on successful migration
- Log prune failures instead of silently discarding the error
- Write the marker file atomically via a temp file + rename
…t, clippy clean

- Remove bare `use time;` import (clippy::single_component_path_imports)
- Surface GitHub fetch errors instead of silently claiming "up to date"
- Bail if both release checks fail (unreachable network)
- Record last_check_secs in both Memd and Engine apply paths
- Fix error message in engine branch for accuracy
- restart_service() now takes &Config and polls health for up to 20s
…nfig

Also applies cargo fmt reformatting to update module source files.
@qdequele
qdequele merged commit 2ff7e2b into main Jun 10, 2026
1 check passed
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.

1 participant