Use requested environment on streaming requests#4732
Conversation
Signed-off-by: Chris AUSTON <[email protected]>
Factored the snapshot env logic out and reused in streaming implementation. Signed-off-by: Chris AUSTON <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2 #4732 +/- ##
===========================================
- Coverage 62.49% 36.74% -25.75%
===========================================
Files 132 124 -8
Lines 15554 14936 -618
===========================================
- Hits 9720 5488 -4232
- Misses 5153 8885 +3732
+ Partials 681 563 -118
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hey @causton81 Could you explain the issue you are trying to resolve and how is it related to streaming? |
|
I think we need to simply add: like we do in flipt/internal/server/evaluation/client/server.go Lines 39 to 51 in 465e630 seems we missed getting the environment from the path parameters for streaming |
|
Sorry for the lack of description. I added the error for the case where an environment is specified but not found, because it was confusing to get results and then not see my changes pushed out. It took me a little bit to notice I was getting the default environment instead of what I asked for. I was trying to allow for v1 requests with no environment, but I did not test that. |
@markphelps should we use request path parameter only in streaming since it's always required to be there? It also remove any conflicts when path key and context key different if someone messes around with it. |
@causton81 I guess it would be better to change |
yes I think that makes sense |
Changes GetFromContext to return an error when a specific environment is requested from context but cannot be found, instead of silently falling back to the default environment. This makes the API more explicit and consistent with error handling patterns. The error is only returned when an environment is explicitly specified in the context but not found. If no environment is specified, it still returns the default environment without error. - Modified GetFromContext signature to return (Environment, error) - Updated all interface definitions - Updated all call sites to handle the error appropriately - Regenerated mocks with new signature - Updated tests to expect the error return value Implements suggestion from PR #4732
Changes GetFromContext to return an error when a specific environment is requested from context but cannot be found, instead of silently falling back to the default environment. This makes the API more explicit and consistent with error handling patterns. The error is only returned when an environment is explicitly specified in the context but not found. If no environment is specified, it still returns the default environment without error. - Modified GetFromContext signature to return (Environment, error) - Updated all interface definitions - Updated all call sites to handle the error appropriately - Regenerated mocks with new signature - Updated tests to expect the error return value Implements suggestion from PR #4732 Signed-off-by: markphelps <[email protected]>
No description provided.