Skip to content

test(drawlist): harden ZRDL v1/v2 edge cases and invariants#65

Merged
RtlZeroMemory merged 1 commit into
mainfrom
drawlist-builder-polish
Feb 17, 2026
Merged

test(drawlist): harden ZRDL v1/v2 edge cases and invariants#65
RtlZeroMemory merged 1 commit into
mainfrom
drawlist-builder-polish

Conversation

@RtlZeroMemory

Copy link
Copy Markdown
Owner

Summary

  • audited ZRDL builder v1/v2 behavior for limits, 4-byte alignment, string interning, encoded-string cache, round-trip layout, cursor encoding, and reset/reuse semantics
  • added six deterministic drawlist test suites focused on binary invariants and boundary behavior
  • documented current binary invariants in docs/guide/layout.md under "ZRDL Binary Format Invariants"

What changed

  • added packages/core/src/drawlist/__tests__/builder.limits.test.ts
  • added packages/core/src/drawlist/__tests__/builder.alignment.test.ts
  • added packages/core/src/drawlist/__tests__/builder.string-intern.test.ts
  • added packages/core/src/drawlist/__tests__/builder.string-cache.test.ts
  • added packages/core/src/drawlist/__tests__/builder.round-trip.test.ts
  • added packages/core/src/drawlist/__tests__/builder.reset.test.ts
  • updated docs/guide/layout.md with alignment, interning, limit, cache, and v1/v2 cursor invariants

Notes

  • no new drawlist features or command types were introduced
  • no drawlist source behavior changes were required by the audit

Validation

  • npm run build
  • npm run typecheck
  • node scripts/run-tests.mjs

@RtlZeroMemory
RtlZeroMemory merged commit 4b67a23 into main Feb 17, 2026
9 of 18 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4890a602c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +91 to +93
const size = dv.getUint32(cursor + CMD.SIZE, true);
assert.equal(size >= CMD.HEADER_SIZE, true, `command ${i} has invalid size`);
cursor += align4(size);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Assert command size alignment when walking command stream

This helper advances with align4(size) but never asserts that size itself is 4-byte aligned, so a malformed command header with an unaligned size can still pass these tests even though the runtime validator rejects such streams (ch.size & 3u is checked in packages/native/vendor/zireael/src/core/zr_drawlist.c). Because this suite is explicitly documenting alignment invariants, it should fail when a command advertises a non-aligned size instead of normalizing it during traversal.

Useful? React with 👍 / 👎.

@RtlZeroMemory
RtlZeroMemory deleted the drawlist-builder-polish branch February 19, 2026 17:45
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