Skip to content

fix(doctor): judge backup age against the configured interval - #120

Merged
TusanHomichi merged 10 commits into
mainfrom
claude/117-doctor-interval
Oct 15, 2026
Merged

TusanHomichi merged 10 commits into
mainfrom
claude/117-doctor-interval

Conversation

@TusanHomichi

Copy link
Copy Markdown
Member

Primary Issue

Closes #117

Problem And Outcome

doctor compared the newest backup's age with the 24-hour default, while the scheduler uses CONSOLEBOOK_BACKUP_INTERVAL_HOURS. So:

  • an hourly installation looked healthy for a day after its backups stopped;
  • a 48-hour installation warned while on schedule.

After this PR, doctor judges against the interval it's given, in the same setting serve reads.

Changes

  • doctor::Options { backup_copy_dir, backup_interval_hours }.
    • It defaults to no copy directory and the scheduler's default interval.
    • It replaces the positional backup_copy_dir argument, so later service settings join one place instead of growing the signature.
    • doctor still reads no configuration files: the caller passes what the service uses.
  • CLI: doctor --backup-interval-hours N, also read from CONSOLEBOOK_BACKUP_INTERVAL_HOURS. It must be at least 1, the same as serve.
  • The warning names the interval it used and says to pass --backup-interval-hours if the service uses another.
  • docs/operations.md: the backups row says "younger than the backup interval", and the doctor: judge backup age against the configured interval, not the 24-hour default #117 caveat becomes the flag.
  • The release workflow's "Operations guide commands" runs doctor --backup-interval-hours 6 against the real install.
  • CHANGELOG.

Correction rung: 1. The interval is part of the one options type doctor takes, not a second constant.

Verification

  • tests/doctor_backup_interval.rs, each with the default interval as a built-in control:
    • hourly, with a 2-hour-old backup: warn naming "1-hour", where the default says ok;
    • 48-hour, with a 30-hour-old backup: ok, where the default warns.
  • Existing doctor tests (doctor_read_only, doctor_backup_copy, operable_shell, copy_ownership) were moved to Options and pass, run without DAC override.
  • cargo fmt --check and cargo clippy --workspace --all-targets -D warnings are clean.
  • Full local proof: pending; added here when it finishes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts


Generated by Claude Code

claude added 10 commits October 15, 2026 00:45
A new server set up to replace a lost one copied its own empty database
into the share as the newest backup, so restoring "the newest copy" (as
the install guide said) brought back nothing; the #97 restore drill hit
it against the v0.1.0 release.

- copy_snapshot refuses a snapshot whose installation differs from the
  newest readable copy's, both read from the files read-only and
  immutable, so shares written by 0.1.0 are protected too.
- Catch-up and copy status consider only the installation's own backups:
  never the database a restore set aside.
- restore ends with a backup of the restored database, so copies resume
  from it at once; the set-aside goes through the same snapshot owner,
  and a snapshot within a second of the last waits for a new name.

Closes #115

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
doctor compared the newest backup's age with the 24-hour default even
when the service backs up on another interval, so an hourly installation
looked healthy for a day after its backups stopped. doctor::Options
carries the copy directory and the interval; the CLI reads
--backup-interval-hours or CONSOLEBOOK_BACKUP_INTERVAL_HOURS, the same
setting serve uses.

Closes #117

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
A database a restore set aside no longer postpones the next backup or
makes old backups look fresh to doctor and the health read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
…erval

# Conflicts:
#	CHANGELOG.md
#	crates/consolebook-server/src/doctor.rs
#	crates/consolebook-server/tests/copy_ownership.rs

Copy link
Copy Markdown
Member Author

@codex review


Generated by Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T02:05:17.292137Z 9cd435c Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 9cd435c127

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@TusanHomichi
TusanHomichi merged commit 2d0fd17 into main Oct 15, 2026
4 checks passed
@TusanHomichi
TusanHomichi deleted the claude/117-doctor-interval branch October 15, 2026 02:10

Copy link
Copy Markdown
Member Author

Verification, final:

  • Full local proof on 9cd435c passed, all 7 gates. The browser suite was 61 expected, 0 unexpected, 0 flaky. Receipt .proof/20261015T015914Z-9cd435c12706/receipt.json, sha256 0eaee07cdf6221d11b904c09b68df102295e657e34447bb25825d992d8ededa0.
  • CI on 9cd435c: fmt-clippy-test, build-x86_64 (including doctor --backup-interval-hours 6 against a real install), and build-aarch64 all passed.
  • Codex found no issues.

Generated by Claude Code

@TusanHomichi TusanHomichi mentioned this pull request Oct 15, 2026
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.

doctor: judge backup age against the configured interval, not the 24-hour default

2 participants