Skip to content

Keep every registry row when curated servers lead a first page - #173

Merged
M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/sr023-curated-lead-keeps-rows
Nov 11, 2026
Merged

M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/sr023-curated-lead-keeps-rows

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Contributor

Summary

lead_with_curated put the curated servers matching a query at the head of page one, then cut the page back to page_size. Page two continues from the registry's own cursor, so each registry row pushed off page one appeared on no page at all: a matching server silently went missing from the results.

A registry page (live or cached) is no longer cut. It may run longer by the curated servers it adds, and every registry row appears exactly once across pages. The local fallback served when the registry is down is one bounded page with nothing after it, so it keeps its page-size cap, as before.

Related issue

None filed. Found by reading the official-registry search path.

API or behavior changes

On a live first page with a query matching curated servers, the page can hold more than page_size rows: the registry's rows plus the curated ones it added. No contract change.

Validation

On our Linux CI runner, at e0784e8:

  • cargo fmt --all -- --check: clean.
  • cargo clippy --all-targets --all-features -- -D warnings: 0 errors on this branch and on main.
  • cargo build --all-targets --all-features: ok.
  • cargo test -p tinymcp registry::sources::official: 150 passed, 0 failed.
  • cargo test --workspace: no failures unique to this branch. The same flaky boot and directories tests fail on main too (main: 5 failed; this branch: 4).
  • Red control: cutting page one back to 2 rows after the curated lead fails every_registry_row_appears_exactly_once_across_pages_when_a_curated_server_leads, with @acme/slack-b missing.

Tests

  • every_registry_row_appears_exactly_once_across_pages_when_a_curated_server_leads uses a loopback registry with two pages of two rows. Across pages 1 and 2 every registry row appears once, and the curated server once.
  • a_curated_lead_keeps_every_registry_row_on_the_page replaces the old truncation test.
  • a_page_with_nothing_after_it_is_cut_back_to_its_cap checks the cut is kept for the fallback. The existing a_local_match_is_capped_at_the_page_size still passes.
  • Red control: cutting page one back to 2 rows fails the across-pages test.

Documentation

The rustdoc on lead_with_curated.

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

lead_with_curated put the curated servers matching a query at the head of
page one, then cut the page back to page_size. Page two continues from the
registry's own cursor, so each registry row pushed off page one appeared
on no page at all: a matching server was silently missing from the
results.

A registry page (live or cached) is no longer cut. It may run longer by
the curated servers it adds, and every registry row still appears exactly
once across pages. The local fallback served when the registry is down is
one bounded page with nothing after it, so it keeps its page-size cap, as
before.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e26ca14-27ca-4c46-89db-632db0a09c05
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@tinysweeper

tinysweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: e655ecd895c9cee8cc76b0953293249d859f37f6

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 2 of 2 files.
Pull request purpose (title): Keep every registry…

Diagnostics and supporting details

Full summary

Pull request purpose (title): Keep every registry row when curated servers lead a first page. Pull request purpose (title): "Keep every registry row when curated servers lead a first page." This pull request fixes a silent data-loss bug in the official-registry search path: `lead_with_curated` prepended curated servers to page one and then truncated the page back to `page_size`, so registry rows pushed off page one appeared on no page at all, because page two continues from the registry's own cursor. The change makes the truncation cap optional: a live or cached registry page is no longer cut and may run longer by the curated rows it adds, while the local fallback — a single bounded page with nothing after it — keeps its page-size cap. The latest-push-delta evidence is unavailable, so no push delta is described and the diff below is the whole pull-request diff.

Review snapshot

Change surface Files Review signal Count
Production 1 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: Test coverage is assessed from changed tests and lane evidence; execution is not claimed without trusted check data.

What changed

`lead_with_curated` now takes `cap: Option<usize>` in place of `page_size: u32` and only truncates the merged page when a cap is supplied. The caller in `McpOfficialRegistry`'s search path supplies a cap only when `found.freshness == RegistryFreshness::LocalFallback`, computed as `usize::try_from(page_size.max(1)).unwrap_or(usize::MAX)`; other freshness values yield `None`, so live and cached registry pages keep every registry row alongside the curated lead. The rustdoc was rewritten to explain that a registry page is followed by its cursor while only a page with nothing after it is cut. Tests were updated to the new signature and extended with a two-page loopback-registry test and a cap test; the description also records a red control in which cutting page one back to 2 rows drops `@acme/slack-b`.

Features

  • Modified — Optional page cap in `lead_with_curated`: The function no longer unconditionally truncates the merged page; truncation happens only when a cap is passed, so a registry page retains every registry row alongside the curated lead instead of pushing rows past the cursor boundary where they are never shown. (crates/tinymcp/src/registry/sources/official/mod.rs fn lead_with_curated(servers: &mut Vec<RegistryServerSummary>, query: &str, page)
  • Modified — Cap applied only to the local-fallback page: The search path derives the cap from `RegistryFreshness::LocalFallback`, so the bounded fallback page keeps its page-size limit while live and cached registry pages are left uncut and continue via the registry's cursor; page one can therefore hold more than `page_size` rows when a query matches curated servers, with no contract change. (crates/tinymcp/src/registry/sources/official/mod.rs fn served(, crates/tinymcp/src/registry/sources/official/mod.rs impl McpOfficialRegistry {)

Tests

  • modification — Replaces the old truncation test: with `cap = None`, a curated lead keeps every registry row on the page (`com.slack/mcp`, `@acme/slack`, `@acme/slack-2`).: Pins the uncapped branch of the new `cap` parameter. (crates/tinymcp/src/registry/sources/official/mod_tests.rs fn a_curated_lead_stays_within_the_page_size() {)
  • addition — With `cap = Some(2)`, the merged page is cut back to two rows (`com.slack/mcp`, `@acme/slack`).: Pins the capped branch, matching the local-fallback behavior; the description states the existing `a_local_match_is_capped_at_the_page_size` still passes. (crates/tinymcp/src/registry/sources/official/mod_tests.rs fn a_curated_lead_stays_within_the_page_size() {)

Findings

No active actionable findings.

Before merge

None.

How this fits together

flowchart LR
  n0["lead_with_curated<br/>changed"]:::changed
  n1["served<br/>changed"]:::changed
  n2["a_blank_query_leaves_the_page_alone<br/>changed"]:::changed
  n3["a_curated_lead_stays_within_the_page_size<br/>changed"]:::changed
  n4["...age_moves_to_the_head_as_the_registry_row<br/>changed"]:::changed
  n5["summaries"]:::impacted
  n6["...ds_a_page_row_matching_on_its_description"]:::impacted
  n7["...d_as_a_page_row_and_a_detail_appears_once"]:::impacted
  n8["search_live"]:::impacted
  n9["CursorCache"]:::impacted
  n1 -->|uses| n9
  n2 -->|calls| n0
  n2 -->|tests| n0
  n2 -->|calls| n5
  n2 -->|tests| n5
  n3 -->|calls| n0
  n3 -->|tests| n0
  n3 -->|calls| n5
  n3 -->|tests| n5
  n4 -->|calls| n0
  n4 -->|tests| n0
  n4 -->|calls| n5
  n4 -->|tests| n5
  n8 -->|calls| n1
  n8 -->|uses| n9
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading
Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The critique lane answered with no findings, judging the change correct as written: live registry pages are no longer truncated so no registry row is lost, the one-shot local fallback is still cut back, and the stale-cache path already serves a page bounded by the registry's own row set.
  • Lane summary: The curated-lead change is correct as written: live registry pages are no longer truncated, so no registry row is lost when page one gains a curated row and page two continues from the registry's own cursor, while the one-shot local-fallback page (`RegistryFreshness::LocalFallback`, always `total_pages: 1`) is still cut back to the requested page size. The stale-cache path already serves a page bounded by the registry's own row set, so dropping its truncation loses nothing, and the rewritten and new tests (including the two-page cursor walk) exercise both behaviours. I found no reportable defects.

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: The change makes `lead_with_curated` take an optional cap: live/cached registry pages keep every row so a curated lead cannot push a registry row past the cursor boundary, while the single-page local fallback is still cut to `page_size`. Every call site and the affected tests were updated consistently, the new cross-page test exercises the exact regression being fixed, and I found no untrusted-input, auth, network, or repository-rule problems introduced by this diff.

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The tests lane answered with no findings; it notes the live path is pinned by the page-walking test, while the freshness-to-cap wiring is exercised only indirectly by a unit test that passes `Some(2)` by hand.
  • Lane summary: The change deliberately stops truncating a live registry page to `page_size` so a curated lead cannot push a registry row off page one forever, and only truncates the bounded local-fallback page. The new page-walking test genuinely fails under the old truncation (page one would lose `@acme/slack-b`), so the live path is pinned; the fallback side of the new `cap` decision is only exercised by a unit test that passes `Some(2)` by hand, so the freshness-to-cap wiring itself is not covered by anything in the diff.

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane answered with no findings, reporting no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The description lane answered with no findings, reporting that the description matches the diff — the optional cap supplied only for `RegistryFreshness::LocalFallback`, the rewritten rustdoc, and the renamed/extended tests — and that only the CI results are unverifiable from the diff.
  • Lane summary: The description matches the diff: `lead_with_curated` now takes an optional cap that is only supplied for `RegistryFreshness::LocalFallback`, the rustdoc is rewritten to explain why a registry page is no longer cut, and the tests are renamed/extended exactly as the body says, including the new two-page loopback test. I found no defect in the change itself; the only unverifiable claims are the CI results and the contents of `CURATED_SERVERS`, which the diff does not touch.
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.011124
  • Tokens: 249460 input · 44823 output · 120062 cached · 319 embedding
  • Updated: 2026-11-11T12:53:44Z
Head State Pass summary
e0784e8d0e53 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-11-11T11:20:20Z)
e655ecd895c9 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-11-11T12:53:44Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0023

@M3gA-Mind
M3gA-Mind merged commit 6f91d27 into tinyhumansai:main Nov 11, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant