Skip to content
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

fix: deepcopy component output to avoid overriding previous outputs #3698

Merged
merged 8 commits into from
Sep 6, 2024

Conversation

jordanrfrazier
Copy link
Collaborator

This was a bug that @edwinjosechittilappilly noticed in the linked issue. Outputs of subsequently created components were overriding outputs of previously created components of the same name - i.e. two Model outputs may interchange their Outputs, regardless of where in the flow they were.

This is due to how the class variable Outputs is structured -- as class variables, it gives us this potential for cross-component leakage, but I have no better ideas at the moment on how to allow initializing the component with Outputs and then allowing for dynamic updates to that variable to provide the result.

Closes #3619

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Sep 5, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Sep 5, 2024
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-3698.dmtpw4p5recq1.amplifyapp.com

@edwinjosechittilappilly
Copy link
Collaborator

Also closes #3584

Copy link
Collaborator

@edwinjosechittilappilly edwinjosechittilappilly left a comment

Choose a reason for hiding this comment

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

LGTM!

Tested the Error Scenario and its fixed.

ToDo: to add integration/unit tests for this scenario in backlog

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 5, 2024
- Update loop to iterate over `_outputs.values()` instead of `outputs` to ensure correct attribute setting.
- Updated methods to iterate over `_outputs.values()` instead of `outputs`.
- Ensured consistent access to output values across various methods.
- Fixed potential issues with output value resetting and state model building.
- Updated all references of `_outputs` to `_outputs_map` in `component.py` to improve clarity and consistency.
- Adjusted related methods and attributes in `base.py` to align with the new naming convention.
- Moved `_reset_all_output_values` call to ensure outputs are reset after initialization.
- Updated attribute access to use `_outputs_map` instead of `_outputs` for consistency.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Sep 6, 2024
@ogabrielluiz ogabrielluiz merged commit 3643d96 into main Sep 6, 2024
29 of 36 checks passed
@ogabrielluiz ogabrielluiz deleted the fix-outputs-copy-in-component branch September 6, 2024 12:23
@ogabrielluiz ogabrielluiz linked an issue Sep 6, 2024 that may be closed by this pull request
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:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
3 participants