Skip to content

test: fix two stale unit tests failing on main CI#809

Merged
RaghavChamadiya merged 1 commit into
mainfrom
fix/ci-stale-tests
Jul 12, 2026
Merged

test: fix two stale unit tests failing on main CI#809
RaghavChamadiya merged 1 commit into
mainfrom
fix/ci-stale-tests

Conversation

@swati510

Copy link
Copy Markdown
Collaborator

What

Two unit tests have been failing deterministically on main across Python 3.11/3.12/3.13. Both are stale tests, not source regressions — the underlying behavior changes were intentional; the tests just weren't updated alongside them.

1. test_batch_upsert_graph_edges_updates_existing

assert 1.0 == 0.5

PR #807 (fix(graph): keep max confidence on edge upsert) made _update_graph_edge keep max(existing, new) confidence on collision, so a real call can't be stamped below the flow-calls floor by a later lower-confidence upsert. The test still asserted that a lower re-upsert (0.5) overwrites the default (1.0).

Fix: seed the edge at 0.7, re-upsert at 0.5, and assert confidence holds at 0.7 — directly covering the max-keep contract while still verifying the in-place imported_names_json update.

2. test_hedged_but_named_body_served_holds_medium

assert 'low' == 'medium'

PR #796 added repo_root= and session_factory= keyword args to the _anchor_symbol_hits call site. The test's _fake_anchor stub only accepted the four positional args, so the real call raised TypeError — swallowed by the contextlib.suppress(Exception) around it. Anchoring silently no-op'd, _anchor_symbols was never attached, served_named_body stayed False, and the hedged answer fell to low instead of medium.

Fix: the fake now accepts **kwargs so it matches the real signature.

Test

Both files pass locally (55 tests):

tests/unit/persistence/test_crud_smoke.py .....
tests/unit/server/mcp/test_answer_calibration.py ..................................................
55 passed

Test-only change; no product code touched.

- test_batch_upsert_graph_edges_updates_existing asserted a lower
  re-upsert overwrites confidence, but edge upsert now keeps the max on
  collision (#807). Seed 0.7, re-upsert 0.5, assert it holds at 0.7.
- test_hedged_but_named_body_served_holds_medium stubbed _anchor_symbol_hits
  with the pre-#796 signature; the real call now passes repo_root= and
  session_factory=, so the stub raised TypeError under contextlib.suppress
  and anchoring silently no-op'd. Accept **kwargs in the fake.
@repowise-bot

repowise-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown

✅ Health: 7.6 (unchanged)

📋 At a glance
2 hotspots touched · 5 co-change pairs left out. Scoped to tests.

🔎 More signals (2)

🔥 Hotspots touched (2)

  • .../persistence/test_crud_smoke.py — 1 commits/90d, 1 dependents · primary owner: Swati Ahuja (100%)
  • .../mcp/test_answer_calibration.py — 5 commits/90d, 3 dependents · primary owner: Raghav Chamadiya (67%)

🔗 Hidden coupling (1 file)

  • .../mcp/test_answer_calibration.py co-changes with these files (not in this PR):
    • .../tool_answer/answer.py (4× — 🟢 routine)
    • .../tool_answer/config.py (3× — 🟢 routine)
    • .../tool_answer/symbols.py (3× — 🟢 routine)
    • .../mcp_server/tool_symbol.py (2× — 🟢 routine)
    • .../mcp/test_symbol_range_and_recovery.py (2× — 🟢 routine)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-12 11:31 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya RaghavChamadiya merged commit d3bad2c into main Jul 12, 2026
7 checks passed
@RaghavChamadiya RaghavChamadiya deleted the fix/ci-stale-tests branch July 12, 2026 11:34
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.

2 participants