fix(html-analyzer): sort JSON-LD keys to suppress false prerender diffs (LLMO-4462)#1558
Open
fix(html-analyzer): sort JSON-LD keys to suppress false prerender diffs (LLMO-4462)#1558
Conversation
…s false diffs Semantically identical JSON-LD blocks with different server-side key orderings produced different serialized strings, causing the prerender pre/post compare UI to flag them as material changes. Sorting keys recursively before JSON.stringify ensures stable output regardless of key insertion order. Fixes false JSON-LD diffs for HDFC (LLMO-4462) and any site where the curl and lambda fetches return the same JSON-LD in different key order. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
filterHtmlContentnormalized JSON-LD withJSON.parse+JSON.stringify(obj, null, 2), which preserves insertion order. HDFC's server returns the same JSON-LD with different key orderings between the curl (original) and lambda (prerendered) fetches, so two semantically identical blocks produced different strings → false diff in the pre/post compare UI.deepSortKeys()helper that recursively sorts all object keys alphabetically before serialization. Applied in both the browser (filterHtmlBrowser) and Node.js (filterHtmlNode) code paths.@graphordering can be meaningful).Fixes LLMO-4462 — confirmed via Slack thread in
#project-tokowaka-customers(2026-04-23) where the team manually verified pre/post JSON-LD was identical on HDFC FD Calculator and Investor Relations pages but showed as a diff.Test plan
ld-jsoncode block🤖 Generated with Claude Code