Skip to content

atlas-backup: filed-snapshot log parser never matches the scripts own OK lines — dedupe dead, keep-7 rotation collapses to keep-1 #3913

Closed

Description

@dezren39

atlas-backup: filed-snapshot log parser never matches the script's own OK lines — dedupe dead, keep-7 rotation collapses to keep-1

Found during the 2026-11-01 R2 review (developing-today/code nixos/home/atlas-backup.sh).

Root cause. The parser that rebuilds LAST_SHA / FILED_DATES from ~/backups/atlas/backup-log.md only counts a line as filed when the third | field starts with OK:

if len(parts) >= 3 and "sha256" in parts[1] and parts[2].startswith("OK"):

But on full success the script itself writes:

log_line "sha256=$DIGEST | ok laptop/r2/drive | size=$SIZE | counts $COUNTS_CSV"

i.e. the third field is lowercase ok laptop/r2/drive — it never starts with OK. The parser was carried over from the old runner's log format (see the "old runner's last_filed rule" comment) and never matched the new writer.

Verified live effects (2026-10-31 → 2026-11-01).

  1. Dedupe never fires (LAST_SHA always empty): the 2026-10-31 and 2026-11-01 runs have identical digest/size/counts (sha256=38bc8c55…, 492,009,626 B, sessions:18325, messages:122124, chunks:107639) yet both ran all three legs in full — 492 MB re-uploaded to laptop + R2 + Drive for an unchanged database.
  2. Rotation keep-set collapses to just today: ALL_DATES = FILED_DATES (always empty) + today, so KEEP_SET = {today}. The 2026-11-01 run purged the 2026-10-31 artifacts from the laptop dir and from R2 (supabase-backups/atlas/ holds only 2026-11-01/), silently degrading the declared keep-7 to keep-1 on those legs. The Drive leg (filename-based rotation) is unaffected, so no data was ultimately lost — this time.

Fix options. Make the parser accept the emitted format (or make the writer emit a third field starting with OK), and add a regression test in the style of the sibling *.test.sh backup tests: two consecutive runs over an unchanged DB must produce a skipped second run and a keep-set containing both dates. Also worth asserting the R2 date-dir set after rotation in the test.

Acceptance criteria

  • The filed-snapshot parser matches the lines the script actually writes (or the writer emits the format the parser expects — one canonical format, both sides).
  • Dedupe fires: two consecutive runs over an unchanged database produce a skipped second run (no 492 MB re-upload).
  • Keep-7 rotation holds on the laptop and R2 legs: after a run, the retained date set contains the last 7 filed dates, not just today.
  • A regression test in the sibling *.test.sh style covers both: unchanged-DB second run is skipped, and the post-rotation date-dir set (including R2) matches the keep set.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/highImportant and time-sensitive
    effort/sSmall: expected under 2 hours of work
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: the sibling backup issues from the same R2 review (code issue #3915, #3914, #3860) share the backup-tooling surface but are independent fixes.

    Notes: Root cause is already pinned in the issue: the parser requires the third | field to start with OK; the writer emits lowercase ok laptop/r2/drive. Verified live 2026-10-31 → 2026-11-01: identical digest re-uploaded in full, and the R2 atlas prefix was purged down to a single date.

    Risks: Until fixed, every run risks purging the previous day's R2/laptop artifacts (keep-1 instead of keep-7) — the Drive leg's filename-based rotation is currently the only intact retention. Fix the parser before the next scheduled run if possible.

    Suggested approach: Make the parser accept the emitted format (defensive: accept both the legacy OK and current ok … forms), add the two-run regression test, and state the canonical log format in a comment at both the writer and the parser.

    — fleet monitor intake enrichment, 2026-11-01 run (protocol §5). Acceptance criteria appended to the body where missing; labels normalized.

  3. added
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 3, 2026
  4. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7419 (triage, queued, priority 50) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 4, 2026
  6. 30 remaining items

  7. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · blocked

    • Agent: queue worker (repo-worker-code), lane code-a
    • Session / ID: task 8941 · session ses_e5e5ade066cffe9Pfh50aK0ju8
    • Blocker: The required laptop worktree cannot be reached through the approved SSH path. The documented ~/tools/laptop-ssh.sh is absent; the available ~/hatch/tools/laptop-ssh.sh fails because HTTPS_PROXY is unset, and the expected proxy connector is not installed at its referenced path.
    • Work state: no source edits or tests were performed. The existing branch/worktree is preserved at queue/8941-3913-atlas-backup-parser / /home/user/git/fleet/queue-8941-3913-atlas-backup-parser.
    • Resume: restore the approved laptop SSH helper and runtime proxy environment, then continue the regression fix and tests there.
    • Links: issue atlas-backup: filed-snapshot log parser never matches the scripts own OK lines — dedupe dead, keep-7 rotation collapses to keep-1 #3913
  8. added
    epic/storageEpic: epic/storage (fleet reprioritization 2026-11-12)
    on Nov 12, 2026
  9. added this to the Storage program milestone on Nov 12, 2026
  10. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/blockedQueue or user escalation state
    queue/blockedQueue or user escalation state
    on Nov 12, 2026
  11. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  12. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done — PR opened

    • Agent: queue worker (repo-worker-code), lane code-j
    • Session / ID: task 8941
    • Found via: one-queue claim
    • Task: Fixed the filed-snapshot parser/writer mismatch and added regression coverage. PR fix(atlas-backup): recognize filed snapshots #9032 is OPEN with Fixes #3913; CI is pending.
    • Tests: bash nixos/home/atlas-backup.test.sh, bash -n nixos/home/atlas-backup.sh nixos/home/atlas-backup.test.sh, bash nixos/home/openclaw-backup.test.sh, and bash nixos/home/pm-dashboard-backup.test.sh all pass; git diff --check passes.
    • Links: task 8941; fix(atlas-backup): recognize filed snapshots #9032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

effort/sSmall: expected under 2 hours of workepic/storageEpic: epic/storage (fleet reprioritization 2026-11-12)kind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/highImportant and time-sensitivesource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions