5bad7ac7a6
refactor: decouple meta plugins from DB via SaveMetaFn callback, extract shared utilities
...
- Add SaveMetaFn callback pattern: meta plugins receive a closure instead of
&Connection, enabling the same plugin code to work in local, client, and
server contexts (collect-to-Vec, collect-to-HashMap, or direct DB write)
- Client save now runs meta plugins locally during streaming (smart client
sets meta=false, server skips its own plugins)
- Add POST /api/item/{id}/update endpoint for re-running plugins on stored
content without downloading compressed data
- Add client update mode (--update with --meta-plugin flags)
- Extract shared utilities: stream_copy, print_serialized, build_path_table,
ensure_default_tag to reduce duplication across modes
- Add upsert_tag for idempotent tag addition (INSERT OR IGNORE)
- Add warn logging on save_meta lock failure in BaseMetaPlugin and MetaService
2026-03-14 22:36:59 -03:00
0af74000d2
fix: eliminate unsafe code via nix, command-fds, and thread-local cookie
...
Replace 4 unsafe sites with safe wrappers:
- libc::pipe2 → nix::unistd::pipe2 (safe OwnedFd return)
- File::from_raw_fd → File::from(OwnedFd) (safe ownership transfer)
- unsafe impl Send for SendCookie → thread_local! lazy Cookie
(each thread gets its own independent Cookie, no Send needed)
- pre_exec + libc::fcntl → command-fds crate fd_mappings()
(handles CLOEXEC clearing safely, also fixes potential fd leak
on spawn failure via OwnedFd RAII)
Only libc::umask remains as a single unavoidable unsafe site
(no safe Rust wrapper exists for the umask syscall).
Also updates AGENTS.md to remove stale SendCookie exception.
2026-03-14 16:01:54 -03:00
b3ca673b52
feat: add --update mode, --meta/--meta-plugin flags, streaming diff
...
- Add --update mode to modify tags and metadata for existing items by ID
- Add --meta key=value flag to set metadata during save/update
- Add --meta key (bare) to delete metadata keys or filter by existence
- Add --meta-plugin/-M name:{json} flag for plugin options via CLI
- Env meta plugin now uses options from --meta-plugin instead of only env vars
- Stream decompressed content to diff via /dev/fd pipes (no temp files)
- Wire --list-format CLI arg to settings (was parsed but ignored)
- Allow --info to accept tags (was restricted to numeric IDs only)
- Change DB meta filtering to HashMap<String, Option<String>> for exact match + key existence
- Fix fcntl error checking in diff pre_exec
- Fix README inaccuracies (delete by tag, nonexistent --digest flag, meta plugin key names)
2026-03-14 15:02:16 -03:00
8a8a6e1c4b
fix: correct critical bugs and improve pipe streaming performance
...
Critical bug fixes:
- save_item now returns real Item from database, not a hardcoded fake
- AsyncDataService::save() reuses self.sync_service instead of creating redundant instance
- GenerateStatus trait signature mismatch fixed (CLI/API decoupling)
Performance improvements (pipe path untouched):
- CompressionEngine::open() returns Box<dyn Read + Send> enabling true streaming
- mode_get eliminates triple full-file read (was sampling then re-reading entire file)
- FilteringReader adds fast-path bypass when no filters, pre-allocates temp buffer
- text.rs meta plugin processes &[u8] slice directly, eliminates data.to_vec() clone
API correctness:
- Tag parse errors now return 400 instead of being silently discarded
- compute_diff uses similar crate (LCS-based) instead of naive positional comparison
Cleanup:
- Modernize string formatting (format!({x})) across codebase
- Remove redundant DB query in get mode
- Derive Debug/ToSchema on public types
- Delete placeholder test files with no real assertions
- Extract parse_comma_tags utility function
2026-03-11 20:45:05 -03:00
Andrew Phillips
fdeb5f7951
Ugh
2026-02-19 13:57:39 -04:00
Andrew Phillips
5d7c0658b9
fix: fix typos and improve error handling in compression engines
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-11 12:00:45 -03:00
Andrew Phillips
b0e359989a
fix: Resolve build errors and warnings, and update grammar
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 16:20:08 -03:00
Andrew Phillips
0d68f39c08
fix: Correct Pest grammar and update ItemService initialization
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 16:14:00 -03:00
Andrew Phillips
22cd07284b
fix: Resolve compilation errors for multiple definitions and parser issues
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 16:12:11 -03:00
Andrew Phillips
c965e9f51c
docs: Add rustdoc to all files, document arguments and returns
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 12:10:36 -03:00
Andrew Phillips
c5f43b56f2
fix: Restore missing lines and refactor setup_diff_paths_and_compression
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 12:05:38 -03:00
Andrew Phillips
ddafeb3a28
docs: Add rustdoc for server, diff, and gzip components
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 12:04:46 -03:00
Andrew Phillips
a0e0126ff3
fix: Correct module paths and conditional compilation for magic feature
...
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat >
2025-09-10 10:11:25 -03:00
Andrew Phillips
52dc8cea32
feat: update dependencies and remove binary and command meta plugins
2025-08-28 13:11:19 -03:00
Andrew Phillips
2cfa06a45b
fix: add explicit type annotations for parse and remove unused imports
...
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat >
2025-08-25 21:49:56 -03:00
Andrew Phillips
e97807f7fa
fix: use item service for proper item handling
...
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat >
2025-08-25 21:47:06 -03:00
Andrew Phillips
a203059bb4
refactor: rename core module to services
...
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat >
2025-08-25 14:21:20 -03:00
Andrew Phillips
a1bcba5cb1
fix: fix async database locking and diff process order
...
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat >
2025-08-25 12:59:04 -03:00
Andrew Phillips
a0c8363852
refactor: update diff mode to use ItemService and ItemWithMeta
...
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat >
2025-08-25 12:31:36 -03:00
Andrew Phillips
7ec0603e00
feat: implement core services and refactor modes
...
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat >
2025-08-24 23:56:06 -03:00
Andrew Phillips
c4b2a5d7e7
fix: update config type references and method calls
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-16 12:03:13 -03:00
Andrew Phillips
b6389419c0
fix: remove unused imports and resolve config module conflicts
...
Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-08-15 16:39:11 -03:00
Andrew Phillips
56f4d8aad5
feat: implement unified settings system
...
Co-authored-by: aider (openai/andrew/openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-08-15 16:36:58 -03:00
Andrew Phillips
6bfb5ed963
fix: resolve OpenAPI macro and file descriptor type mismatches
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-13 11:40:44 -03:00
Andrew Phillips
99949cf1ee
fix: resolve compilation errors in API paths and file descriptor handling
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-13 11:22:46 -03:00
Andrew Phillips
6c9074f1be
fix: reorder OpenAPI paths and fix file descriptor handling in diff mode
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-13 11:21:14 -03:00
Andrew Phillips
e66af572d3
fix: resolve compilation errors in API paths and file descriptor handling
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-13 11:20:05 -03:00
Andrew Phillips
baf92a8902
fix: resolve compilation errors in API routes and diff pipe setup
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-13 11:19:05 -03:00
Andrew Phillips
d5ee57863a
fix: resolve compilation errors in API paths, file descriptors, and router merging
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-13 11:08:37 -03:00
Andrew Phillips
469e3640b8
fix: resolve compilation errors by fixing mutable references and removing unused imports
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-10 00:23:58 -03:00
Andrew Phillips
e1c0c81445
fix: resolve compilation errors by adding missing imports and fixing Result types
...
- Import `anyhow`, `clap::Command`, `log::debug`, and I/O traits
- Fix all `Result` return types to include error type `anyhow::Error`
- Replace `anyhow::anyhow!` with `anyhow!` macro calls
- Fix transaction handling in `mode_save`
- Add missing trait imports for I/O operations and string parsing
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-10 00:19:00 -03:00
Andrew Phillips
58f047ba6d
fix: improve error messages and refactor large functions in save/diff modes
...
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-10 00:00:33 -03:00
Andrew Phillips
a3eb9e7056
fix: address critical memory safety, error handling, concurrency and security issues
...
This commit fixes several critical issues across the codebase:
1. Memory safety & resource leaks: Added proper cleanup for compression engine processes using RAII patterns
2. Error handling: Replaced unsafe unwrap() calls with proper error propagation using ok_or_else()?
3. Concurrency issues: Improved diff mode thread safety with proper error handling and RAII guards
4. Security concerns: Added validation for item IDs to prevent path traversal vulnerabilities
5. Database design: Wrapped database operations in transactions for atomicity in save/update modes
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat >
2025-08-09 23:33:06 -03:00
Andrew Phillips
dd8f828ed3
refactor: update function parameters to use references where appropriate
2025-05-14 22:09:23 -03:00
Andrew Phillips
bbdfe19836
feat: add compression and digest support with database schema updates
2025-05-14 09:45:51 -03:00
Andrew Phillips
0189f3c273
refactor: remove module prefixes from compression and digest engine functions
2025-05-13 15:00:30 -03:00
Andrew Phillips (aider)
8f93657fa1
refactor: consolidate imports for get_*_engine functions
2025-05-13 09:00:45 -03:00
Andrew Phillips (aider)
41ac4dafaf
refactor: rename get_engine to get_compression_engine in diff mode
2025-05-13 08:54:04 -03:00
Andrew Phillips (aider)
e15cf371e0
refactor: Update imports to use specific get_engine functions
2025-05-13 08:51:21 -03:00
Andrew Phillips (aider)
71a35a77a0
fix: correct compression module imports
2025-05-12 17:16:52 -03:00
Andrew Phillips (aider)
66e61a4196
refactor: move compression types to compression_engine module
2025-05-12 17:12:17 -03:00
Andrew Phillips
d9072d22d5
refactor: improve test structure and reliability
2025-05-12 13:07:33 -03:00
Andrew Phillips (aider)
f9969a7537
fix: use libc::c_int for file descriptor instead of nix::Fd
2025-05-12 11:16:46 -03:00
Andrew Phillips (aider)
723ec2a6e8
fix: convert Fd to raw descriptor using .0 access
...
This addresses the E0412 error by correctly extracting the raw file descriptor from the nix::unistd::Fd newtype wrapper.
2025-05-12 11:15:32 -03:00
Andrew Phillips (aider)
f9dd390a12
fix: convert nix Fd to raw fd using into_raw()
2025-05-12 11:14:44 -03:00
Andrew Phillips (aider)
d31ab6e793
refactor: centralize thread spawning for item writing
2025-05-12 11:13:06 -03:00
Andrew Phillips (aider)
f3f3c6d628
refactor: extract common function for writing item data to pipe with fd argument
2025-05-12 11:10:00 -03:00
Andrew Phillips (aider)
825ff7a451
fix: remove unused import and method
2025-05-12 10:51:00 -03:00
Andrew Phillips
bb7ed06e9c
refactor: update debug logs to use log::debug macro
2025-05-12 10:50:54 -03:00
Andrew Phillips (aider)
e6cc479b32
refactor: Replace debug! with log::debug! in diff module logging statements
2025-05-12 10:45:22 -03:00