feat(api): config-selectable default peer-similarity basis (#1469 verifier follow-up) - #1500
Conversation
Issue #1469 required the cosine basis to be selectable via config with Jaccard remaining the default; merged PR #1497 only added a per-request basis query parameter. MANAGER_SIMILARITY_DEFAULT_BASIS now supplies the default, an explicit query parameter still wins, and an unrecognized value warns and falls back to jaccard.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 32 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
Comment |
|
Closer note: CodeRabbit posted "Review limit reached — next review available in 40 minutes" (plus an organization usage spending cap) at 14:51Z, so this PR has no substantive automated review yet. It is intentionally left open rather than merged on green gates alone, because it changes a production request path ( |
|
You're currently rate limited under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. Your next review will be available in 21 minutes. |
Provider Comparison ReportProvider Summary
📋 Full Provider Details (click to expand)openai
anthropic
Agreement
Disagreement
Unique Insights
🔍 LangSmith Traces |
|
Workflow state fingerprint for Agents Verifier. Do not edit. |
Bounded closer follow-up for the one substantive gap in the post-merge verifier comparison on #1497 (source issue #1469). Does not close #1469 — the closer closes that issue after this lands and verifies.
Why
The #1497 provider comparison split:
anthropic/claude-opus-4-6PASS (82%),openai/gpt-5.4CONCERNS (86%, completeness 6/10). Auditing every openai concern against mergedmain(872569b):rg -n basis etl/manager_similarity_flow.pyreturns nothing and there is no env/config knob anywhere; the only selector wasbasis: str = Query("jaccard", ...)on the endpoint. Fixed here.etl/conviction_flow.py:726-747loadscrowded_tradesrows, derivessimilar_manager_countunderSIMILARITY_CROWDING_MIN_SCORE, and emitsAlertEvent(event_type="crowded_trade_change", ...);alerts/engine.py:86evaluates thesimilar_manager_count_gtecondition against that payload. It reusesalert_rules/crowded_tradesexactly as the issue's Non-Goals require.tests/test_alert_engine.py:130-169asserts the inclusive boundary fires (threshold3, count3→ "Crowding Rule") and that a fractional threshold does not fire spuriously (threshold3.9, count3→ still only "Crowding Rule"). An off-by-one in either direction breaks one of those two assertions.basiscolumn or a score pair"; the flow writes both scores on the same row (etl/manager_similarity_flow.py:90-96),cosineis nullable, and the endpoint skips rows whose selected score is NULL or non-finite.Also cross-checked the first half of acceptance criterion 1: the hand-computed cosine assertion exists —
tests/test_manager_similarity_flow.py:43assertscosine_similarity([1.0, 1.0], [1.0, 0.0]) == pytest.approx(1 / 2**0.5).So one real gap remained: "basis is config-selectable (Jaccard remains default)."
Change
MANAGER_SIMILARITY_DEFAULT_BASIS(documented in.env.example) now supplies the default basis forGET /managers/{id}/similar.basis: str | None = Query(None, pattern="^(jaccard|cosine)$")); an explicit value still wins over configuration, and an invalid value is still rejected with 400 by the same pattern.jaccard— Jaccard remains the default in every unconfigured and misconfigured case.Test gate
pytest -o addopts= tests/test_manager_similarity_flow.py tests/test_env_example_coverage.py= 7 passed, including the newtest_similar_manager_default_basis_is_config_selectable, which covers: unset env →jaccard;MANAGER_SIMILARITY_DEFAULT_BASIS=cosine→ cosine ordering (manager_id2, score 0.8); explicitbasis=jaccardoverriding a cosine config; and=euclidean→ warn +jaccard.Deliberate-break demonstration: replacing
basis = basis or _configured_similarity_basis()withbasis = basis or "jaccard"fails the new gate —FAILED tests/test_manager_similarity_flow.py::test_similar_manager_default_basis_is_config_selectable,AssertionError: assert 'jaccard' == 'cosine'(1 failed, 4 passed). The break was reverted and the suite re-run green.Wider check:
pytest -o addopts= tests/test_manager_similarity_flow.py tests/test_env_example_coverage.py tests/test_signals_api.py tests/test_alert_engine.py tests/test_crowded_contrarian.py tests/test_conviction_flow.py= 45 passed, 1 failed — the single failure istest_conviction_flow.py::test_conviction_deployment_nightly_utc_schedule, the pre-existing cross-file reload leak onmainthat PR #1499 fixes (it fails onmaintoo and is unrelated to this change).ruff checkclean;black --checkclean;git diff --checkclean.