Repository navigation
Match whole segments when marking a build as updating, and count shared request keys [patch] - #359
Merged
Merged
Conversation
…ed request keys [patch] IsBuildUpdating tested request keys with a bare prefix, so a build named "Build" turned cyan while "Build and Release" in the same repository was being polled. It now matches the build key exactly or followed by "/", via a pure IsRequestForBuild. ActiveRequests tracked each key once, so two concurrent run polls of one GitHub workflow (which share a key unless run-name is set) dropped the "updating" state when the first finished. It now counts requests per key and removes the key only when the last one finishes. Fixes #351 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019FkGdWB8Ko3mTn9JiBH973
|
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.



Fixes #351
What changed
Prefix collision.
IsBuildUpdatingcompared request keys against the build key with a bareStartsWith. A build namedBuildtherefore showed the cyan "updating" dot wheneverBuild and Releasein the same repository was being polled. The match now goes through a pureIsRequestForBuild(requestKey, buildKey), which accepts only the build's own key or a key that continues with/(that build's run polls).Shared keys.
MakeRequestAsynctracked each key once withTryAdd/TryRemove. Two ongoing runs of one GitHub workflow poll under the same key unlessrun-nameis set, so the first to finish cleared "updating" while the second was still in flight.ActiveRequestsis nowConcurrentDictionary<string, int>: a request increments its key's count on start and decrements it on finish, using compare-and-swap. The key is removed only when the last request finishes. Nothing else read the oldDateTimeOffsetvalue.I kept the issue's minimal option (segment matching) rather than re-keying requests by build/run ids, so the key formats in
GitHub.csandAzureDevOps.csare untouched.Tests
New
ActiveRequestTests:ABuildMatchesItsOwnPollAndItsRunsPollsABuildDoesNotMatchAnotherBuildItsNameIsAPrefixOf(BuildvsBuild and Release, plus its run key, plusBuildDocs)AKeySharedByTwoRequestsStaysUntilBothFinish: twoMakeRequestAsynccalls on one key; the key survives the first finishing and is removed after the second.With the old prefix test and
TryAdd/TryRemoverestored, the second and third tests fail. With the fix they pass. Full suite: 117/117 passing locally. This branch also merges cleanly with the open #356.🤖 Generated with Claude Code
https://claude.ai/code/session_019FkGdWB8Ko3mTn9JiBH973
Generated by Claude Code