fix(cross-links): use codex path shape in fallback error URL#3174
fix(cross-links): use codex path shape in fallback error URL#3174theletterf wants to merge 1 commit intomainfrom
Conversation
When the codex link index can't be fetched (e.g. CI without credentials
to reach the private codex-link-index repo), the cross-link resolver
falls through to an error message containing a best-effort URL to the
repo's links.json. That fallback was hardcoded to the public-S3 layout
`elastic/{scheme}/main/links.json`, so errors against a codex/internal
registry pointed at a non-existent path under codex-link-index.
Thread the per-repo DocSetRegistry through FetchedCrossLinks and pick
the codex layout (`{env}/elastic/{scheme}/links.json`) when the entry
is non-public, keeping the existing S3 layout for public entries.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis pull request extends Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
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. Comment |
Summary
elastic/codex-link-indexrepo), the cross-link resolver falls through to an error message containing a best-effort URL to the repo'slinks.json.elastic/{scheme}/main/links.json, so errors against a codex/internal registry pointed at a non-existent path undercodex-link-index(e.g.https://github.com/elastic/codex-link-index/blob/main/elastic/platform-observability-team/main/links.json), making the error message misleading.DocSetRegistrythroughFetchedCrossLinksand picks the codex layout ({env}/elastic/{scheme}/links.json, e.g.internal/elastic/platform-observability-team/links.json) when the entry is non-public, keeping the existing S3 layout for public entries.Context
Surfaced while debugging elastic/platform-capacity-team#1328, whose preview build fails because its runner can't clone the private
codex-link-indexrepo. That credentials failure (exit 128) is the primary blocker there and isn't addressed here — the consuming workflow needs a token with access tocodex-link-index. But whenever the fetch fails for any reason (rate-limit, rotated token, etc.), the error URL should at least point at a path that exists.Locally the bug almost never surfaces because
CrossLinkFetcher.TryGetCachedLinkReferenceshort-circuits to a cachedlinks.jsonand the git reader is never invoked.Changes
FrozenDictionary<string, DocSetRegistry>? RegistryByRepositorytoFetchedCrossLinks.DocSetConfigurationCrossLinkFetcherfrom eachCrossLinkEntry.Registry.CrossLinkResolver.TryResolvefallback onto registry type via a smallBuildFallbackLinksJsonUrlhelper.Test plan
dotnet test tests/Elastic.Markdown.Tests/Elastic.Markdown.Tests.csproj --filter CrossLinks|Codex— 35/35 pass, including the two newCrossLinkResolverFallbackUrlTests.dotnet test tests/Elastic.Documentation.Configuration.Tests— 353/353 pass.{env}/elastic/{scheme}/links.json) still matches the current layout ofelastic/codex-link-index.🤖 Generated with Claude Code