Repository navigation
Periodic code gardening - #241
Merged
Merged
Conversation
The add, bind, remove and update flows lived in the binary, with their prompts and a spinner of their own, so the thin-CLI rule did not hold and the flows were out of reach of the lib's tests. They are commands now (add, bind, update), the questions put to the user and the wait display are ui's, and tests/layering.rs pins the rule. The push and index futures are boxed where the add flow awaits them: in one crate their state machines nest deeper than rustc's layout recursion allows. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five command files read arrow batches with helpers of their own, built filter strings by hand, rolled the row-id scan loop three times and wrote rows and versions directly, so the layer table's "names Lance → mechanics" rule held only for the dataset module's own code. dataset now owns the scans and searches (nearest, full_text), the column readers, the filter quoting, the id scans, the writes and the version reads; commands hold the Dataset and RecordBatch values and hand them back. tests/layering.rs pins the rule. The dataset card and the sketch cache key now take the embedding model from the domain, so an unstamped memory reads as bge-small there as it does everywhere else. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The home's layout was spelled across six layers: traces, agents, the lock and session_sketch imported the Lance module for funes_dir, and push, index and memory joined their own names under it. home.rs now owns the home and every path in it (the memory with its store→memory rename, the spools, the push receipts, the binding, the index state and coverage, the sketch cache, the pre-1.7 lock). tests/layering.rs checks that no other file reads $FUNES_HOME. dataset::table_uri takes a path, so a local memory no longer goes through a lossy string at every call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
session_sketch.rs sat at the src root, outside every layer, and imported commands::recall while the sketch command imported it back. The verb, its defaults, the clamp and the read stay in commands/sketch.rs; the selection moves to commands/sketch/select.rs and the cache to commands/sketch/cache.rs. is_scaffolding moves to traces, so recall and sketch share it without importing each other. Gone with the move: generate_many and its uncached path (no caller), the selector's own defaults (reached only from tests, and 16000 chars where the command ships 8000), SelectedUnit and Evidence.selected (written, never read) and the second clamp. A cached sketch from before still loads: the dropped fields are ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
index, scrub, push, bind and status opened the local memory and read any failure as "no memory", so an unreadable memory passed for an absent one, against the rule that a memory's state comes from the domain. The domain now answers that question with Memory::dataset (the dataset with rows or without, None when there is none, the state's own error otherwise), and the add flow no longer reads a failed state as a first add. Offline was the one state each command worded itself. memory.rs gains offline_error, and push, compact and the read check use it; the read verbs keep their own degrade to the local memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
target, compact and recall imported the push command for state: the receipt of what this host pushed, the compaction helpers and the read-only check. The receipt is domain state, so it moves to memory/receipt.rs with owed_sessions and owes_session. The write setup push and compact each assembled (client, branch, storage options) becomes remote::writable, on the branch reads pin to, so the invariant that writes target that branch holds in one place. is_read_only joins is_offline_error in hub.rs. The forced compaction moves to compact.rs, which push --compact now calls, as bind calls push. recall still asks push for its coverage: the held-row count is the push's secret gate run dry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Unresolved trust and binding issues across the lifecycle refactor require fixes and human validation.
3 open findings
What changed in this PR
Reorganizes funes around its existing layers, moving command workflows, storage operations, and terminal interaction into dedicated modules.
Changes:
- Centralizes home paths, dataset helpers, and push receipts.
- Separates integration lifecycle and sketch responsibilities.
- Updates callers and adds architectural placement checks.
| File | Description |
|---|---|
| tests/turns_file_round_trip.rs | Uses centralized memory paths. |
| tests/shallow_finalize.rs | Passes paths directly to dataset helpers. |
| tests/scrub_sweeps_old_versions.rs | Uses centralized memory paths. |
| tests/scrub_drops_all.rs | Uses centralized memory paths. |
| tests/scan_batch.rs | Uses centralized memory paths. |
| tests/recall_no_harness_column.rs | Uses centralized memory paths. |
| tests/push_compact_missing_index.rs | Passes dataset paths directly. |
| tests/multilingual_scrub.rs | Uses centralized memory paths. |
| tests/multilingual_index.rs | Uses centralized memory paths. |
| tests/layering.rs | Adds architectural placement checks. |
| tests/index_recall.rs | Corrects a helper name in a comment. |
| tests/index_check.rs | Uses centralized memory paths. |
| tests/funes_jsonl_index.rs | Updates dataset path handling. |
| tests/first_index.rs | Uses centralized spool paths. |
| tests/add_fifth_integration.rs | Updates expected offline wording. |
| src/ui/render.rs | Imports relocated sketch types. |
| src/ui/prompt.rs | Centralizes terminal questions and confirmation. |
| src/ui/banner.rs | Supports spinner-only wait displays. |
| src/ui.rs | Exposes shared prompt helpers. |
| src/traces/spool.rs | Uses centralized home paths. |
| src/traces.rs | Houses shared scaffolding detection. |
| src/memory/remote.rs | Centralizes remote write configuration. |
| src/memory/receipt.rs | Houses push receipts and backlog queries. |
| src/memory/lock.rs | Uses centralized lock paths. |
| src/memory/dataset.rs | Consolidates storage operations and column access. |
| src/memory.rs | Adds state-aware dataset access. |
| src/lib.rs | Updates layer exports and documentation. |
| src/hub.rs | Houses typed write-permission detection. |
| src/home.rs | Centralizes home directory paths. |
| src/commands/update.rs | Houses integration update orchestration. |
| src/commands/target.rs | Uses dedicated receipt helpers. |
| src/commands/sketch/select.rs | Isolates passage selection. |
| src/commands/sketch/cache.rs | Isolates sketch caching. |
| src/commands/sketch.rs | Owns sketch generation and types. |
| src/commands/scrub.rs | Uses domain and dataset helpers. |
| src/commands/recall.rs | Uses shared storage and trace helpers. |
| src/commands/push.rs | Delegates receipt and storage mechanics. |
| src/commands/index.rs | Houses index dispatch and shared-helper calls. |
| src/commands/compact.rs | Owns forced remote compaction. |
| src/commands/bind.rs | Houses binding and migration workflows. |
| src/commands/ask.rs | Simplifies banner progress updates. |
| src/commands/add.rs | Houses integration installation and removal. |
| src/commands.rs | Exposes add and bind modules. |
| src/chunk.rs | Moves stored-row decoding into dataset helpers. |
| src/agents/registry.rs | Uses centralized home resolution. |
| scripts/migrate_schema.rs | Passes local paths directly. |
| scripts/backfill_repo.rs | Uses centralized memory paths. |
| CONTRIBUTING.md | Documents revised layer placement. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Every once in a while, the code needs a little gardening, catching inconsistencies and modules that slowly drifted further away from the design and coding guidelines.