Skip to content

fix: header blank in serve mode due to INI whitespace and unguarded githubRepository#3363

Open
Mpdreamz wants to merge 1 commit into
mainfrom
fix/github-repository-null-ini-whitespace
Open

fix: header blank in serve mode due to INI whitespace and unguarded githubRepository#3363
Mpdreamz wants to merge 1 commit into
mainfrom
fix/github-repository-null-ini-whitespace

Conversation

@Mpdreamz
Copy link
Copy Markdown
Member

Summary

  • SoftCircuits.IniFileParser preserves leading whitespace from INI values, so reading url = git@github.com:org/repo.git from .git/config yielded " git@github.com:..." (space-prefixed). NormalizeToGitHubPath's StartsWith("git@github.com:") check then failed silently, making GitHubRepository null locally.
  • Razor null-suppression meant <elastic-docs-header> received no github-repository HTML attribute, so r2wc passed undefined to the React component.
  • getDeploymentLinks called githubRepository.includes('/') unconditionally, throwing a TypeError that crashed React's render silently and left the entire header blank in serve mode.

Fix (3 changes):

  • GitCheckoutInformationFactory.cs: add .Trim() to the URL value read from the INI file — consistent with the existing .Trim() already applied to remoteName.
  • DeploymentInfo.tsx: make githubRepository optional; guard getDeploymentLinks and the Repository row against undefined.
  • Header.tsx: make githubRepository and githubLink optional to match reality (Razor omits them when null).

Test plan

  • Run dotnet run --project src/tooling/docs-builder -- serve locally; confirm the header renders with branch/commit button visible
  • Confirm the deployment info popover shows Branch, Commit, and Repository rows
  • Verify no TypeScript errors: npm run compile:check in src/Elastic.Documentation.Site

🤖 Generated with Claude Code

SoftCircuits.IniFileParser preserves leading whitespace in values, so
reading `url = git@github.com:org/repo.git` from .git/config yielded
" git@github.com:..." (space-prefixed). NormalizeToGitHubPath's
StartsWith("git@github.com:") check then failed silently, cascading to
a null GitHubRepository on the C# side and a missing github-repository
HTML attribute on the Razor side.

Razor null-suppression meant the web component received the prop as
undefined rather than an empty string. The TypeScript component called
githubRepository.includes('/') unconditionally, crashing React's
render and leaving <elastic-docs-header> empty in serve mode.

Fix: trim the URL value in BranchTrackingRemote (matching the existing
Trim() already applied to remoteName). Also make githubRepository
optional in the Header/DeploymentInfo web components so missing
repository info degrades gracefully rather than crashing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Mpdreamz Mpdreamz requested a review from a team as a code owner May 20, 2026 14:49
@Mpdreamz Mpdreamz requested a review from technige May 20, 2026 14:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@Mpdreamz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 23 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f1814659-3236-4156-ba21-09eb66934706

📥 Commits

Reviewing files that changed from the base of the PR and between 46d3697 and 3b0eb91.

📒 Files selected for processing (3)
  • src/Elastic.Documentation.Site/Assets/web-components/Header/DeploymentInfo.tsx
  • src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx
  • src/Elastic.Documentation.Tooling/GitCheckoutInformationFactory.cs
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/github-repository-null-ini-whitespace

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant