Open
Conversation
Addresses LCHUX-315. The backend can now identify whether CLI
invocations come from direct usage, our GitHub Action wrapper, or
another integration by reading the User-Agent header on every request.
- SMART_TESTS_CALLER env var (defaults to "cli") lets wrappers
identify themselves (e.g. github-action, jenkins-plugin)
- detect_ci_provider() auto-detects the CI environment from standard
env vars (GITHUB_ACTIONS, JENKINS_URL, CIRCLECI, CODEBUILD_BUILD_ID)
- Both values are appended to User-Agent as Caller/{value} CI/{value}
- Both values are also included in the cli_tracking payload
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add test_tracking.py covering detect_ci_provider() and caller/ ciProvider fields in tracking payloads - Add User-Agent tests for caller and CI provider segments - Replace clear=True with surgical env cleanup in test_http_client.py to avoid wiping SMART_TESTS_BASE_URL (same issue as PR #1279) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add send_command_tracking() to send a COMMAND_INVOCATION event with the full CLI argv, exit code, caller, and CI provider in metadata - Add _detect_command() to map argv to Command enum values; falls back to UNKNOWN for typos or unrecognized commands - Refactor TrackingClient: extract construct_payload() from _post_payload() so both send_command_tracking and existing methods share payload construction - Move caller/ciProvider into metadata JSONB (not top-level fields) - Add UNKNOWN and COMMAND_INVOCATION to respective enums Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Capture sys.argv and exit code, send COMMAND_INVOCATION tracking event after every CLI run (including typos and failures). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Caller and CI provider are now sent via cli_tracking metadata only. Remove Caller/ and CI/ segments from User-Agent header. Update test_tracking with tests for _detect_command, send_command_tracking, and caller/ciProvider in metadata. Revert test_http_client to original User-Agent assertions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
There is two pending items though, would like to have an opinion on how to proceed
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
COMMAND_INVOCATIONtracking event on every CLI invocation with the full command string (rawCommand), exit code, caller, and CI providerCommandenum, falls back toUNKNOWNfor typos)SMART_TESTS_CALLERenv var lets wrappers (e.g. GitHub Action) identify themselvesGITHUB_ACTIONS,JENKINS_URL,CIRCLECI,CODEBUILD_BUILD_ID)caller,ciProvider,exitCodesent insidemetadataJSONB — no DB migration neededTest plan
_detect_command()across all commands + typos + global optionssend_command_tracking()payload structurecaller/ciProviderin metadata for all event types