Skip to content

feat(codeTracking): add custom apiEndpoint and token configuration#172

Merged
AnnatarHe merged 1 commit intomainfrom
feat/codetracking-custom-endpoint-token
Dec 28, 2025
Merged

feat(codeTracking): add custom apiEndpoint and token configuration#172
AnnatarHe merged 1 commit intomainfrom
feat/codetracking-custom-endpoint-token

Conversation

@AnnatarHe
Copy link
Copy Markdown
Contributor

Summary

  • Add apiEndpoint and token fields to [codeTracking] configuration
  • When set, heartbeat data uses these values instead of global configuration
  • Allows sending coding activity to a different server or authenticating with a separate token

Test plan

  • Added unit tests for custom endpoint/token configuration
  • Added tests for partial configuration (only endpoint or only token)
  • Added tests for local config override
  • All existing tests pass
  • Build succeeds

🤖 Generated with Claude Code

Allow users to configure a separate API endpoint and token for coding
activity heartbeats under [codeTracking]. When set, heartbeat data will
use these values instead of the global configuration, enabling users to
send coding activity to a different server or authenticate separately.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AnnatarHe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the codeTracking feature by enabling users to configure a custom API endpoint and authentication token specifically for sending coding activity heartbeats. This allows for more granular control over where and how heartbeat data is transmitted, supporting scenarios where a separate server or authentication mechanism is desired for tracking coding activity, independent of the main application's global settings.

Highlights

  • Custom API Endpoint and Token for Code Tracking: Introduced apiEndpoint and token fields within the [codeTracking] configuration section, allowing users to specify a dedicated API endpoint and authentication token for sending coding activity heartbeats.
  • Override Global Configuration: When custom apiEndpoint or token values are set under [codeTracking], heartbeat data will utilize these specific values instead of the global application configuration, providing greater flexibility.
  • Documentation Update: The docs/CONFIG.md file has been updated to clearly document the new apiEndpoint and token options for codeTracking, including examples and explanations of their purpose.
  • Enhanced Test Coverage: New unit tests have been added to model/config_test.go to thoroughly validate the functionality of custom endpoint/token configurations, covering full and partial settings, as well as local configuration overrides.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 28, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
model/api_heartbeat.go 0.00% 9 Missing ⚠️
Flag Coverage Δ
unittests 19.88% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
model/api_heartbeat.go 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a useful feature to allow custom API endpoints and tokens for code tracking heartbeats, overriding the global configuration. The implementation looks solid, with good separation of concerns where the config is read and then used. The changes are well-documented in CONFIG.md and thoroughly tested with new unit tests covering various scenarios, including full, partial, and local override configurations. I've made a few minor suggestions to improve code formatting and test comment clarity, but overall this is a great addition.

Comment thread model/config_test.go
enabled = true
apiEndpoint = 'https://api.custom.com'`,
expectedAPIEndpoint: "https://api.custom.com",
expectedToken: "", // empty, should fall back to global
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This comment is slightly misleading. This test correctly verifies that config.CodeTracking.Token is empty when not provided in the config. However, it doesn't test the fallback behavior itself, which happens in SendHeartbeatsToServer. A clearer comment might be // empty, as it's not set in this config to avoid confusion about the scope of this test case.

Comment thread model/config_test.go
[codeTracking]
enabled = true
token = 'custom-token'`,
expectedAPIEndpoint: "", // empty, should fall back to global
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the previous test case, this comment could be misinterpreted. This test verifies that config.CodeTracking.APIEndpoint is empty, but the fallback to the global endpoint is handled elsewhere. To improve clarity, consider rewording the comment to something like // empty, as it's not set in this config.

Comment thread model/types.go
Enabled *bool `toml:"enabled"`
Enabled *bool `toml:"enabled"`
APIEndpoint string `toml:"apiEndpoint"` // Custom API endpoint for heartbeats
Token string `toml:"token"` // Custom token for heartbeats
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the surrounding code and Go formatting conventions, it's better to have a single space between the struct tag and the line comment. The extra spaces here seem to be a minor formatting artifact.

Suggested change
Token string `toml:"token"` // Custom token for heartbeats
Token string `toml:"token"` // Custom token for heartbeats

@AnnatarHe AnnatarHe merged commit 7198a07 into main Dec 28, 2025
6 of 7 checks passed
@AnnatarHe AnnatarHe deleted the feat/codetracking-custom-endpoint-token branch December 28, 2025 05:07
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