Commit Graph

87 Commits

Author SHA1 Message Date
b166477202 fix: harden security, eliminate panics, remove dead code, add Dockerfile
Security:
- Use constant-time password comparison (subtle crate) to prevent timing attacks
- Replace permissive CORS with configurable origin-restricted CORS
- Add TLS warning when password auth is used without HTTPS

Bug fixes:
- Convert MetaPlugin panics to anyhow::Result (get_meta_plugin, outputs_mut, options_mut)
- Replace item.id.unwrap() with proper error handling across 15 call sites
- Fix panic on unknown column type in list mode
- Fix conflicting PIPESIZE constant (was 8192 vs 65536, now unified to 8192)
- Add 256MB filter chain buffer limit to prevent OOM
- Gracefully skip unregistered plugins instead of panicking

Dead code removal:
- Delete unused filter parser files (filter_parser.rs, filter.pest, parser/ module)
- ~260 lines of dead PEG parser code removed

Code consolidation:
- Add is_content_binary_from_metadata() helper (was duplicated in 4 places)
- Simplify save_item_raw() to delegate to save_item_raw_streaming() (~90 lines removed)

Incomplete features:
- Populate filter_plugins in status output from global registry
- Add FallbackMagicFileMetaPlugin (was referenced but never implemented)
- Document init_plugins() as intentional no-op

Infrastructure:
- Add Dockerfile (static musl binary on scratch, 4.8MB)
- Add .dockerignore
- Add cors_origin to ServerConfig and config.rs
2026-03-13 07:57:36 -03:00
9b7cbd5244 fix: resolve doctest failures, database bugs, and remove dead code
- Fix all 96 doctest failures across 20 files by adding hidden imports and
  proper test setup (68 pass, 33 intentionally ignored)
- Fix set_item_tags: wrap in transaction and replace item.id.unwrap() with
  proper error handling
- Fix get_items_matching: replace N+1 per-item meta queries with batch
  get_meta_for_items() call
- Fix get_item_matching: apply meta filtering instead of ignoring the parameter
- Remove duplicate doc comment in store_meta
- Remove dead code files: plugin.rs, plugins.rs, binary_detection.rs
  (never declared as modules)
- Apply cargo fmt formatting fixes
- Add keep.db to .gitignore
2026-03-12 11:58:44 -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
311aba39d4 docs: Add comprehensive rustdoc to item_service.rs
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
2025-09-10 13:03:11 -03:00
Andrew Phillips
c199590b3c docs: Add comprehensive rustdoc to item_service.rs
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
2025-09-10 12:47:20 -03:00
Andrew Phillips
0d575e8850 fix: Resolve type mismatches for Option<FilterChain> and Option<&FilterChain>
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-03 07:46:51 -03:00
Andrew Phillips
e34d0e315b refactor: Accept filter_chain by reference and clone when needed
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-03 07:46:24 -03:00
Andrew Phillips
5afe2f6bc8 feat: Add --filters option to --get and parse filters early
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-03 07:42:28 -03:00
Andrew Phillips
426eff309b refactor: Improve error handling and borrowing in item services
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-03 07:32:25 -03:00
Andrew Phillips
61d7dcb94e refactor: Consolidate item content filtering into a single filter string
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-02 18:54:50 -03:00
Andrew Phillips
2fcf922dd8 refactor: Simplify content streaming by consolidating filter parameters
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-02 18:36:54 -03:00
Andrew Phillips
3ed54ce6b3 fix: Correct streaming content parameters and update deprecated macro
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-02 18:31:42 -03:00
Andrew Phillips
44740518a7 feat: Add --filter option to --get mode for content filtering
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-02 17:21:52 -03:00
Andrew Phillips
765a46a8d2 fix: Adapt FilteringReader to use FilterChain for streaming
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-09-02 16:31:03 -03:00
Andrew Phillips
93ebf3ccd0 fix: update module paths to use crate:: prefix
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat>
2025-08-29 11:40:04 -03:00
Andrew Phillips
9a32c68bd8 fix: update filter_plugin import paths to use keep namespace
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat>
2025-08-29 11:35:25 -03:00
Andrew Phillips
21bd31b97e refactor: update imports to use relative paths for filter_plugin
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:30:31 -03:00
Andrew Phillips
3e4d90afcf fix: replace external keep imports with internal crate imports
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:24:33 -03:00
Andrew Phillips
1d791b9430 fix: update filter_plugin import paths to use keep::filter_plugin
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-08-29 11:23:01 -03:00
Andrew Phillips
2e1ef484f3 fix: replace incorrect keep module imports with crate
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-08-29 11:22:37 -03:00
Andrew Phillips
b1f2fac564 fix: update filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-08-29 11:22:13 -03:00
Andrew Phillips
56adbbf345 fix: replace incorrect module imports with crate paths
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
2025-08-29 11:21:39 -03:00
Andrew Phillips
76ad07e2ee fix: update imports to use keep crate instead of binary crate
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:20:44 -03:00
Andrew Phillips
dac0148176 fix: replace incorrect crate imports with proper module paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:18:57 -03:00
Andrew Phillips
6143055aa6 fix: update filter_plugin imports to use keep crate
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:18:22 -03:00
Andrew Phillips
ec64c79bc2 fix: update import paths to use crate scope
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:16:50 -03:00
Andrew Phillips
93e4a6154c fix: update filter_plugin import paths to use keep:: prefix
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:15:49 -03:00
Andrew Phillips
d36db194f8 refactor: update import paths to use crate-relative paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 11:15:02 -03:00
Andrew Phillips
091b5e5e70 fix: update filter_plugin import paths to use keep crate
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:31:50 -03:00
Andrew Phillips
7c77e14c70 fix: update service imports to use crate paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:31:11 -03:00
Andrew Phillips
359f9f2c60 fix: update filter_plugin import paths to use keep namespace
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:29:37 -03:00
Andrew Phillips
886ab27dc6 fix: correct filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:28:07 -03:00
Andrew Phillips
8cdcf987d2 fix: correct filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:26:51 -03:00
Andrew Phillips
f098dece8d fix: correct filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:26:19 -03:00
Andrew Phillips
8e58367675 fix: update filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:25:43 -03:00
Andrew Phillips
6b7598e496 fix: update filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:25:06 -03:00
Andrew Phillips
f947b06725 fix: correct filter_plugin import paths
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:22:57 -03:00
Andrew Phillips
470bb98dbb fix: update incorrect import paths for filter_plugin
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:21:42 -03:00
Andrew Phillips
694ad0e63a fix: update filter_plugin import paths and mark unused field
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:21:12 -03:00
Andrew Phillips
625236f8df fix: remove unused parameter prefixes and update tail filter implementation
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:20:15 -03:00
Andrew Phillips
1a4e9d531a fix: make finish method public and fix ringbuf method names
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-29 10:18:57 -03:00
Andrew Phillips
01b7046970 feat: add filtering reader implementation
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 22:00:33 -03:00
Andrew Phillips
c3e3ab1e46 feat: implement filter service integration
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 21:59:49 -03:00
Andrew Phillips
e664429465 fix: mark unused parameters with underscores
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 21:41:43 -03:00
Andrew Phillips
fe19ba0c5c fix: remove filter_service and fix function arguments
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 21:08:41 -03:00
Andrew Phillips
8fcccf68e3 fix: remove unused filter_plugin import and unused ringbuf import
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 21:05:23 -03:00
Andrew Phillips
4c8466bb21 refactor: reduce code duplication in filter and item services
Co-authored-by: aider (openai/andrew/openrouter/mistralai/mistral-medium-3.1) <aider@aider.chat>
2025-08-28 20:51:39 -03:00
Andrew Phillips
ee2a9c63ee refactor: remove LineRangeFilter implementation
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 20:36:41 -03:00
Andrew Phillips
272f75349c refactor: remove filter implementations from item_service
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
2025-08-28 20:36:18 -03:00