Repository navigation
fix(audit): read a JSON-LD @graph's nodes in the wrapper's @context - #1681
Merged
gkhngyk merged 3 commits intoOct 28, 2026
Merged
Conversation
Follow-up B (second half) from ansvisor#1565's round 37. jsonLd() flattened a @graph into its nodes without the wrapper's @context, so a page whose JSON-LD is one @graph with the context on the wrapper alone (as WordPress's SEO plugins write it) failed json-ld-validity though it's valid: no node "declares" schema.org. That's on main too, and since the Action Center's structured data check uses the same evaluator, such a task never closed by itself. A @graph's node now takes the wrapper's @context when it has none of its own, as JSON-LD reads it; a node's own context is kept, and a @graph with no context anywhere still fails. The new structure.test.js fails on main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 of 12 tasks
A @graph's nodes now carry their wrapper's context, so the same context was turned into a string once per node. Keep each context's answer in a Map keyed by the value, and test a large shared context with thousands of nodes.
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
Follow-up B (second half) from #1565's round 37: Site Audit reads a JSON-LD
@graph's nodes in the wrapper's@context.jsonLd()flattened a@graphinto its nodes without the wrapper's@context. So a page whose JSON-LD is one@graphwith the context on the wrapper alone, as WordPress SEO plugins write it, failedjson-ld-validityeven though it's valid: no node "declared" schema.org. This also happens on main. The Action Center's structured data check uses the same evaluator, so such a task never closed by itself.@graphnode now takes the wrapper's@contextwhen it has none of its own, as JSON-LD reads it.@graphwith no context anywhere still fails.structure.test.jsfails on main.@graphsites, the next audit passesjson-ld-validity, so the score goes up. Saved audits stay as they are until re-audited; no re-audit is needed. Open Action Center tasks raised byjson-ld-validityon those pages close at their next check ("Checked automatically and done").Merge together with #1680 (the
sawFailinggate), in one deploy. See that PR for why.Related issue
Follow-up from #1565 (round 37, item B).
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/audit/signals/structure.test.jsChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks were run in one tree with this batch's eight follow-up branches merged (after the review fixes):
npm test(noSUPABASE_*env, as in CI): 249 files, 3,365 tests passed;vitest(445 files, 4,353 tests) and build: all pass.Browser check (local, 1024 px): Prompts › Topics › Add Topic stops at 100 characters; the Action Center drawer opens without errors, and Check now doesn't show on tasks the API doesn't check.
A pre-push review was run on all eight branches of this batch, and its before-merge findings are fixed.
🤖 Generated with Claude Code