Skip to content

Make max file size configurable via SEMBLE_MAX_FILE_BYTES and warn on skipped files - #252

Open
TommyC81 wants to merge 1 commit into
MinishLab:mainfrom
TommyC81:feat/configurable-max-file-size
Open

Make max file size configurable via SEMBLE_MAX_FILE_BYTES and warn on skipped files#252
TommyC81 wants to merge 1 commit into
MinishLab:mainfrom
TommyC81:feat/configurable-max-file-size

Conversation

@TommyC81

Copy link
Copy Markdown

Closes #250

Following the discussion in #250, this makes the 1 MB max file size configurable via a SEMBLE_MAX_FILE_BYTES environment variable and makes skipped files visible — no CLI flag, no default change.

Changes

  • SEMBLE_MAX_FILE_BYTES env var (src/semble/index/files.py) — new get_max_file_bytes() resolves the limit per call from the environment, falling back to the unchanged 1 MB default. Follows the existing SEMBLE_CACHE_LOCATION / SEMBLE_CLONE_TIMEOUT / SEMBLE_MODEL_NAME idiom, and works for the MCP server path too, where env vars are the only channel.
  • Input validation — a malformed or nonpositive value warns and falls back to the default instead of crashing indexing.
  • Skip warning at index time (src/semble/index/create.py) — create_index_from_path collects TOO_LARGE files and logs one WARNING naming them (up to 5, then ...) with the active limit. The CLI installs an idempotent stderr handler on the semble logger so the warning is visible; the root logger is untouched.
  • README — one paragraph under Storage documenting the 1 MB skip, the warning, and the override.
  • Tests — four tests in tests/index/test_index.py: env resolution (default + override), invalid values fall back, oversized file skipped with a warning naming the file, and oversized file indexed once the limit is raised.

Checklist

  • Links to an existing issue (Closes #250)
  • make test — 328 passed (4 new)
  • make lint / make typecheck — ruff check, ruff format, mypy clean
  • Behavior change covered by tests
  • No public API change; docstrings updated where touched
  • Focused diff (env var + warning, nothing else)

@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking logging edge case when the package logger was preconfigured by an embedding application.

The indexing-limit behavior is coherent and tested, but CLI logging can omit its promised stderr handler merely because an unrelated handler already exists on the semble logger.

Files Needing Attention: src/semble/cli.py

Reviews (1): Last reviewed commit: "rework: env var only, no CLI flag, per r..." | Re-trigger Greptile

Comment thread src/semble/cli.py Outdated
Comment on lines +214 to +215
if package_logger.handlers:
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Existing handlers suppress stderr setup

If an embedding application attaches a non-stderr handler or NullHandler directly to the semble logger before invoking the CLI, this early return prevents installation of the CLI stderr handler, so oversized-file and invalid-limit warnings are redirected or discarded instead of being shown on stderr.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 78d5bb0 — idempotence now keys on a CLI-owned handler type, so a foreign preconfigured handler no longer suppresses the stderr setup.

TommyC81 added a commit to TommyC81/semble that referenced this pull request Aug 18, 2026
Greptile P2 on PR MinishLab#252: the any-handler early return meant a foreign handler attached to the semble logger by an embedding application would suppress the CLI stderr handler, redirecting or discarding oversized-file warnings. Idempotence now keys on the CLI-owned handler type (_CliLogHandler), so repeated setup still adds exactly one handler while a preconfigured foreign logger no longer blocks stderr visibility.

Lore-id: f488e6e1
Constraint: CLI logging setup must be idempotent across repeated in-process invocations
Tested: 328 tests pass; ruff, ruff format, mypy clean
Tested: in-process check: with a foreign NullHandler attached, CLI handler installed exactly once across two setup calls
Related: c9380176
Confidence: high
Scope-risk: narrow
Reversibility: clean
Files larger than 1 MB are skipped during indexing without any indication, silently leaving gaps in search results (MinishLab#250).

Resolve the limit per call from the SEMBLE_MAX_FILE_BYTES environment variable (following SEMBLE_CACHE_LOCATION / SEMBLE_CLONE_TIMEOUT / SEMBLE_MODEL_NAME), falling back to the unchanged 1 MB default; malformed or nonpositive values warn and fall back instead of crashing indexing. Warn at index time naming files skipped for size, with the CLI surfacing warnings on stderr via an idempotent, CLI-owned handler.
@TommyC81
TommyC81 force-pushed the feat/configurable-max-file-size branch from 78d5bb0 to 68f3c45 Compare August 18, 2026 06:32
@TommyC81

Copy link
Copy Markdown
Author

Squashed the branch into a single commit (68f3c45) — the previous three-commit history (feature, review rework, logging fix) was just review noise. No code changes, same diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files larger than 1 MB are silently skipped during indexing - no warning, no way to raise the limit

1 participant