You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
replacing usage of update etag with AIP-154 ifMatch? #241
Today, there are two sightly different mechanics for validation of resource freshness. Those are:
in https://aep.dev/update, using an etag field in the resource body (proto), and rejecting the request if that does match.
In https://aep.dev/154/#guidance, using an etag header in the response, and an optional if-match header in the request for resource validation.
These are fundamentally incompatible methods, and we should provide a single way to do so. As an initial proposal, I propose aligning with AIP-154 and:
making etag a field that is returned back via grpc metadata, allowing it's usage in the HTTP header.
adding guidance in AIP-154 to use grpc metadata to include the if-match header.
one disadvantage of putting etags in the header is you won't be able to get it from the resource body (e.g. when you curl and write the output to disk for stage purpose). So it might make sense to still have an etag field in the body as place where the value is duplicated.
The comparison with the stored ETag uses the strong comparison algorithm, meaning two files are considered identical byte by byte only. If a listed ETag has the W/ prefix indicating a weak entity tag, this comparison algorithm will never match it.
It sounds like this means that weak etags would no longer be supported. That seems like an unfortunate limitation.
Services that provide ETags should support the If-Match and If-None-Match headers on incoming requests:
One is must/may for If-Match/If-None-Match and the other is should for both. Or am I reading it wrong?
Good callout! In the future I'd suggest filing a separate issue so we can keep the conversation focused.
To address your point though: Yes I think those statements are not consistent, and should be. I'd probably say the latter statement is what I'd lean toward, since etags are useful in their own right for identifying whether a resource changed, even if it's not used as a check-and-set.
It sounds like this means that weak etags would no longer be supported. That seems like an unfortunate limitation.
I agree this is limiting, but I'd also note it's not explicitly stated that etag can support both strong and weak matches.
@rofrankel do you have a specific blocker if weak etags were not supported? I'll also ask around and see if someone can help clarify why weak matches aren't supported for matching, but also feel like we should validate the use case.
aep-dev/aepc#76 shows that grpc-gateway can indeed be modified to support if-match and etag headers. GRPC requests can also attach metadata, so I think this sufficient proves that this pattern is indeed possible to port to GRPC-based interfaces.
Activity
toumorokoshi commentedon Nov 6, 2024
one disadvantage of putting etags in the header is you won't be able to get it from the resource body (e.g. when you curl and write the output to disk for stage purpose). So it might make sense to still have an
etagfield in the body as place where the value is duplicated.rofrankel commentedon Nov 6, 2024
From https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match:
It sounds like this means that weak etags would no longer be supported. That seems like an unfortunate limitation.
dv-stewarts commentedon Nov 8, 2024
Not as important as the actual decision, but I think there some contradiction in the text of https://aep.dev/154/ which should also be resolved:
https://aep.dev/154/#guidance
https://aep.dev/154/#condition-headers
One is must/may for If-Match/If-None-Match and the other is should for both. Or am I reading it wrong?
toumorokoshi commentedon Nov 10, 2024
Good callout! In the future I'd suggest filing a separate issue so we can keep the conversation focused.
To address your point though: Yes I think those statements are not consistent, and should be. I'd probably say the latter statement is what I'd lean toward, since etags are useful in their own right for identifying whether a resource changed, even if it's not used as a check-and-set.
toumorokoshi commentedon Mar 14, 2025
Offline discussion in the aep weekly today:
maybe move aepc to envoy? not sure on grpc-gateway. Reach out to Tim burks.
toumorokoshi commentedon Sep 21, 2025
I agree this is limiting, but I'd also note it's not explicitly stated that etag can support both strong and weak matches.
@rofrankel do you have a specific blocker if weak etags were not supported? I'll also ask around and see if someone can help clarify why weak matches aren't supported for matching, but also feel like we should validate the use case.
toumorokoshi commentedon Sep 21, 2025
w.r.t. how to move forward with this ticket, I'm proposing:
toumorokoshi commentedon Sep 29, 2025
aep-dev/aepc#76 shows that grpc-gateway can indeed be modified to support if-match and etag headers. GRPC requests can also attach metadata, so I think this sufficient proves that this pattern is indeed possible to port to GRPC-based interfaces.
feat(134): replace etag guidance with 154 reference
feat(134): replace etag guidance with 154 reference
feat(134): replace etag guidance with 154 reference
feat(134): replace etag guidance with 154 reference (#356)
fix(137): clarify behvavior (field presence and errors).
fix(137): clarify behvavior (field presence and errors).
fix(137): clarify behavior (field presence and errors). (#357)
feat(134): replace etag guidance with 154 reference (aep-dev#356)
fix(137): clarify behavior (field presence and errors). (aep-dev#357)