Skip to content

Conversation

@zharinov
Copy link
Member

@zharinov zharinov commented Jan 4, 2026

Summary

  • Add debug_verify_type() that validates materialized Value matches declared bytecode type
  • Zero-cost in release builds via #[cfg(debug_assertions)]
  • On mismatch, panics with pretty diagnostic showing expected .d.ts types, actual JSON output, and error paths

Example output

================================================================================
TYPE MISMATCH: Query output does not match declared type
================================================================================

export interface Node {
  kind: string;
  text: string;
  span: [number, number];
}

export interface Q {
  id: Node;
}

---------------------------------- Output: Q -----------------------------------

{
  "id": "wrong"
}

----------------------------------- Details ------------------------------------

id: expected Node, found string

================================================================================

Testing

  • 16 new tests covering valid cases (should not panic) and invalid cases (#[should_panic])

@zharinov zharinov force-pushed the feat/debug-verify-type branch from bdd3793 to 7d23fee Compare January 4, 2026 14:52
@zharinov zharinov force-pushed the feat/debug-verify-type branch from 7d23fee to 7f75659 Compare January 4, 2026 14:53
@zharinov zharinov enabled auto-merge (squash) January 4, 2026 14:53
@zharinov zharinov merged commit 1c754fb into master Jan 4, 2026
4 checks passed
@zharinov zharinov deleted the feat/debug-verify-type branch January 4, 2026 14:54
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