Skip to content

Surface Clay layout errors on RenderResult#23

Merged
cowboyd merged 2 commits into
mainfrom
feat/render-errors
Apr 17, 2026
Merged

Surface Clay layout errors on RenderResult#23
cowboyd merged 2 commits into
mainfrom
feat/render-errors

Conversation

@cowboyd
Copy link
Copy Markdown
Contributor

@cowboyd cowboyd commented Apr 17, 2026

Motivation

Clay reports errors during layout (duplicate IDs, capacity exceeded, unbalanced open/close, etc.) via a callback. These were silently discarded, making it impossible for callers to know when their layout had issues.

Approach

  • Added errors and error_count fields to the Clayterm struct (no global state)
  • The clay_error callback receives the Clayterm instance via Clay's userData pointer and appends errors to the per-instance buffer
  • Errors are cleared at the start of each reduce() call, so each render returns only its own errors
  • Exposed error_count, error_type, error_message_length, error_message_ptr as WASM exports
  • Wired through term-native.ts to term.ts, adding errors: ClayError[] to RenderResult
  • Updated renderer spec section 12.3 with the new field and all Clay error types
  • Added C code convention to AGENTS.md: no global mutable state

Clay reports errors (duplicate IDs, capacity exceeded, etc.) via a
callback during layout. These were previously silently discarded.
Collect them per-render on the Clayterm struct and expose them as
`errors: ClayError[]` on RenderResult.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 17, 2026

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@23

commit: 994adca

@cowboyd cowboyd merged commit cef9c8b into main Apr 17, 2026
5 checks passed
@cowboyd cowboyd deleted the feat/render-errors branch April 17, 2026 22:05
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.

1 participant