Skip to content

fix: add missing CLI headers for git credential helper - #1539

Merged
liangshuo-1 merged 1 commit into
larksuite:mainfrom
raistlin042:fix/cli-shortcut-telemetry-null
Jun 23, 2026
Merged

fix: add missing CLI headers for git credential helper#1539
liangshuo-1 merged 1 commit into
larksuite:mainfrom
raistlin042:fix/cli-shortcut-telemetry-null

Conversation

@linchao5102

@linchao5102 linchao5102 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix missing standard CLI headers on requests issued by the apps Git credential helper path.

Changes

  • Add a stable shortcut identity for the Git credential helper path.
  • Attach standard CLI shortcut headers when the helper requests repository credentials.
  • Preserve existing shortcut context when present.
  • Add regression coverage for helper header propagation.

Test Plan

  • Unit tests pass
    • go test -race ./shortcuts/apps -run 'TestFactoryIssuerBranches|TestContextWithGitCredentialHelperShortcutPreservesExistingShortcut' -count=1
    • go test -race ./shortcuts/apps -count=1
  • Git credential workflow verified with a real online app
    • go test -v -count=1 -timeout=5m ./tests/cli_e2e/apps -run 'TestAppsGitCredential'

Related Issues

  • None

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a "reported shortcut" tag to the Git credential factory issuer path. A new constant names the shortcut, a new helper attaches it (with a UUID instance value) to the context only when no shortcut exists, and the factory issuer's DoSDKRequest call is updated to inject the resulting shortcut headers.

Changes

Git credential helper shortcut tagging

Layer / File(s) Summary
Shortcut constant, helper, and factory issuer call site
shortcuts/apps/git_credential.go
Adds gitCredentialHelperReportedShortcut constant and uuid import; implements contextWithGitCredentialHelperShortcut which no-ops if a shortcut is already set, otherwise attaches the constant name with a fresh UUID; updates the factory issuer API call to tag the context and append cmdutil.ShortcutHeaderOpts to DoSDKRequest.
Tests for shortcut header and context preservation
shortcuts/apps/git_credential_test.go
Refactors TestFactoryIssuerBranches to capture the HTTP stub and assert the shortcut and execution-ID headers are present; adds TestContextWithGitCredentialHelperShortcutPreservesExistingShortcut to verify the helper does not overwrite an existing shortcut or execution ID.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • liangshuo-1

Poem

🐰 A shortcut tag hops into the call,
A UUID bounces—unique to all!
If one exists, we leave it in place,
No overwrite, just effortless grace.
The headers now carry the tale of the flow,
Hopping through requests with context aglow! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description follows the required template with all main sections (Summary, Changes, Test Plan, Related Issues) properly filled out with concrete details and test commands.
Title check ✅ Passed The title 'fix: add missing CLI headers for git credential helper' directly and clearly describes the main change - adding missing telemetry headers (X-Cli-Shortcut and X-Cli-Execution-Id) to the git credential helper flow.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit 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 and usage tips.

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@15375b6c96974f5d476e2d6fb822eb4f97ddadd9

🧩 Skill update

npx skills add raistlin042/cli#fix/cli-shortcut-telemetry-null -y -g

@linchao5102
linchao5102 force-pushed the fix/cli-shortcut-telemetry-null branch from fd27484 to 15375b6 Compare June 22, 2026 14:16
@linchao5102 linchao5102 changed the title fix: report git credential helper shortcut telemetry fix: add missing CLI headers for git credential helper Jun 22, 2026
@liangshuo-1
liangshuo-1 merged commit 0991da7 into larksuite:main Jun 23, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants