Skip to content

Fix artifact title generation on client side#251

Open
Dev10-sys wants to merge 2 commits intodbpedia:masterfrom
Dev10-sys:fix-artifact-title
Open

Fix artifact title generation on client side#251
Dev10-sys wants to merge 2 commits intodbpedia:masterfrom
Dev10-sys:fix-artifact-title

Conversation

@Dev10-sys
Copy link

@Dev10-sys Dev10-sys commented Jan 23, 2026

Fixes #243

Normalize artifact titles on the client side so that version and content variant strings are not unintentionally included in the displayed title.

Summary by CodeRabbit

  • Bug Fixes
    • Improved search result reliability by ensuring documents without titles display a sensible fallback title and by inferring resource types so results show clearer labels.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

Adds runtime normalization to ensure fetched documents have a title. For docs missing title, the handler sets title from the document id by extracting the last path segment (or the full id if no path segments).

Changes

Cohort / File(s) Summary
Runtime Title Normalization
public/js/search/search-adapter.js
In the lookup response handler, populate missing d.title from d.id by using the last path segment (fallback to the full id), then call SearchAdapter.inferResourceTypes(docs); whitespace/formatting adjustments only otherwise.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing artifact title generation on the client side, which aligns with the primary objective.
Linked Issues check ✅ Passed The code adds title normalization logic that derives clean titles from artifact IDs/URIs, directly addressing issue #243's requirement to prevent unwanted inclusion of version and content variant components in displayed titles.
Out of Scope Changes check ✅ Passed All changes are focused on client-side title normalization in the search adapter, directly supporting the stated objective of fixing artifact title generation without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@public/js/search/search-adapter.js`:
- Around line 35-44: The loop in the SearchAdapter response handler (where
docs.forEach and d.id splitting occurs) incorrectly assumes d.id.split("/")[1]
exists; update the logic to guard against absolute URIs and short IDs by: check
that d.id is a non-empty string, ignore URL schemes (e.g., startsWith("http://")
or "https://") or treat them by taking the last path segment, split on "/" and
use the last non-empty segment only if present, and if that still yields nothing
fall back to using the full d.id (or a safe decoded form) as the title so titles
are never left undefined; apply this change inside the docs.forEach callback in
the SearchAdapter response processing.

@Dev10-sys
Copy link
Author

Good catch. Updated the title derivation to safely handle absolute URIs and short IDs by normalizing path segments with a fallback.

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.

Artifact title gets a funny auto-generated result on the client side

1 participant