chore: adopt edition 2024, in-tree lint policy, and rustfmt config#76
Merged
Conversation
Bring hop's Rust tooling discipline in line with reference projects (oxc): - Bump to edition 2024. cargo fix required no source migration; the now-stable let-chains let clippy::collapsible_if merge several nested `if` / `if let` blocks (adapters, config, hooks, index, query, columns). - Add a `[lints]` table so the "warnings are errors" contract CI enforces is visible in-tree and to IDEs. Pragmatic subset: clippy::all plus a few high-signal restriction lints (clone_on_ref_ptr, format_push_string, dbg_macro, todo, unimplemented, undocumented_unsafe_blocks), each opt-in documented. Not the full pedantic/nursery groups. - Add rustfmt.toml (style_edition 2024, use_small_heuristics = "Max", field-init shorthand). - Remove the unused `thiserror` dependency. - Fix a stale path in docs/ARCHITECTURE.md (src/columns.rs -> src/tui/columns.rs). - Switch a test off push_str(&format!(..)) to satisfy format_push_string. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mechanical reformat only (no logic changes), produced by `cargo fmt` under the rustfmt.toml added in the previous commit. Isolated here so review can skip it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Previously every sync pass opened a fresh IndexWriter (index.writer()) and dropped it at the end. Tantivy allows only one writer per directory at a time, its writer lock is non-blocking (no retry), and a dropped writer releases the lock only once its detached merge threads wind down. So a second sync pass over the same index — as several engine tests do — could race the previous writer's not-yet-released `.tantivy-writer.lock` and fail with `LockBusy` under parallel test load. Per tantivy's own guidance (issue #550), the fix is to keep a single writer rather than reopen one per operation. - `SearchIndex` now owns `Mutex<Option<IndexWriter>>`, created lazily on the first write and reused for the handle's lifetime. Read-only handles never take the writer lock, preserving the reader/writer split between the UI engine and the background sync handle. - `upsert`/`delete`/`commit` are now `&self` methods that route through the internal writer; callers no longer thread a `&mut IndexWriter`. - `Drop for SearchIndex` calls `wait_merging_threads()` so the lock is released deterministically before another handle opens a writer on the same directory. - Simplified the sync loop and the index_sync tests accordingly. Verified with 6 consecutive full parallel `cargo test` runs (277 pass each). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
amittamari
force-pushed
the
oxc-inspired-phase1
branch
from
July 12, 2026 14:17
88d922a to
32e0099
Compare
Merged
amittamari
added a commit
that referenced
this pull request
Jul 13, 2026
Concrete, std-only allocation cleanups in the indexing parse loop and the TUI render path. No new dependencies. > Stacked on top of #76 (base = `oxc-inspired-phase1`). Rebase onto `master` once #76 merges. ## Changes - **Adapters:** reuse one decode buffer per file instead of allocating a fresh `Vec<u8>` for every JSONL line (`clear` + `extend_from_slice`). Applies to the Claude, Codex, and Cursor parse loops. - **Results list:** compute each visible cell's `(text, style)` once per frame (`compute_cells`), then feed the same grid to both the width solver (`layout_from_cells`) and the row builder (`session_row`). Previously every non-flex cell string was built twice per frame (measure pass + build pass). This also halves the per-frame `document_key()` probes for the PR column and lets `cell()`/`enrichment_cell()` take `&RowCtx`, dropping the `too_many_arguments` allow. - **Footer:** build the status line once and size its region from it instead of rebuilding it just to measure the width (`line_display_width`). - **`Cow<str>`** for the no-op-common text transforms so they borrow when the input is unchanged (the common case): `strip_codex_wrappers`, `strip_redacted` (now fully allocation-free), and index `sanitize`. ## Note Full elimination of the per-frame `document_key()` `format!` was intentionally not pursued: the `resolved` map's `(String, &'static str)` tuple key can't be probed with a borrowed key, so even a cached key would still clone into the tuple. Removing it entirely would require restructuring the map type across its construction sites and ~15 tests for negligible gain. The grid change above already halves the calls. ## Verification - `cargo fmt --all -- --check` clean - `cargo clippy --all-targets --all-features -- -D warnings` clean - `cargo test` — 277 pass. Adapter/index integration suites cover the parse-path and `Cow` changes; `results_list` unit tests and `view.rs` render-to-buffer snapshots cover the render-path changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
amittamari
added a commit
that referenced
this pull request
Jul 13, 2026
## 🤖 New release * `hop`: 0.2.8 -> 0.2.9 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.2.9](v0.2.8...v0.2.9) - 2026-07-13 ### Added - capture session model/commit and skip non-interactive threads ([#75](#75)) - harden Codex session parsing ([#74](#74)) - simple/raw search modes with guided toolbar ([#73](#73)) - hook-based session metadata enrichment ([#65](#65)) ### Other - trim hot-path allocations in indexing and TUI render ([#77](#77)) - adopt edition 2024, in-tree lint policy, and rustfmt config ([#76](#76)) - add DESIGN.md, codex-inspired review, and no-local-paths rule - *(readme)* update demo </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
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.
Adopts oxc-inspired Rust tooling discipline. Pragmatic scope: no new runtime dependencies, no
pedantic/nurserychurn.Changes
cargo fixrequired no source migration; now-stable let-chains letclippy::collapsible_ifmerge several nestedif/if letblocks (adapters, config, hooks, index, query, columns).[lints]table inCargo.tomlso the "warnings are errors" contract CI enforces (clippy --all-targets --all-features -- -D warnings) is visible in-tree and to IDEs.clippy::allplus a small set of high-signal restriction lints (clone_on_ref_ptr,format_push_string,dbg_macro,todo,unimplemented,undocumented_unsafe_blocks), each opt-in documented.rustfmt.toml(style_edition 2024,use_small_heuristics = "Max", field-init shorthand). The mass reformat is isolated in its own commit for reviewability.thiserrordependency.docs/ARCHITECTURE.md(src/columns.rs→src/tui/columns.rs).Verification
cargo fmt --all -- --checkcleancargo clippy --all-targets --all-features -- -D warningscleancargo test— 277 pass🤖 Generated with Claude Code