Skip to content

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

Merged
stephantul merged 1 commit into
MinishLab:mainfrom
TommyC81:feat/configurable-max-file-size
Aug 25, 2026
Merged

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

Conversation

@TommyC81

Copy link
Copy Markdown
Contributor

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: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "feat: make max file size configurable vi..." | Re-trigger Greptile

Comment thread src/semble/cli.py Outdated
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
Contributor 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.

@stephantul

Copy link
Copy Markdown
Contributor

@TommyC81 sorry for not getting back to you on this. It looks good to me, making greptile do a final pass.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/semble/cli.py 100.00% <100.00%> (ø)
src/semble/index/create.py 100.00% <100.00%> (ø)
src/semble/index/files.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stephantul
stephantul merged commit 9bb38fd into MinishLab:main Aug 25, 2026
17 checks passed
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

2 participants