Skip to content

feature: add caching-proxy clean subcommand#39

Merged
maoueh merged 1 commit into
developfrom
feature/add-caching-proxy-cleanup-command
Jul 14, 2026
Merged

feature: add caching-proxy clean subcommand#39
maoueh merged 1 commit into
developfrom
feature/add-caching-proxy-cleanup-command

Conversation

@maoueh

@maoueh maoueh commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds evmx caching-proxy clean <dsn> "error:<regex>" to purge wrongfully-cached error entries from the caching-proxy KV store. The parent caching-proxy command still starts the JSON-RPC server by default; clean is a new subcommand.

Motivation

Some deterministic-looking errors were cached that should not have been (now prevented going forward by the -32602 fix on develop). This command lets operators remove the already-cached bad entries by matching their error message against a regex.

Behavior

  • Full-scans the store (keys are opaque sha256, so a prefix scan over all entries is required).
  • Matches entries whose value is prefixed with the error marker (0x01), unmarshals the rpc.ErrResponse, and tests the regex against its Message.
  • Deletes matches via BatchDelete in batches of --batch-size (default 100); --batch-size 1 deletes serially, one key per call, bypassing batching.
  • --dry-run previews matches without deleting anything.
  • Matcher arg is error:<regex> — the error: prefix is reserved so future matcher kinds can be added.

Report

Instead of a log line, prints a styled summary via a small local stylex package (lipgloss + go-isatty), auto-plain when stdout is not a TTY:

Caching Proxy Clean Report
──────────────────────────
  Scanned         9508
  Error entries   7736
  Matched         7727
  Deleted         0 (dry-run, nothing deleted)

Tests

  • executor: TDD unit tests against a real badger store — only matching errors deleted, data + non-matching errors + malformed payloads kept; dry-run and --batch-size 1 paths; invalid batch size rejected.
  • cmd/evmx: error:<regex> matcher parsing and report rendering.

Add `evmx caching-proxy clean <dsn> "error:<regex>"` to purge wrongfully-cached
error entries whose message matches a regex. The parent `caching-proxy` command
still starts the server by default.

- Full-scans the KV store, matches error entries (value prefix 0x01) against the
  regex on the rpc error message, and deletes them via BatchDelete in batches of
  --batch-size (1 = serial, bypassing batching).
- --dry-run previews matches without deleting.
- Prints a styled summary report via a small local stylex package (lipgloss +
  go-isatty, auto-plain when stdout is not a TTY).
@maoueh maoueh merged commit 42bbac2 into develop Jul 14, 2026
6 checks passed
@maoueh maoueh deleted the feature/add-caching-proxy-cleanup-command branch July 14, 2026 18:35
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