fix(patch): anchor V4A Begin/End Patch markers to full lines - #76394
Merged
Conversation
The boundary scan in parse_v4a_patch used substring matching, so a content line mentioning "*** End Patch" (docs about the patch format, nested patch text) truncated the patch, and "*** Begin Patch" in content reset the start boundary — silently dropping already-parsed operations while reporting success. Match only whole-line markers at column 0, preserving the no-space "***Begin Patch" tolerance.
Contributor
૮ >ﻌ< ა ci reviewran on f792c9d ℹ️ InfoDesktop E2E visual evidence · View test artifacts · View job3 visual diffs. inline evidence upload failed. Failed to upload diff-1508682a2ae8-boot-ready-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-1508682a2ae8-boot-ready-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso) |
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.
Summary
V4A patches no longer suffer silent data loss when the patch content mentions the boundary markers.
parse_v4a_patchscanned for*** Begin Patch/*** End Patchwith unanchored substring tests, so a content line like+*** End Patch(e.g. docs describing the V4A format, or nested patch text) was treated as the real boundary.Salvage of #74458 by @spfcraze (authorship preserved via cherry-pick), clean onto current main.
Root cause: file-operation headers (
*** Update File:etc.) already used anchored regexes, but the Begin/End markers used'*** End Patch' in linesubstring matching. A+/-/space-prefixed content line containing that string matched, truncating or discarding operations.Changes
tools/patch_parser.py: boundary scan now matches^\*\*\*\s*Begin\s+Patch\s*$/^\*\*\*\s*End\s+Patch\s*$(whole line, column 0). The no-space***Begin Patchform is preserved.tests/tools/test_patch_parser.py: newTestBoundaryMarkersInContent— 3 regression tests.Validation
Live before/after against the real
parse_v4a_patch:+*** End Patchinside Add content['doc line one']— 2 lines silently dropped, reports success+*** Begin Patchmid-content***Begin Patchno-space markersscripts/run_tests.sh tests/tools/test_patch_parser.py— 26/26 pass.Closes #74458.
Infographic