Skip to content

fix(loc): keep the target's own blocks when their hash was rejected - #920

Merged
benpeter merged 2 commits into
public-loc-sdkfrom
lochash
Oct 27, 2026
Merged

benpeter merged 2 commits into
public-loc-sdkfrom
lochash

Conversation

@benpeter

Copy link
Copy Markdown
Contributor

@shsteimer another follow-up for #801, in the merge code it moves to nx/public/loc/regional-diff.js: when a block of the target page has its hash in the page's rejectedhashes, the merge drops it without a mark.

how a page's own heading ends up in rejectedhashes:
• a translation brings a heading that differs from the page's heading only in its id (<h1 id="welcome">Welcome</h1> vs <h1 id="willkommen">Welcome</h1>). the author keeps the local one
• da-live hashes the rejected heading from its own serialization, which has no id (diff-actions.js#L99-L105), and saves the page's heading without its id too. so the rejected hash is now the hash of the page's own heading
• in the next merge, buildHtmlFromDiff skips the page's heading because its hash is rejected (regional-diff.js#L430-L434). the incoming heading still has its id, so its hash doesn't match and it comes back marked. keeping local again leaves the page without a heading

i hit this on a translation into an existing page: the second project into that page removed its H1, and the dashboard said complete.

with this change, rejectedHashes only skip incoming blocks. the target's own blocks stay in the output and are marked unless their hash is accepted. a block the author rejects is deleted from the page during the review, so on the target side the check could only match collisions like this one, or a block the author added back by hand. #117 and the translation docs say the hashes are there so decisions aren't presented again.

the existing test "only rejected hashes are present" said the target's block "should be removed", but it only checked that the hash string isn't in the HTML, and it never is. it now checks that the block stays.

Verified:
• the new tests fail on public-loc-sdk and on main, and pass here. full suite (2,631) and lint passed
• the page where i hit it, merged in node with the app's merge code: with this change the H1 stays (marked) and nothing else in the output changes. without it, the H1 is gone

Test URLs:

@aem-code-sync

aem-code-sync Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@benpeter
benpeter merged commit 3786b24 into public-loc-sdk Oct 27, 2026
7 checks passed
@benpeter
benpeter deleted the lochash branch October 27, 2026 22:57

This branch was successfully deployed

1 active deployment
lochash — eeb7bf44 Deployed Oct 27, 2026 by aem-code-sync[bot]
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.

2 participants