Conversation
The previous approach detected fleet merges by a clever-fleet[bot] Co-authored-by trailer in the commit message and attributed to the bot. Both were wrong against real merges: GitHub's squash makes clever-fleet[bot] the commit AUTHOR (not a message-body trailer) and demotes the real author (the run owner) to the Co-authored-by trailer; CIRCLE_USERNAME is empty. DeployUser now: - uses CIRCLE_USERNAME when set (normal human merge); - for an empty CIRCLE_USERNAME with a clever-fleet[bot] commit author (a fleet merge), attributes to the run owner's email from the Co-authored-by trailer, falling back to the clever-fleet[bot] service account when there is no usable co-author; - otherwise keeps the existing hard-fail, so non-fleet triggers are never misattributed to fleet. DeployUser returns a DeployActor (email or github username); deploy_publisher sets User.Email or User.GithubUsername accordingly. Detection/parsing helpers are unit-tested.
This branch has not been deployed
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.
Clever Coding Standards Agreement
Ticket
INFRA-1076
About
Follow-up to #201, which shipped
environment.DeployUser()but detected fleet merges the wrong way. Verified against a real fleet merge (ic-oneroster-api, migrate-ci-to-orbs):GitHub's squash makes
clever-fleet[bot]the commit author (not a message-body trailer) and demotes the real author — the run owner — to aCo-authored-by:trailer. #201 grepped the message body for aclever-fleet[bot]co-author (never present) and attributed to the bot, so it never fired.New
DeployUser()logic:CIRCLE_USERNAMEset → use it (normal human merge).clever-fleet[bot](a fleet merge) → attribute to the run owner email from theCo-authored-by:trailer; fall back to theclever-fleet[bot]service account when there is no usable co-author.DeployUser()now returns aDeployActor{GithubUsername|Email};deploy_publishersetsUser.Email(run owner) orUser.GithubUsername(bot/human) accordingly — Slingshot resolves either. All signals are read from git (%an/%ae,%(trailers:key=Co-authored-by)); no GitHub API or token needed.Checklist
v1.15.0VERSIONTesting
go build/go vet ./internal/environment/ ./internal/platformevents/pass.environment_test.gounit-tests the detection/parsing helpers (fleet-bot author vs human vs other-bot; run-owner extraction skipping bot co-authors; malformed lines).git log --formatstrings against a commit mimicking the real fleet merge:%an/%ae→ fleet-bot detected,%(trailers:key=Co-authored-by,valueonly)→andrew.marine@clever.com, committer →GitHub(matches production).Rollout
Standard deploy. Behavior only changes for empty-
CIRCLE_USERNAMEpipelines; human-triggered deploys are unchanged. The no-co-author fallback still relies onclever-fleet[bot]being registered in who-is-who (INFRA-1076 2a); the common owner-attributed case resolves the run owner directly and needs no bot entry.🤖 Generated with Claude Code