Skip to content

Code enrichment reads candidate limits from settings - #1503

Open
zlareb1 wants to merge 1 commit into
mainfrom
fix/ci-edit-context-candidate-bounds
Open

zlareb1 wants to merge 1 commit into
mainfrom
fix/ci-edit-context-candidate-bounds

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Related: #1499

Changelog category

  • CI Fix or Improvement

Why

test_no_new_tunable_constant rejects the two module-level bounds on candidate reads in enrich.py. Declaring them in the settings catalog makes the bounds visible to operators and validates them before they reach the edge queries. Failed unit job

Scope and risk

Usage examples read 50 candidate call sites by default. Indirect test lookup reads up to 60 call sites and ranks backups from up to 30 callers. The settings accept positive values that fit the query's unsigned integer limit, including the doubled bound on indirect call sites.

Compatibility, rollout and rollback

Both settings are optional. Builds that include this change accept LOOM_CODE_ENRICH_EXAMPLE_CANDIDATE_LIMIT and LOOM_CODE_ENRICH_INDIRECT_TEST_CALLER_LIMIT. Reverting restores the fixed limits. Earlier builds warn when the settings file contains either key.

Tests

  • pytest -q tests/unit/test_tunable_constants.py::test_no_new_tunable_constant rejects both constants on clean main and passes with this change.
  • make format-check lint typecheck
  • 471 focused tests cover candidate selection, configuration, generated references, and documentation links.
  • A focused query probe verifies configured candidate limits, including the doubled indirect limit and rejection of out-of-range values.

AI assistance in the code

  • AI-generated. Codex wrote the change and reproduced the unit failure before checking the repair.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint, type checks and focused tests pass.
  • The settings reference, schema, example file and default snapshot are regenerated.
  • The commit is signed off.

Note

Low Risk
Refactor of existing limits into configuration with the same defaults; no auth or data-path changes, only tunable bounds on enrichment queries.

Overview
Moves two hardcoded enrichment bounds out of enrich.py into the settings catalog so operators can tune them and CI’s test_no_new_tunable_constant stops failing.

code_enrich_example_candidate_limit (default 50) caps incoming call sites considered when ranking usage examples. code_enrich_indirect_test_caller_limit (default 30) caps indirect test callers used as backups; edge queries still fetch up to twice that value. Behavior at defaults matches the previous module constants.

Settings schema, reference docs, example YAML, and the defaults snapshot are updated. These knobs require restart (not live-reload).

Reviewed by Cursor Bugbot for commit df2bd74. Bugbot is set up for automated code reviews on this repo. Configure here.

The unit gate rejects module-level candidate bounds. Validate both limits in the settings catalog before using them in edge queries.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 25, 2026 10:41pm UTC
loom-telemetry Ready Ready Preview Nov 25, 2026 10:41pm UTC

Request Review

This branch has not been deployed

No deployments
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.

1 participant