Skip to content

Skip candidate indexes for stored entity mappings - #1099

Open
zlareb1 wants to merge 1 commit into
mainfrom
fix/entity-preparation-existing-mentions
Open

zlareb1 wants to merge 1 commit into
mainfrom
fix/entity-preparation-existing-mentions

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 21, 2026

Copy link
Copy Markdown
Member

Linked issues and pull requests

None.

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Entity resolution skips candidate-index construction when every mention already has a stored mapping. Writes containing new mentions share one candidate index.

Why

Stored mappings use their saved canonical text and evidence counts without consulting the fuzzy candidate indexes. Constructing those indexes before examining the mentions performs unnecessary work. Preparation happens when the first missing mention needs it, and later missing mentions reuse the result.

Scope and risk

The change moves candidate-index construction inside the existing resolver. The namespace-scoped candidate query, row normalization, evidence weighting, redirects, ranking and persisted fields keep their existing behavior. Unit cases check complete written rows and reuse an empty index as well as a populated one. Validation counts operations; no latency improvement is claimed.

Compatibility, rollout and rollback

  • Wire: no op, field or default changes.
  • Operator steps: none.
  • Rollback: revert the change; no stored-data or schema changes.

Tests

  • A regression on the original source fails both all-existing mapping cases because preparation runs once instead of zero; eight missing/mixed controls pass.
  • .venv/bin/python -m pytest tests/unit/test_entity_resolution.py -q -n 0: 85 passed after the change.
  • Scoped Ruff, formatting, prose and source-preservation checks are recorded with the candidate.
  • Full hosted CI and fresh independent review are required before merge.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated: Codex wrote the change. The resolver call paths, complete row assertions and source-preservation proof were checked.

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

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files: no op, schema, settings or generated-source changes.
  • Migrations: none.
  • Plugin changes: none.
  • Frontend changes: none.
  • Operator steps and wire changes are described above.
  • Added repository text names no host, internal path or ticket.
  • Commits are signed off.

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

vercel Bot commented Nov 21, 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 21, 2026 2:40am 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