Conversation
|
Skipping CI for Draft Pull Request. |
220ceb3 to
f8c73fb
Compare
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The change to
Coalescer.Coalesceremoves all single-flight/coalescing behavior and context cancellation handling, effectively turning it into a plainfn()call; if this is intentional, consider renaming/removing the type or documenting the new semantics, otherwise restore the previous logic. - With
auditableServiceEndpointsyou now silently drop all service-to-service calls except the whitelisted ones; consider whether you need some observability (e.g., debug logging or metrics) for unexpected service RPCs that are no longer audited to avoid masking misconfigurations. - The significant increase of
tokenCacheTTL/tokenTTL(3→55/4→60 minutes) changes the revocation window for these tokens; it may be worth revisiting any assumptions in Central or callers that relied on shorter-lived tokens (e.g., compromise detection or key rotation timing) to ensure behavior remains acceptable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The change to `Coalescer.Coalesce` removes all single-flight/coalescing behavior and context cancellation handling, effectively turning it into a plain `fn()` call; if this is intentional, consider renaming/removing the type or documenting the new semantics, otherwise restore the previous logic.
- With `auditableServiceEndpoints` you now silently drop all service-to-service calls except the whitelisted ones; consider whether you need some observability (e.g., debug logging or metrics) for unexpected service RPCs that are no longer audited to avoid masking misconfigurations.
- The significant increase of `tokenCacheTTL`/`tokenTTL` (3→55/4→60 minutes) changes the revocation window for these tokens; it may be worth revisiting any assumptions in Central or callers that relied on shorter-lived tokens (e.g., compromise detection or key rotation timing) to ensure behavior remains acceptable.
## Individual Comments
### Comment 1
<location path="pkg/coalescer/coalescer.go" line_range="28-29" />
<code_context>
- }
- return result.Val.(T), nil
- }
+ return fn()
+ // ch := c.group.DoChan(key, func() (interface{}, error) {
+ // return fn()
+ // })
</code_context>
<issue_to_address>
**issue (bug_risk):** Coalesce now bypasses single-flight behavior and context handling, which is likely a functional regression.
The current code returns `fn()` directly and fully bypasses the `singleflight` flow:
- Calls sharing a `key` are no longer coalesced; every caller now runs `fn()` in parallel.
- The documented `ctx` behavior (waiting callers seeing `ctx.Err()` on cancellation while the shared call continues) is no longer preserved.
If this behavior change is intentional, please either gate it (e.g., via a flag) or update the function’s contract accordingly. Otherwise, we should restore the original `singleflight` + `select` logic so existing coalescing and cancellation semantics remain intact.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
+28
to
+29
| return fn() | ||
| // ch := c.group.DoChan(key, func() (interface{}, error) { |
Contributor
There was a problem hiding this comment.
issue (bug_risk): Coalesce now bypasses single-flight behavior and context handling, which is likely a functional regression.
The current code returns fn() directly and fully bypasses the singleflight flow:
- Calls sharing a
keyare no longer coalesced; every caller now runsfn()in parallel. - The documented
ctxbehavior (waiting callers seeingctx.Err()on cancellation while the shared call continues) is no longer preserved.
If this behavior change is intentional, please either gate it (e.g., via a flag) or update the function’s contract accordingly. Otherwise, we should restore the originalsingleflight+selectlogic so existing coalescing and cancellation semantics remain intact.
Contributor
|
Images are ready for the commit at f8c73fb. To use with deploy scripts, first |
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.
Description
change me!
User-facing documentation
Testing and quality
Automated testing
How I validated my change
change me!