Add Operator() method to Signals#5
Merged
Merged
Conversation
Returns a single classification string for the process operator: ci > agent > interactive > unknown. Convenience for consumers that want one label without reimplementing the precedence logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a small convenience API to the Go clientsignals package: a Signals.Operator() method that collapses the existing CI, Agent, and Interactive signals into a single stable classification label with a defined precedence order. This helps downstream consumers avoid re-implementing the same precedence logic while still leaving the raw signal fields available for more detailed use.
Changes:
- Added
Signals.Operator()returning one of:"ci","agent","interactive","unknown"with precedenceci > agent > interactive > unknown. - Added a table-driven unit test covering all precedence branches and the default fallback.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/signals.go | Adds Operator() method to map existing signals into a single operator classification string with documented precedence. |
| go/signals_test.go | Adds table-driven tests validating Operator() precedence and fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dangra
approved these changes
Jul 13, 2026
2 tasks
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
Operator()method onSignalsthat returns a single classification stringci>agent>interactive>unknownCI,Agent,Interactive) remain available for finer-grained useUsage
Motivation
flyctl metrics needs to classify deploy/launch traffic by operator type. Rather than each consumer reimplementing the same precedence switch, this centralizes it in the library.
Related PRs
s.Operator()instead of its ownOperatorFromSignalshelperTest plan
go test ./...passes🤖 Generated with Claude Code