Skip to content

Intent: report discarded explicit attributes - #137

Merged
noeltock merged 3 commits into
mainfrom
fix/129-discarded-intent-attributes
Oct 4, 2026
Merged

noeltock merged 3 commits into
mainfrom
fix/129-discarded-intent-attributes

Conversation

@noeltock

@noeltock noeltock commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Problem

Gutenberg could discard explicit intent attribute keys without telling the caller. The validity gate cannot recover that information from the resulting markup. Closes #129.

Solution

Compare supplied keys with the attributes on the block returned by the native constructor, during the existing walk. Carry intent-attribute-dropped warnings through shared finalization, including block, key and exact input path, without raw values. Warnings remain informational in both modes.

Behaviour Read first Proof
Discarded keys produce located warnings src/intent/index.ts Normal and strict-mode regressions
Warning keys cannot trigger strict failures; native normalization, metadata, defaults and styles remain accepted dev/test/intent.test.ts Positive controls and parsed attributes
Existing JSON and text reports expose the category skills/block-runner/references/ASSEMBLE.md CLI reproduction below

Diff

+110 / −25 across five files.

 assembleNode -> native createBlock
+ compare explicit input attrs keys with constructed attributes
+ append existing ReportItem warnings
 realize -> finalizeBlocks(blocks, ..., warnings)
+ strict classification keeps this warning code informational
 assemble -> unchanged block-array return type

Testing & verification

Reviewed revision: 6ee50d0f144f08c4727b43e71a84e8c54ec6aee9 · Environment: Node 24.18.0, macOS arm64.

  • npx vitest run dev/test/intent.test.ts: 35 passed.
  • npm run typecheck and git diff --check: passed.
  • CLI reproduction with paragraph attrs textAlign and madeUp, through node --import tsx src/bin.ts assemble /tmp/br129-intent.json --json and --out /tmp/br129-output.html: successful output, two warnings, category visible in both JSON and text, exact paths in JSON.
  • Full PR CI passed: https://github.com/humanmade/block-runner/actions/runs/37177532174 (Node 20/22/24, package consumers, WordPress proof and scope gate).

Not verified: destination-theme values or rendering. Nested style values remain open; this reports discarded top-level attrs keys, not design fidelity.

Risk / rollout

Consumers may see new warnings for already ignored input. Successful output and strict-mode policy remain unchanged; there is no attribute allowlist or recursive style validation.

Detection: warning count, path and positive-control regressions. Rollback: revert this PR to remove the new diagnostics.

@noeltock
noeltock merged commit 488036f into main Oct 4, 2026
9 checks passed
@noeltock
noeltock deleted the fix/129-discarded-intent-attributes branch October 4, 2026 04:52
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.

Intent: warn when supplied attributes are discarded

1 participant