Skip to content

Require success marker for initial backup skip logic - #90

Closed
mvfc wants to merge 1 commit into
mc/organization_exportfrom
fix-initial-backup-completion-logic-12770655799394862431
Closed

mvfc wants to merge 1 commit into
mc/organization_exportfrom
fix-initial-backup-completion-logic-12770655799394862431

Conversation

@mvfc

@mvfc mvfc commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Updated run.sh and run.py to enforce proper backup completion checks and prevent skipping initial backups when prior runs failed.


PR created automatically by Jules for task 12770655799394862431 started by @mvfc

RetriggerView in GreptileConfidence Score: 4/5

Move marker clearing ahead of early failure paths before merging.

Findings

  1. P1 Early failures leave success behind ▶
  2. P2 Skip decisions lack tests ▶
Fix with agent prompt
### Issue 1
src/run.py:103-107
`main()` clears `.complete` only after opening the database and checking settings. If a scheduled run cannot open the database, lacks a required setting, or has invalid configuration, it exits before clearing the previous marker. On restart, `run.sh` sees that marker and its matching archive and skips the initial backup despite the failed attempt.

Move marker clearing ahead of these failure paths so early failures also invalidate the previous success.

### Issue 2
run.sh:70-73
The new test covers marker removal in Python, but no shell test exercises the changed skip logic in `run.sh`. Add focused cases for a matching timestamp, an unrelated archive, an empty marker, and a missing marker. Without them, a later change could make startup skip failed backups or rerun valid backups without a test catching it.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR ties startup skipping to the timestamp in .complete and clears the marker before exporting.

  • Startup checks matching backup files before skipping the first run.

Reviews (1) · Last reviewed commit: "Require success marker for initial backu..." · Reviewed by Greptile

Update run.sh and run.py to ensure files produced during an incomplete
or failed backup run do not count as proof of completion. Pre-existing
.complete markers are cleared at the start of run.py, and run.sh requires
both an explicit .complete marker and matching backup files before
skipping the initial backup.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. 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: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0e2ec1a3-00db-4db7-9858-02fe80827947

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

Comment @coderabbitai help to get the list of available commands.

Comment thread src/run.py
Comment on lines 103 to +107
os.makedirs(backup_dir, exist_ok=True)
success_marker = os.path.join(backup_dir, ".complete")
try:
if os.path.exists(success_marker):
os.remove(success_marker)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Early failures leave success behind

main() clears .complete only after opening the database and checking settings. If a scheduled run cannot open the database, lacks a required setting, or has invalid configuration, it exits before clearing the previous marker. On restart, run.sh sees that marker and its matching archive and skips the initial backup despite the failed attempt.

Move marker clearing ahead of these failure paths so early failures also invalidate the previous success.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/run.py
Line: 103-107

Comment:
**Early failures leave success behind**

`main()` clears `.complete` only after opening the database and checking settings. If a scheduled run cannot open the database, lacks a required setting, or has invalid configuration, it exits before clearing the previous marker. On restart, `run.sh` sees that marker and its matching archive and skips the initial backup despite the failed attempt.

Move marker clearing ahead of these failure paths so early failures also invalidate the previous success.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread run.sh
Comment on lines +70 to +73
if [ -f "$BACKUP_DIR/.complete" ]; then
marker_ts=$(tr -d '[:space:]' < "$BACKUP_DIR/.complete" 2>/dev/null || true)
if [ -n "$marker_ts" ]; then
for f in "$BACKUP_DIR"/backup_"${marker_ts}"*.enc; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Skip decisions lack tests

The new test covers marker removal in Python, but no shell test exercises the changed skip logic in run.sh. Add focused cases for a matching timestamp, an unrelated archive, an empty marker, and a missing marker. Without them, a later change could make startup skip failed backups or rerun valid backups without a test catching it.

Prompt To Fix With AI
This is a comment left during a code review.
Path: run.sh
Line: 70-73

Comment:
**Skip decisions lack tests**

The new test covers marker removal in Python, but no shell test exercises the changed skip logic in `run.sh`. Add focused cases for a matching timestamp, an unrelated archive, an empty marker, and a missing marker. Without them, a later change could make startup skip failed backups or rerun valid backups without a test catching it.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@mvfc mvfc closed this Oct 26, 2026
@mvfc
mvfc deleted the fix-initial-backup-completion-logic-12770655799394862431 branch October 26, 2026 15:33
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