Repository navigation
Conversation
Co-authored-by: Copilot <[email protected]>
🤖 Copilot Code Review — PR #124559Holistic AssessmentMotivation: The bug is real and well-documented. When Approach: The fix correctly identifies the root cause: Summary: ✅ LGTM. The fix is correct, minimal, and follows the existing log/rollback pattern. All call sites for Detailed Findings✅ Correctness — Fix properly restores
|
|
@copilot look at feedback and address it, pushing to this PR |
Not sure copilot can push to PR :( I'll get around to address the feedback asap (probably in a week or two) |
|
It can't because it came from a fork. My bad. Sounds good! |
Co-authored-by: Copilot <[email protected]>
|
Workflow state for the Holistic Review Orchestrator. {
"version": 5,
"last_dispatched_commit": "df98818e64ee43e6ca875a5f1308d544051b3806",
"last_dispatched_base_ref": "main",
"last_dispatched_base_sha": "98bfa17c9f3910eec30099b7ac140d8a09df6227",
"last_reviewed_commit": "df98818e64ee43e6ca875a5f1308d544051b3806",
"last_reviewed_base_ref": "main",
"last_reviewed_base_sha": "98bfa17c9f3910eec30099b7ac140d8a09df6227",
"last_recorded_worker_run_id": "29741198531",
"review_attempt_commit": "",
"review_attempt_base_ref": "",
"review_attempt_count": 0,
"max_review_attempts": 5,
"review_history_format": "holistic-review-disclosure-v1",
"review_history": [
{
"commit": "beaf28e2933105e17a8ed7a2c4b66b4a1c7d310d",
"review_id": 4730521926
},
{
"commit": "df98818e64ee43e6ca875a5f1308d544051b3806",
"review_id": 4734870612
}
]
} |
There was a problem hiding this comment.
Holistic Review
Motivation: XmlNodeReader.MoveToAttribute (and related move APIs) left the reader in an inconsistent state after a failed move: when an attribute was not found, the rollback restored the navigator cursor and depth but not the reader's cached _nodeType. As reported in #34443, this produced states like Element attr1 where a subsequent ReadStartElement throws Element 'child' was not found., diverging from XmlTextReader/XmlReader.Create behavior.
Approach: The fix extends the roll-back bookkeeping in XmlNodeReaderNavigator to also snapshot and restore the reader's XmlNodeType. A new _logNodeType field is added and initialized in the constructor; LogMove gains an XmlNodeType nt parameter that records it, and RollBackMove gains a ref XmlNodeType nt out-parameter that restores it. All callers in XmlNodeReader (the MoveToAttribute overloads, MoveToFirstAttribute, MoveToNextAttribute, MoveToElement) are updated to pass/restore _nodeType, so a failed move now leaves _nodeType unchanged. Two targeted tests reproduce the exact issue scenario (with and without namespaces) and assert the reader stays on Attribute attr1 after the failed move and that ReadStartElement then succeeds. Some stale commented-out code (//, ref curDepth ) ) {) is also cleaned up.
Summary: This is a well-scoped, correct fix that keeps the log/restore invariant symmetric — every existing RollBackMove call site is updated consistently, and ResetMove/MoveToNextAttribute/MoveToElement correctly seed the log with the current _nodeType before the attempted move, so the restored value matches the pre-move node type. Behavior now aligns with the other XmlReader implementations shown in the issue. The regression tests directly encode the reported repro. I found no correctness concerns; only one trivial style nit (a double blank line between the two new test methods), noted inline. LGTM.
Detailed Findings
No actionable correctness or design issues found. One minor style nit is noted as an inline comment on the test file (double blank line between methods).
Note
This review was generated by this repository's Holistic Review agentic workflow to complement the built-in Copilot review.
Generated by Holistic Review · 57 AIC · ⌖ 10.5 AIC · ⊞ 10K
There was a problem hiding this comment.
Holistic Review
Motivation: XmlNodeReader.MoveToAttribute (and related move APIs) left the reader in an inconsistent state after a failed move: when an attribute was not found, the rollback restored the navigator cursor and depth but not the reader's cached _nodeType. As reported in #34443, this produced states like Element attr1 where a subsequent ReadStartElement throws Element 'child' was not found., diverging from XmlTextReader/XmlReader.Create behavior.
Approach: The fix extends the roll-back bookkeeping in XmlNodeReaderNavigator to also snapshot and restore the reader's XmlNodeType. A new _logNodeType field is added and initialized in the constructor; LogMove gains an XmlNodeType nt parameter that records it, and RollBackMove gains a ref XmlNodeType nt parameter that restores it. All callers in XmlNodeReader (the MoveToAttribute overloads, MoveToFirstAttribute, MoveToNextAttribute, MoveToElement) are updated to pass/restore _nodeType, so a failed move now leaves _nodeType unchanged. Stale commented-out code (//, ref curDepth ) ) {) is cleaned up. Targeted tests reproduce the reported scenario (with and without namespaces) and assert the reader stays on Attribute attr1 after a failed move and that ReadStartElement then succeeds.
Summary: The latest change since the prior review is a single cosmetic edit that removes a double blank line between the two new test methods in XmlNodeReaderMoveToAttributeTests.cs — precisely the style nit the previous review noted. It introduces no behavioral change. The cumulative fix remains well-scoped and correct: the log/restore invariant stays symmetric across every RollBackMove call site, and ResetMove/MoveToNextAttribute/MoveToElement seed the log with the current _nodeType before the attempted move so the restored value matches the pre-move node type. Behavior now aligns with the other XmlReader implementations. No new actionable findings in the incremental change. LGTM.
Assessment History
- review 4730521926 reviewed commit
beaf28e2933105e17a8ed7a2c4b66b4a1c7d310dwith an LGTM verdict. The current verdict is also LGTM. The assessment is unchanged: the only new commit (df98818) removes the double blank line that review flagged as its lone inline nit, so motivation, approach, and risk are all identical.
Detailed Findings
No actionable correctness or design issues found. The prior review's only nit (a double blank line between the two new test methods) has now been resolved by the incremental commit.
Note
This review was generated by this repository's Holistic Review agentic workflow to complement the built-in Copilot review.
Generated by Holistic Review · 41.1 AIC · ⌖ 10.5 AIC · ⊞ 10K
Fixes #34443