Skip to content

Grep prefers files with lessons for matched definitions - #1433

Merged
zlareb1 merged 2 commits into
mainfrom
fix/grep-lesson-anchor-paths
Nov 25, 2026
Merged

zlareb1 merged 2 commits into
mainfrom
fix/grep-lesson-anchor-paths

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Changelog category

  • Bug Fix

Changelog entry

Indexed grep prefers files with current lessons linked to matched definitions when choosing which files to read for lessons.

Why

Grep chose files for the lesson read in source order. A response could include an exact definition and omit its linked lesson when earlier files used every slot.

Scope and risk

On trunk, check links to named matches against the indexed revisions and eligible memory heads. The metadata reads use the same visibility checks as memory.for_file and never load memory values. Both statements share part of the existing enrichment deadline and have result bounds. A verification failure keeps the original file order. The normal lesson read checks memory state again before serving excerpts.

Compatibility, rollout and rollback

  • Wire. Existing request and response fields.
  • Operator steps. None.
  • Rollback. Revert the grep lesson path preference.

Tests

  • Four focused ClickHouse cases cover a linked definition beyond the file slice and retained links to deleted and high-sensitivity memories.
  • Two captured requests replay on both code index tiers. Each returns the previously omitted fresh lesson with the same source matches and definitions.
  • The query log confirms two bounded metadata statements per replay. They took 6 ms combined on that fixture.
  • Lint, formatting and type checks pass.

AI assistance in the code

  • AI-generated with Codex. Checked scoped visibility, revision matching, active memory heads and the shared deadline.
  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Local format, lint and type checks for this change pass. Focused integration tests pass.
  • Documentation covers file selection.
  • Commits are signed off.

A source-ordered file slice can omit a current link for an exact result. Verify links and their revisions before selecting the lesson files.

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 8:42am UTC
loom-telemetry Ready Ready Preview Nov 25, 2026 8:42am UTC

Request Review

Use bounded reads of link and memory metadata so a deleted or high-sensitivity row cannot displace a readable lesson.

Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
@zlareb1
zlareb1 merged commit c8be22c into main Nov 25, 2026
70 of 74 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.

1 participant