Skip to content

feat: tighten serde-shape for 0.1.0 - #14

Merged
tisonkun merged 3 commits into
mainfrom
codex/prepare-0.1.0
Sep 1, 2026
Merged

feat: tighten serde-shape for 0.1.0#14
tisonkun merged 3 commits into
mainfrom
codex/prepare-0.1.0

Conversation

@tisonkun

Copy link
Copy Markdown
Contributor

Summary

  • match Serde's fixed-array coverage and the special bound-free zero-length case instead of advertising unsupported array shapes
  • expose the structure already declared by #[serde(remote = "...")] helpers so foreign-type adapters are usable in shape graphs
  • document ShapeId as an index-only graph-local handle instead of claiming that lookups can identify foreign graph ids

Review structure

The three commits are independent and are the intended review order. Each commit message has a Why: paragraph tying the change to an observable Serde or public-API contract.

Deliberate non-changes

This audit found no redundant test boundary worth deleting. It also does not add a generic graph walker, enable derive by default, introduce speculative constructors, or mix version/tag/publish mechanics into the API review. Those changes do not have enough current evidence and would increase the false-positive surface.

Validation

  • cargo x build --locked
  • cargo x test
  • cargo x lint
  • cargo x package --locked
  • cargo +1.85.0 x test
  • cargo +1.85.0 check -p serde-shape --lib --no-default-features --target thumbv7em-none-eabihf
  • cargo +1.85.0 check -p serde-shape-test-no-std --lib --target thumbv7em-none-eabihf

Why: Serde implements arrays only through length 32 and deliberately omits element bounds for length zero. The previous const-generic shape impl both advertised unsupported larger arrays and rejected valid empty arrays whose element type has no shape. Mirror Serde's coverage and represent the unobserved empty-array element explicitly.
Why: ShapeId stores only a graph-local index, so lookups cannot distinguish a foreign id whose index is valid in the current graph. Documenting automatic rejection encouraged silent cross-graph misuse; make the caller's pairing responsibility explicit without adding nondeterministic graph identity machinery.
Why: Serde remote derives already declare a foreign type's wire fields, names, and tagging, so treating the entire helper as opaque discards known metadata and blocks a standard foreign-type workflow. Reuse the normal derive path and retain opacity only for genuinely unknowable custom functions.
@tisonkun
tisonkun marked this pull request as ready for review September 1, 2026 01:35
@tisonkun
tisonkun merged commit fba3618 into main Sep 1, 2026
12 checks passed
@tisonkun
tisonkun deleted the codex/prepare-0.1.0 branch September 1, 2026 01:35
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