Skip to content

fix(openclaw): remove clear-all's disk-storage handling - #500

Merged
guangyu-reflexio merged 1 commit into
mainfrom
fix/drop-vestigial-disk-clear-all
Sep 12, 2026
Merged

guangyu-reflexio merged 1 commit into
mainfrom
fix/drop-vestigial-disk-clear-all

Conversation

@guangyu-reflexio

@guangyu-reflexio guangyu-reflexio commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #499, which flagged this and deliberately did not touch it.

Answering the question #499 left open

#499 noted that _disk_org_targets globs every disk_* child rather than the caller's — the same shape as the bug it fixed — but left it alone, because there was no convention to verify a narrowing against.

There is no convention because there is no backend. #98 removed disk storage entirely on 2026-05-28, describing itself as a "clean cold deletion (no deprecation window)". The plugin was never updated to match, so this handling has outlived what it served by three and a half months. The answer was delete, not narrow.

It is unreachable

  • StorageConfig is a union of StorageConfigSQLite | StorageConfigSupabase | StorageConfigPostgres | StorageConfigManagedSupabase | None. No disk variant.

  • _STORAGE_CONFIG_ADAPTER rejects both legacy shapes outright — verified directly:

    {'type': 'disk', 'dir_path': '/tmp/x'} -> REJECTED
    {'dir_path': '/tmp/x'}                 -> REJECTED
    
  • The only surviving dir_path reference in the package, in _storage_labels.py, is guarded on cls_name == "StorageConfigLocal" — a class that no longer exists either. (Left alone here; inert, and outside this file's scope.)

  • No DiskStorage implementation exists anywhere in either package.

What is removed

  • _disk_org_targets
  • the kind == "disk" branch in _resolve_clear_all_targets
  • both legacy shapes in _storage_config_kind

No disk logic remains. The one surviving mention of the word is a comment explaining why the fallthrough below is correct.

Leftover configs refuse, rather than being reinterpreted

A config left over from the disk backend now falls through to the refusal _storage_config_kind already has for shapes it cannot interpret:

unsupported reflexio storage_config shape; refusing to delete local data

That is deliberate. validate_stored_config rejects those configs, so the server cannot load such an org either — we genuinely do not know what storage it uses, and a destructive command must not guess.

An earlier revision of this PR mapped disk onto sqlite instead. That was wrong on two counts and has been removed:

  1. It asserts something false — a disk config is not a SQLite config — and would delete a database on the strength of that guess, while keeping a removed backend alive under a different name.
  2. The reasoning behind it did not hold. I justified it with resolve_storage_backend's fallback to SQLite, but that fallback applies to the REFLEXIO_STORAGE environment variable, not to a persisted storage_config. Different input, different path; the config is simply invalid.

Test Plan

Local, as Actions has no budget:

  • Plugin suite: 170 passed, 2 skipped
  • Full OSS suite: 6181 passed, 140 skipped, coverage 83.38% (floor 65%)
  • ruff check + ruff format --check: clean
  • pyright: 0 errors, 0 warnings

New test, parametrized over both legacy shapes: each refuses and deletes nothing.

Mutation-tested: reinstating the disksqlite mapping fails the explicit-type case. Mutation confirmed present before running; file restored by checksum afterwards.

Summary by CodeRabbit

  • Bug Fixes
    • clear-all now reports unsupported legacy disk storage configurations instead of attempting to remove them.
    • SQLite and remote storage handling remain available.
    • Unsupported storage configurations leave the current identity’s database unchanged.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 2f6589c5-56ef-40ac-8799-86bd4abf4610

📥 Commits

Reviewing files that changed from the base of the PR and between c86bc7d and fd64395.

📒 Files selected for processing (2)
  • reflexio/integrations/openclaw/plugin/src/openclaw_smart/cli.py
  • reflexio/integrations/openclaw/plugin/tests/test_clear_all_targets.py

Included review availability: Your plan provides up to 5 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

Clear-all no longer enumerates legacy disk storage targets. Unsupported disk configurations now raise _ClearAllError, while SQLite and remote storage handling remain unchanged. Regression tests verify that the identity database remains untouched.

Changes

Clear-all storage handling

Layer / File(s) Summary
Storage target resolution and regression coverage
reflexio/integrations/openclaw/plugin/src/openclaw_smart/cli.py, reflexio/integrations/openclaw/plugin/tests/test_clear_all_targets.py
Clear-all removes legacy disk target detection and deletion. Unsupported disk configurations now fail explicitly. Documentation identifies only owned SQLite artifacts, and parametrized tests verify that the identity database is not deleted.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: yilu331

Merge Risk: ⚪ Minimal · up to fd643

Legacy disk configurations are invalid and are safely refused rather than being guessed as SQLite targets. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing disk-storage handling from OpenClaw's clear-all command.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/drop-vestigial-disk-clear-all

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

#499 flagged `_disk_org_targets` as looking like the same class of bug it fixed
-- it globs every `disk_*` child rather than the caller's -- but left it alone
for want of a convention to verify a narrowing against. There is none, because
there is no backend: #98 removed disk storage entirely on 2026-05-28, in its own
words a "clean cold deletion (no deprecation window)". The plugin was never
updated, so this handling has outlived what it served by three and a half
months.

Nothing can reach it. `StorageConfig` is a union of SQLite, Supabase, Postgres
and ManagedSupabase -- no disk variant -- and `_STORAGE_CONFIG_ADAPTER` rejects
both `{"type": "disk", ...}` and a bare `{"dir_path": ...}`. The one surviving
`dir_path` reference in the package, in `_storage_labels.py`, is guarded on
`cls_name == "StorageConfigLocal"`, a class that no longer exists either.

Removed: `_disk_org_targets`, the `kind == "disk"` branch in target resolution,
and both legacy shapes in `_storage_config_kind`. No disk logic remains.

A leftover disk config now falls through to the refusal the function already
has for shapes it cannot interpret. That is deliberate rather than incidental:
`validate_stored_config` rejects those configs, so the server cannot load such
an org either. We do not know what storage it uses, and a destructive command
must not guess.

Translating `disk` to `sqlite` was considered and rejected. It asserts something
false -- a disk config is not a SQLite config -- and would delete a database on
the strength of that guess, while keeping a removed backend alive under another
name. The reasoning behind it was also wrong: `resolve_storage_backend`'s
fallback to SQLite applies to the `REFLEXIO_STORAGE` environment variable, not
to a persisted `storage_config`, which is simply invalid.

Test: both legacy shapes refuse and delete nothing. Reinstating the `disk` ->
`sqlite` mapping fails it.
@guangyu-reflexio
guangyu-reflexio force-pushed the fix/drop-vestigial-disk-clear-all branch from 6dfd712 to fd64395 Compare September 12, 2026 05:28
@guangyu-reflexio guangyu-reflexio changed the title fix(openclaw): drop clear-all's vestigial disk-storage branch fix(openclaw): remove clear-all's disk-storage handling Sep 12, 2026
@guangyu-reflexio
guangyu-reflexio merged commit 56fd02a into main Sep 12, 2026
5 checks 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