No way to remove a library or book from the system #52

Closed
opened 2026-02-13 14:45:47 +00:00 by mik-tf · 0 comments
Owner

Problem

There is no delete/remove functionality anywhere in the system. Once a library or book is imported, it cannot be cleanly removed. Data persists across multiple locations and resurrects on restart:

  1. Disk~/hero/var/books/{library}/ (export directory, library.toml, doctree.toml)
  2. Book TOMLs — flat files in books_dir (e.g. examples/ebooks_local/znzcybercity_cybercity.toml)
  3. Embedder KVSlibrary_config:{name} and book:{name} keys in herobooks_state namespace
  4. Embedder vectors — documents indexed under the namespace

Deleting from one location is insufficient — sync_library_configs() pulls from KVS back to disk, export_books_for_serving() re-exports from TOMLs, and discover_namespaces_from_embedder() rediscovers from the embedder.

Expected Behavior

Provide a way to fully remove a library or book:

CLI

hero_books_client remove-library znzcybercity
hero_books_client remove-book znzcybercity/cybercity

Web UI

  • Delete button on library page and book page (with confirmation)

Admin API

  • RPC method remove_library / remove_book

What removal should do

  1. Delete ~/hero/var/books/{library}/ (or specific book subdirectory)
  2. Delete book TOML from books_dir if present
  3. Delete library_config:{name} and book:{name} KVS entries from embedder
  4. Delete embedder namespace vectors (namespace.delete)
  5. Remove from in-memory caches and namespace maps
  6. Log what was removed

Notes

  • Issue #46 (unifying books_dir into the library tree) will reduce the number of locations, but delete functionality is still needed
  • The embedder already supports namespace.delete (params as array: ["namespace_name"]) — it just needs to be wired up
  • KVS delete works via kvs.delete with {"key": "...", "namespace": "herobooks_state"}
## Problem There is no delete/remove functionality anywhere in the system. Once a library or book is imported, it cannot be cleanly removed. Data persists across multiple locations and resurrects on restart: 1. **Disk** — `~/hero/var/books/{library}/` (export directory, library.toml, doctree.toml) 2. **Book TOMLs** — flat files in `books_dir` (e.g. `examples/ebooks_local/znzcybercity_cybercity.toml`) 3. **Embedder KVS** — `library_config:{name}` and `book:{name}` keys in `herobooks_state` namespace 4. **Embedder vectors** — documents indexed under the namespace Deleting from one location is insufficient — `sync_library_configs()` pulls from KVS back to disk, `export_books_for_serving()` re-exports from TOMLs, and `discover_namespaces_from_embedder()` rediscovers from the embedder. ## Expected Behavior Provide a way to fully remove a library or book: ### CLI ```bash hero_books_client remove-library znzcybercity hero_books_client remove-book znzcybercity/cybercity ``` ### Web UI - Delete button on library page and book page (with confirmation) ### Admin API - RPC method `remove_library` / `remove_book` ### What removal should do 1. Delete `~/hero/var/books/{library}/` (or specific book subdirectory) 2. Delete book TOML from books_dir if present 3. Delete `library_config:{name}` and `book:{name}` KVS entries from embedder 4. Delete embedder namespace vectors (`namespace.delete`) 5. Remove from in-memory caches and namespace maps 6. Log what was removed ## Notes - Issue #46 (unifying books_dir into the library tree) will reduce the number of locations, but delete functionality is still needed - The embedder already supports `namespace.delete` (params as array: `["namespace_name"]`) — it just needs to be wired up - KVS delete works via `kvs.delete` with `{"key": "...", "namespace": "herobooks_state"}`
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_books#52
No description provided.