Skip to content

Search: guard navigation_* rank features against penalty default#3607

Open
Mpdreamz wants to merge 1 commit into
mainfrom
relevance/navigation-guard-tests
Open

Search: guard navigation_* rank features against penalty default#3607
Mpdreamz wants to merge 1 commit into
mainfrom
relevance/navigation-guard-tests

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

  • navigation_depth/navigation_table_of_contents are rank_feature fields with NEGATIVE score impact; the shared search contract defaults missing values to 50, which is a penalty. Add regression tests locking in that CommonEnrichments always assigns explicit, non-default values — across a landing/root page, a release-notes root, a section node, a deep leaf page, and the OpenAPI path where there's no navigation item at all.
  • Writing those tests surfaced a real bug: the API navigation_section override checked doc.Type == "api", but DocumentationDocument.Type is a fixed CLR/$type discriminator that always returns "docs"OpenApiDocumentExporter actually sets ContentType = "api". The override could never fire, so API reference pages never got navigation_section = "api". Fixed to check doc.ContentType instead.
  • CommonEnrichments changed from private to internal (InternalsVisibleTo already grants Elastic.Markdown.Tests access) so it can be exercised directly with lightweight navigation fakes instead of a full markdown build.

Test plan

  • dotnet test tests/Elastic.Markdown.Tests — new NavigationEnrichmentTests (6/6 pass)
  • Full Elastic.Markdown.Tests suite run; 14 pre-existing failures are unrelated ScopedFileSystem/git-checkout tests failing in this worktree environment, not touched by this change
  • dotnet format / lint clean (pre-push hook passed)

…ty default

navigation_depth and navigation_table_of_contents are rank_feature
fields with NEGATIVE score impact; the shared contract defaults
missing values to 50, which is a penalty. Add regression tests
asserting CommonEnrichments always assigns explicit, non-default
values across every navigation shape it's called with (root, node,
leaf, and the null-navigation OpenAPI path).

Writing these tests surfaced a real bug: the API navigation_section
override checked doc.Type == "api", but DocumentationDocument.Type
is a fixed CLR/$type discriminator that always returns "docs" —
OpenApiDocumentExporter actually sets ContentType = "api". The
override could never fire. Fixed to check doc.ContentType instead.

CommonEnrichments is changed from private to internal (with
InternalsVisibleTo already granted to Elastic.Markdown.Tests) so it
can be exercised directly without spinning up a full markdown build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Mpdreamz Mpdreamz requested a review from a team as a code owner July 2, 2026 19:17
@Mpdreamz Mpdreamz requested a review from reakaleek July 2, 2026 19:17
@Mpdreamz Mpdreamz temporarily deployed to integration-tests July 2, 2026 19:17 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Mpdreamz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a131ba7a-dc1a-4f47-80e2-37e65dc47cdb

📥 Commits

Reviewing files that changed from the base of the PR and between f3410ff and d82473e.

📒 Files selected for processing (2)
  • src/Elastic.Markdown/Exporters/Elasticsearch/ElasticsearchMarkdownExporter.Export.cs
  • tests/Elastic.Markdown.Tests/Search/NavigationEnrichmentTests.cs
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch relevance/navigation-guard-tests

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.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Label error. Requires exactly 1 of: automation, breaking, bug, changelog:skip, chore, ci, dependencies, documentation, enhancement, feature, fix, redesign. Found:

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