Skip to content

test(discovery): fix stale test left behind by #941's nvidia_nim/nvidia_nim_sub independence fix - #947

Closed
seonghobae wants to merge 1 commit into
mainfrom
fix/discovery-bootstrap-selection-stale-test
Closed

test(discovery): fix stale test left behind by #941's nvidia_nim/nvidia_nim_sub independence fix#947
seonghobae wants to merge 1 commit into
mainfrom
fix/discovery-bootstrap-selection-stale-test

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #941 ("fix(discovery): keep credential accounts independent"), which removed model_discovery._provider_family's collapsing of nvidia_nim/nvidia_nim_sub into one "outage domain" family. That collapse was itself an unverified premise (no evidence in this repo ever compared what the two NVIDIA NIM KV credentials' /v1/models calls actually return; docs/planning/adrs/0015-durable-provider-catalog.md, accepted 2026-08-22, already recorded the opposite: "NVIDIA primary and secondary keys are independent provider accounts"). #941 fixed the production code and every test file its own _provider_family grep found.

One test was missed because it asserts the old collapsed behavior by outcome, not by referencing _provider_family by name:

  • tests/test_discovery_bootstrap_selection.py::test_bootstrap_selector_treats_nim_primary_and_sub_as_one_outage_domain still asserted select_bootstrap_discovered_agents([nim_sub, openrouter, nim_primary], price_book, 2) == [nim_primary, openrouter] — i.e. that nim_sub (the second-cheapest candidate overall) gets displaced by an unrelated, costlier provider to preserve "family" diversity. That's exactly the pool-shrinking result fix(discovery): keep credential catalogs independent #941 was meant to eliminate.

This left main itself red — verified directly against commit 42da1d53 (the #941 merge commit) in an isolated git worktree, independent of any other local branch state:

FAILED tests/test_discovery_bootstrap_selection.py::test_bootstrap_selector_treats_nim_primary_and_sub_as_one_outage_domain
AssertionError: assert [nim_primary, nim_sub] == [nim_primary, openrouter]

Since it's inherited breakage on main, it fails the full-suite check on every open PR that merges/rebases onto current main, not just this repo's own CI.

Fix

Renamed to test_bootstrap_selector_keeps_nim_primary_and_sub_independent and corrected the assertion to [nim_primary, nim_sub], matching select_bootstrap_discovered_agents's actual behavior since #941 merged (both NVIDIA credentials now win their own diversity-guaranteed slot ahead of the unrelated, costlier openrouter candidate). Also appended a dated entry to docs/product-technical-gap-baseline.md recording the gap and the fix, per this repo's append-only convention.

No production code changed — _provider_family no longer exists anywhere in the source tree per #941, and a full-repo grep confirms no other test still references the removed collapsing behavior.

Verification

  • Verify-revert: reverting this test to main's current content reproduces the exact failure above; the fix passes.
  • Targeted: tests/test_discovery_bootstrap_selection.py — 14 passed.
  • Full suite on this worktree (origin/main @ 42da1d53 + only this change): PYTHONPATH=. coverage run -m pytest tests -q2817 passed, 1 skipped, 1 failed. The one remaining failure (tests/test_psychometric_routing.py::test_fast_mlsirm_fit_uses_judge_acceptance_item_for_context_score, ModuleNotFoundError: No module named 'fast_mlsirm') is a pre-existing, unrelated sandbox/environment gap (missing fast_mlsirm/numpy), not caused by this change.
  • interrogate: 100%.

Test plan

  • tests/test_discovery_bootstrap_selection.py passes
  • Full python -m pytest tests -q clean except the pre-existing fast_mlsirm environment gap
  • interrogate 100%
  • Verify-revert: old assertion fails against current main, new assertion passes
  • Full-repo grep confirms no other stale _provider_family/outage-domain references remain

🤖 Generated with Claude Code

https://claude.ai/code/session_015Gs7KmNvH75nxz1sL8mKjw


Generated by Claude Code


Devin Review

…vidia_nim_sub independence fix

PR #941 (merged) removed model_discovery._provider_family and its
nvidia_nim/nvidia_nim_sub collapsing, correctly updating every test that
referenced _provider_family by name. tests/test_discovery_bootstrap_selection.py
was missed because its test asserts the collapsed behavior by outcome, not
by name: test_bootstrap_selector_treats_nim_primary_and_sub_as_one_outage_domain
still asserted select_bootstrap_discovered_agents(...) == [nim_primary,
openrouter], i.e. that nim_sub gets displaced by an unrelated provider to
preserve "family" diversity -- the exact pool-shrinking result #941 was
meant to eliminate. This left the test failing on main itself (verified
directly against commit 42da1d5, the #941 merge commit, in an isolated
worktree) and therefore failing the full-suite check on every open PR that
merges/rebases onto current main.

Root of the original premise: nvidia_nim and nvidia_nim_sub were collapsed
into one "outage domain" on the unverified assumption that both KV
credentials (NVIDIA_NIM_API_KEY / NVIDIA_NIM_API_KEY_SUB) expose the
identical NVIDIA NIM model catalog. That was never checked against live
evidence -- two different API keys hitting the same /v1/models URL does
not guarantee the same result set -- and docs/planning/adrs/0015 already
recorded the opposite: "NVIDIA primary and secondary keys are independent
provider accounts." #941 independently reached the same conclusion and
fixed the production code and five other test files; this fixes the sixth.

Renamed to test_bootstrap_selector_keeps_nim_primary_and_sub_independent
and corrected the assertion to [nim_primary, nim_sub], matching
select_bootstrap_discovered_agents' actual behavior since #941 merged.
Verify-revert checked: reverting this test to main's current content
reproduces the exact failure; the fix passes. Full suite on this worktree
(origin/main @ 42da1d5 + this one-file change): 2817 passed, 1 skipped,
1 failed (tests/test_psychometric_routing.py's fast_mlsirm ModuleNotFoundError
-- a pre-existing, unrelated environment gap, not caused by this change).
interrogate: 100%.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Gs7KmNvH75nxz1sL8mKjw
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 37 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 834ebd12-15d2-4c3e-aa95-4b39426e6eb6

📥 Commits

Reviewing files that changed from the base of the PR and between 42da1d5 and 90c5689.

📒 Files selected for processing (2)
  • docs/product-technical-gap-baseline.md
  • tests/test_discovery_bootstrap_selection.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

seonghobae pushed a commit that referenced this pull request Aug 31, 2026
PR #942's "Full unit and contract suite" check was failing at every push --
not from anything #942 touches, but from a pre-existing stale test on main
itself: tests/test_discovery_bootstrap_selection.py::
test_bootstrap_selector_treats_nim_primary_and_sub_as_one_outage_domain still
asserted the collapsed-family behavior PR #941 (merged) deliberately removed
from select_bootstrap_discovered_agents. #941 updated every test file its own
_provider_family grep found; this one was missed because it asserts the
collapsed behavior by outcome ([nim_primary, openrouter]), not by referencing
_provider_family by name.

Independently verified before porting: _provider_family no longer exists
anywhere in contextual_orchestrator/model_discovery.py on this branch, and
running this exact test against this branch (before this commit) reproduces
the failure -- confirming it is a pre-existing gap on main, not caused by
this PR's diff, and identical to what was failing on every other open PR
merging against current main.

Ports the identical fix already reviewed and verified in
contextual-orchestrator#947 (branch fix/discovery-bootstrap-selection-stale-
test, commit 90c5689) rather than blocking
on that PR merging first, per the drive-to-green policy: renames the test to
test_bootstrap_selector_keeps_nim_primary_and_sub_independent and corrects
the assertion to [nim_primary, nim_sub], plus the matching gap-baseline doc
entry. No production code touched. This will no-op once #947 lands on main.

tests/test_discovery_bootstrap_selection.py -q: 14 passed (was 13 passed, 1
failed before this commit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Gs7KmNvH75nxz1sL8mKjw

Copy link
Copy Markdown
Contributor Author

Superseded — closing without merging. A concurrent PR, #945 ("fix(test): update stale NIM outage-domain test to match #941's independent-account contract"), fixed the exact same stale test and merged to main at commit bffbc72d/0adca470 a few minutes after this PR opened. I compared origin/main's current version of tests/test_discovery_bootstrap_selection.py against this PR's diff: both correct the same assertion to [nim_primary, nim_sub], and #945's version (renamed to test_bootstrap_selector_keeps_nim_primary_and_sub_credential_accounts_independent, with a docstring citing ADR 0032 and the gap-baseline doc) is equally correct and already carries the fix org-wide. This PR's mergeable_state had gone to dirty against main as a direct result — expected, since two independent fixes touched the same lines.

No further action needed here; the underlying CI-red issue this PR targeted is already resolved on main.


Generated by Claude Code

@seonghobae seonghobae closed this Aug 31, 2026
seonghobae pushed a commit that referenced this pull request Aug 31, 2026
Brings in #945's already-merged, authoritative fix for the stale
test_bootstrap_selector_treats_nim_primary_and_sub_as_one_outage_domain
(main @ bffbc72, merged via 0adca47) instead of keeping this branch's own
port of the equivalent #947 fix, which #945 beat to main and #947 was then
closed as superseded. Conflict in tests/test_discovery_bootstrap_selection.py
resolved by taking main's version of that one test function entirely
(git checkout --theirs) rather than reconciling two different renames of the
same fix. Added a short "Update" note to this branch's earlier
docs/product-technical-gap-baseline.md entry recording that #945 landed
first; no other file conflicted.

tests/test_discovery_bootstrap_selection.py -q: 14 passed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Gs7KmNvH75nxz1sL8mKjw
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