Skip to content

test(recall): stop passing removed semantic_seeds into link expansion#2829

Merged
nicoloboschi merged 1 commit into
mainfrom
fix/link-expansion-test-semantic-seeds
Jul 20, 2026
Merged

test(recall): stop passing removed semantic_seeds into link expansion#2829
nicoloboschi merged 1 commit into
mainfrom
fix/link-expansion-test-semantic-seeds

Conversation

@nicoloboschi

Copy link
Copy Markdown
Collaborator

Summary

Fixes the test-api (2/3) failure currently red on main and therefore on every PR whose shard includes this test:

FAILED tests/test_link_expansion_scoring.py::test_activation_preserves_additive_score_across_fact_types
  TypeError: LinkExpansionRetriever.retrieve() got an unexpected keyword argument 'semantic_seeds'

#2683 ("remove unused graph seed inputs") dropped semantic_seeds from retrieve() — Link Expansion deliberately chooses its own bounded seeds, so it doesn't inherit the semantic arm's independent limits and thresholds. The scoring regression test added by #2679 still passed the kwarg.

Fix

Per direction from the code owner: semantic_seeds should not be used anymore, so the test is updated rather than the signature restored.

Removing the kwarg alone isn't sufficient — retrieve() now derives seeds internally via _find_semantic_seeds(conn, ...), and the test's fake connection is a bare object() with no fetch. So the fix stubs that lookup to return the same seed the test previously injected:

async def fake_find_semantic_seeds(_conn, _embedding, _bank_id, fact_type, **_kwargs):
    return [RetrievalResult(id=f"seed-{fact_type}", text="seed", fact_type=fact_type)]

The test's subject — that graph merge order matches Link Expansion's additive per-type score — and every assertion are unchanged:

assert [result.id for result in combined] == ["a", "b"]
assert world_results[0].activation == pytest.approx(math.tanh(0.5) + 0.9 + 0.3)
assert experience_results[0].activation == pytest.approx(math.tanh(1.0) + 0.7)

Testing

  • tests/test_link_expansion_scoring.py — 1 passed.
  • ruff check / ruff format clean.

The skills/hindsight-docs/** hunks are generated output from unrelated docs/integration PRs that landed without regenerating the bundle; the pre-commit generator refuses to commit without them.

#2683 removed the graph seed inputs from LinkExpansionRetriever.retrieve() —
Link Expansion deliberately chooses its own bounded seeds so it doesn't inherit
the semantic arm's limits and thresholds. The scoring regression test from #2679
still passed semantic_seeds=, so it fails on main with

    TypeError: retrieve() got an unexpected keyword argument 'semantic_seeds'

on every PR whose test-api shard includes it.

Drop the kwarg and stub the internal _find_semantic_seeds lookup instead, which
is where seeds now come from. The test's subject — that the graph merge order
matches Link Expansion's additive per-type score — and all of its assertions are
unchanged.

The skills/hindsight-docs hunk is generated output from an unrelated docs PR that
landed without regenerating the bundle; the pre-commit generator requires it.
@nicoloboschi
nicoloboschi merged commit 2142d43 into main Jul 20, 2026
102 checks passed
@nicoloboschi
nicoloboschi deleted the fix/link-expansion-test-semantic-seeds branch July 20, 2026 16:07
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