From 78a086482a86bca96018131575cf3b4a07bbea71 Mon Sep 17 00:00:00 2001 From: OpenClaw Service User Date: Fri, 27 Mar 2026 09:30:09 -0700 Subject: [PATCH 1/3] fix: add 'minimal' scope to CLI options --- src/ocbs/cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ocbs/cli.py b/src/ocbs/cli.py index ddde255..5ad2058 100644 --- a/src/ocbs/cli.py +++ b/src/ocbs/cli.py @@ -23,7 +23,7 @@ def main(ctx, state_dir): @main.command() -@click.option('--scope', type=click.Choice(['config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), default='config', help='Backup scope') @click.option( '--source', @@ -104,7 +104,7 @@ def status(ctx): @main.command() -@click.option('--scope', type=click.Choice(['config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), help='Filter by scope') @click.pass_context def list(ctx, scope): @@ -124,7 +124,7 @@ def list(ctx, scope): @main.command() -@click.option('--scope', type=click.Choice(['config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), help='Cleanup specific scope') @click.pass_context def clean(ctx, scope): @@ -161,7 +161,7 @@ def checkpoint(ctx, reason, serve): @main.command() -@click.option('--scope', type=click.Choice(['config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), default='config', help='Backup scope') @click.option('--verify', is_flag=True, help='Verify archive after creation') @click.option('--output', '-o', type=click.Path(exists=False, file_okay=False, dir_okay=True), From a9a742c4770405b326f46fb8133b9ff7c75301d3 Mon Sep 17 00:00:00 2001 From: OpenClaw Service User Date: Fri, 27 Mar 2026 23:37:04 -0700 Subject: [PATCH 2/3] fix: add SCOPE_CHOICES constant, guard minimal+native combo, fail fast in native_backup --- src/ocbs/cli.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/ocbs/cli.py b/src/ocbs/cli.py index 5ad2058..b946132 100644 --- a/src/ocbs/cli.py +++ b/src/ocbs/cli.py @@ -10,6 +10,9 @@ from .core import BackupSource, BackupScope, OCBSCore from .serve import format_restore_message, start_restore_server +# Shared scope choices to prevent drift +SCOPE_CHOICES = ['minimal', 'config', 'config+session', 'config+session+workspace'] + @click.group() @click.option('--state-dir', type=click.Path(exists=False, file_okay=False, dir_okay=True), @@ -23,7 +26,7 @@ def main(ctx, state_dir): @main.command() -@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(SCOPE_CHOICES), default='config', help='Backup scope') @click.option( '--source', @@ -39,6 +42,13 @@ def backup(ctx, scope, source, reason): scope_enum = BackupScope(scope) source_enum = BackupSource(source) if source else None + # Guard: prevent minimal scope with native source until implemented + if scope == "minimal" and source == "native": + raise click.ClickException( + "Native backup does not yet support 'minimal' scope. " + "Use --source direct or choose a different scope." + ) + try: manifest = core.backup(scope_enum, reason, source=source_enum) click.echo(f"Backup created: {manifest.backup_id}") @@ -104,7 +114,7 @@ def status(ctx): @main.command() -@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(SCOPE_CHOICES), help='Filter by scope') @click.pass_context def list(ctx, scope): @@ -124,7 +134,7 @@ def list(ctx, scope): @main.command() -@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(SCOPE_CHOICES), help='Cleanup specific scope') @click.pass_context def clean(ctx, scope): @@ -161,7 +171,7 @@ def checkpoint(ctx, reason, serve): @main.command() -@click.option('--scope', type=click.Choice(['minimal', 'config', 'config+session', 'config+session+workspace']), +@click.option('--scope', type=click.Choice(SCOPE_CHOICES), default='config', help='Backup scope') @click.option('--verify', is_flag=True, help='Verify archive after creation') @click.option('--output', '-o', type=click.Path(exists=False, file_okay=False, dir_okay=True), @@ -170,6 +180,13 @@ def native_backup(scope, verify, output): """Run OpenClaw native backup to create a tar.gz archive.""" import subprocess + # Fail fast until minimal scope semantics are implemented for native backup + if scope == "minimal": + raise click.ClickException( + "Native backup does not yet support 'minimal' scope. " + "Use 'config', 'config+session', or 'config+session+workspace'." + ) + args = ["openclaw", "backup", "create"] if scope == "config": From e4b0bc6db50c981c9b0514f5adfa4c10d4e1006c Mon Sep 17 00:00:00 2001 From: OpenClaw Service User Date: Fri, 27 Mar 2026 23:37:51 -0700 Subject: [PATCH 3/3] chore: trigger re-review after fixes