Repository navigation
fix: preserve 'state' field when adding external needs - #2404
Closed
Vijaysir0hi wants to merge 1 commit into
Closed
Vijaysir0hi wants to merge 1 commit into
Vijaysir0hi wants to merge 1 commit into
Conversation
External needs declared with a custom field named 'state' were previously losing the value because add_external_need dropped 'state' alongside internal parameters. In add_need, a non-RSTState value is restored to kwargs so it is passed to generate_need and persisted on the external need record. Signed-off-by: Vijay Sirohi <191354616+Vijaysir0hi@users.noreply.github.com>
Member
|
Thank you for picking this up, and for the test. #2403 was fixed as part of #2406 (merged as Thanks again for the report-shaped test. It matched what we measured. |
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.
Fixes #2403
Summary
When an external needs source declares a custom field named
state,add_external_needpreviously strippedstatefromkwargsbecause it was listed alongside non-field metadata (docname,lineno,is_external).In addition, because
add_needdeclaresstate: RSTState | None = Nonein its signature, passingstateas a keyword argument assigns it to that parameter rather than forwarding it inkwargstogenerate_need.Changes
statefrom thefixed_keytuple inadd_external_need.add_need, ifstateis not anRSTState(i.e. a custom field value passed for an external need), restore it tokwargs["state"], sogenerate_needreceives and stores the field.tests/test_external.pyverifying that an external need withstate: "draft"preserves the field value inget_needs_view().