Skip to content

respecting ordered sequence while partial update is fixed#9902

Open
Natgho wants to merge 19 commits intoencode:mainfrom
Natgho:6202-partial-update-respect-ordered-sequence
Open

respecting ordered sequence while partial update is fixed#9902
Natgho wants to merge 19 commits intoencode:mainfrom
Natgho:6202-partial-update-respect-ordered-sequence

Conversation

@Natgho
Copy link
Copy Markdown
Contributor

@Natgho Natgho commented Feb 25, 2026

refs #6202

@Natgho
Copy link
Copy Markdown
Contributor Author

Natgho commented Feb 25, 2026

I considered including the ticket ID in the Description section of the test section, but decided it would be excessive. If you want it included, just let me know.

ProstoSerghei

This comment was marked as outdated.

@Natgho Natgho requested a review from ProstoSerghei March 2, 2026 09:39
@auvipy auvipy requested review from auvipy and Copilot and removed request for ProstoSerghei March 2, 2026 10:07

This comment was marked as outdated.

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Natgho
Copy link
Copy Markdown
Contributor Author

Natgho commented Mar 2, 2026

The issues have been resolved and the PR looks ready. Is there anything else that needs improvement?

@auvipy auvipy requested a review from Copilot March 2, 2026 15:12
@auvipy
Copy link
Copy Markdown
Collaborator

auvipy commented Mar 2, 2026

lets wait for final rounds of reviews

This comment was marked as outdated.

Natgho and others added 2 commits March 2, 2026 18:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

This comment was marked as outdated.

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Natgho
Copy link
Copy Markdown
Contributor Author

Natgho commented Mar 2, 2026

Finally!
Sometimes I wish I had been born in the years before AI was created...

@Natgho
Copy link
Copy Markdown
Contributor Author

Natgho commented Mar 5, 2026

@auvipy what do you think?

@Natgho
Copy link
Copy Markdown
Contributor Author

Natgho commented Mar 27, 2026

@auvipy I would appreciate your feedback.

Comment on lines +1693 to +1695
except (TypeError, KeyError, AttributeError):
# Fall back to treating the value as not provided.
val = []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you explain why we need this try/except? This line is not covered by the test so I'm curious...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The purpose of this is to ensure that the code flow continues so that the rendering process can be completed without interruption, even if the field cannot be converted in any way or if the getlist function throws an error. Since I don’t have an example of this, I don’t have a test for it either, but it’s not impossible—I’d rather be a bit overzealous than take a chance.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok, let's break this down:

  • The condition above checks html.is_html_input(dictionary) which checks that the dictionary has a getlist method, so I don't see how the AttributeError can happen
  • The QueryDict docs states that "It’s guaranteed to return a list unless the default value provided isn’t a list."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see. Yes, you're right, it's impossible to get an AttributeError here, so I removed that AttributeError.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about the other 2 exception types? We've not needed them so far, what changed that makes it needed?

@browniebroke
Copy link
Copy Markdown
Member

browniebroke commented Mar 27, 2026

Also... What's up with all these added comments on code which basically unchanged? They are quite distracting... Did you write them or was it the work of an LLM?

@Natgho
Copy link
Copy Markdown
Contributor Author

Natgho commented Mar 27, 2026

Also... What's up with all these added comments on code which basically unchanged? They are quite distracting... Did you write them or was it the work of an LLM?

I created the PR using AI, and I’m manually pushing AI for comment lines so I can track every action it takes in detail. If they seem intrusive or unnecessary, I can remove the comment lines.

Copy link
Copy Markdown
Member

@browniebroke browniebroke left a comment

Choose a reason for hiding this comment

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

Also... What's up with all these added comments on code which basically unchanged? They are quite distracting... Did you write them or was it the work of an LLM?

I created the PR using AI, and I’m manually pushing AI for comment lines so I can track every action it takes in detail. If they seem intrusive or unnecessary, I can remove the comment lines.

Ok that makes sense while you building it but I find the ratio of comments to code quite distracting, there are a

Comment on lines +1690 to +1691
# Call getlist with a single argument to support duck-typed MultiDicts
# that do not accept a default parameter.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That kind of explain why it was changed from dictionary.getlist(self.field_name, []) and exception handling was added, however this sems out of scope of what we're trying to achieve here. Let's keep the call how it was unless you can come up with a concrete example justifying this

Comment on lines +1699 to +1700
# For partial updates, avoid calling parse_html_list unless indexed keys are present.
# This reduces unnecessary parsing overhead for omitted list fields.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one is good

# For partial updates, avoid calling parse_html_list unless indexed keys are present.
# This reduces unnecessary parsing overhead for omitted list fields.
if getattr(self.root, 'partial', False):
# Quick check: are there any keys matching field_name[*]?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Redundant

Comment on lines +1706 to +1707
# Parse indexed keys (e.g., field[0], field[1])
# This handles form submissions with explicit indices
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Redundant with parse_html_list docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants