Skip to content

fix: Resolve event delivery configuration header passing between frontend and backend #7514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Apr 9, 2025

Conversation

Cristhianzl
Copy link
Member

This pull request introduces several changes to handle event delivery configurations more effectively in both the backend and frontend. The key updates include adding a new request parameter for event delivery, updating utility store configurations, and modifying various components to use the new event delivery configuration.

Backend Changes:

  • Added request parameter to the build_flow function in chat.py to access request headers.
  • Modified the build_flow function to check the "X-Event-Delivery" header and adjust the event delivery method accordingly.

Frontend Changes:

  • Replaced config.data?.event_delivery with eventDeliveryConfig in NodeStatus and IOModal components to use the new utility store state. [1] [2] [3] [4] [5] [6]
  • Added eventDeliveryConfig parameter to StreamingRequestParams and updated the performStreamingRequest function to include the "X-Event-Delivery" header if the configuration is "direct". [1] [2]
  • Updated the useGetConfig hook to set the event delivery type in the utility store. [1] [2]
  • Added eventDelivery state and setEventDelivery method to the utility store. [1] [2] [3] [4]
  • Updated buildFlowVertices function to pass eventDeliveryConfig to performStreamingRequest. [1] [2]

…ction

📝 (NodeStatus/index.tsx): refactor config variable to eventDeliveryConfig for better readability
📝 (api.tsx): add EventDeliveryType enum import and update config import to include EventDeliveryType
📝 (use-get-config.ts): add support for setting event delivery type in utility store
📝 (new-modal.tsx): refactor config variable to eventDeliveryConfig for better readability
📝 (utilityStore.ts): add default event delivery type to utility store
📝 (index.ts): add eventDelivery type to UtilityStoreType
📝 (buildUtils.ts): add support for passing event delivery config to performStreamingRequest function
@Cristhianzl Cristhianzl requested a review from ogabrielluiz April 8, 2025 23:52
@Cristhianzl Cristhianzl self-assigned this Apr 8, 2025
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 8, 2025
@github-actions github-actions bot added the bug Something isn't working label Apr 8, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
…elivery types in build functions

📝 (utils.py): Define EventDeliveryType enum with streaming, direct, and polling options for event delivery
📝 (chat.py): Add EventDeliveryType enum to support different event delivery types in chat functions
📝 (chat.py): Add event_delivery parameter with default streaming type to build_flow function
📝 (chat.py): Update build_flow function to use event_delivery parameter for event delivery type
📝 (chat.py): Update get_build_events function to use event_delivery parameter for event delivery type
📝 (build_utils.py): Import Enum class for EventDeliveryType in build_utils
📝 (api.tsx): Remove eventDeliveryConfig parameter and related logic from performStreamingRequest function
📝 (buildUtils.ts): Update BuildVerticesParams type to include mandatory stream and eventDelivery properties
📝 (buildUtils.ts): Update buildFlowVerticesWithFallback function to use EventDeliveryType.POLLING when streaming is not supported
📝 (buildUtils.ts): Update pollBuildEvents function to use EventDeliveryType.POLLING for event delivery
📝 (buildUtils.ts): Update buildFlowVertices function to use eventDelivery parameter for event delivery type
…f EventDeliveryType values for better logic

📝 (utils.py): reorder imports to follow PEP8 guidelines and improve code readability
📝 (chat.py): refactor condition to check if EventDeliveryType.DIRECT is not in a list of event_delivery values for clarity
📝 (build_utils.py): remove unused import statement for Enum to clean up code
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
…function to clean up code and improve maintainability
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
// Then stream the events
const eventsUrl = `${BASE_URL_API}build/${job_id}/events`;
const buildResults: Array<boolean> = [];
const verticesStartTimeMs: Map<string, number> = new Map();

if (stream) {
if (eventDelivery === EventDeliveryType.STREAMING) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#7526 will help with this. let's push this PR and then we fix this

Cristhianzl and others added 4 commits April 9, 2025 14:16
Co-authored-by: Gabriel Luiz Freitas Almeida <[email protected]>
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
…dUtils.ts): remove unused shouldStreamEvents function and stream property from buildFlow function to clean up code and improve maintainability.
@Cristhianzl Cristhianzl requested a review from ogabrielluiz April 9, 2025 17:41
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Apr 9, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Apr 9, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 9, 2025
@ogabrielluiz ogabrielluiz merged commit 59a7440 into main Apr 9, 2025
27 of 54 checks passed
@ogabrielluiz ogabrielluiz deleted the cz/fix-event-delivery-direct branch April 9, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants