Skip to content

fix(reflect): recursively hash nested struct schemas in schema_hash - #366

Merged
Excurs1ons merged 1 commit into
masterfrom
fix/reflect-schema-hash-nested
Oct 27, 2026
Merged

Excurs1ons merged 1 commit into
masterfrom
fix/reflect-schema-hash-nested

Conversation

@Excurs1ons

Copy link
Copy Markdown
Owner

🤖 Generated by Antigravity (Google DeepMind)

Summary

Implement Option A from #168: Make TypeDesc::schema_hash registry-aware (&TypeRegistry), recursively hashing nested struct schemas.

  • Updated TypeDesc::schema_hash(&self, registry: &TypeRegistry) -> u64 to recursively hash nested struct schemas looked up from the registry.
  • Added recursion cycle detection with a visiting set (HashSet<TypeId>) to safely terminate on recursive or mutually recursive schemas.
  • Added TypeDesc::schema_hash_standalone(&self) -> u64 for registry-free hashing of leaf types.
  • Added TypeRegistry::register_desc(&mut self, desc: &'static TypeDesc) for direct schema registration.
  • Updated crates/prism-scene/src/rscn.rs encode/decode call sites to pass registry.type_registry().
  • Added unit tests in prism-reflect verifying nested struct schema changes alter the outer schema hash, nested structs inside containers (List, Optional, Array) are covered, and recursive schemas terminate properly.

Fixes #168

Self-check (scripts/pr_ready.py)

  • mode: full · base: origin/master · HEAD: 8897f24 · changed: 3 file(s)
  • crates: prism-reflect, prism-scene
Check Result Detail
whitespace / conflict markers ✅ clean
artifact / secret guard ✅ 3 file(s) checked
format (changed .rs) ✅ 3 file(s)
clippy (2 crates) ✅ -D warnings
test (2 crates) ✅ 83 passed
shader bindings drift ⏭️ no shader changes
editor fixture drift ⏭️ schema untouched
editor build ⏭️ editor untouched

Result: ✅ all checks passed

Make TypeDesc::schema_hash registry-aware (&TypeRegistry) to recursively hash nested struct schemas, cycle-safe via visiting set. Update RSCN encoder/decoder call sites with component registry's type_registry.

Fixes #168
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T17:30:11.223057Z
We couldn’t complete this review. Comment @codex review to try again.
8897f24 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Excurs1ons
Excurs1ons enabled auto-merge (squash) October 27, 2026 17:30
@github-actions github-actions Bot added area/scene prism-scene / 反射 / RSCN size/m 改动 100–499 行 labels Oct 27, 2026
@Excurs1ons
Excurs1ons merged commit 9b6a2b4 into master Oct 27, 2026
6 checks passed
@Excurs1ons
Excurs1ons deleted the fix/reflect-schema-hash-nested branch October 27, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/scene prism-scene / 反射 / RSCN size/m 改动 100–499 行

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(scene): TypeDesc::schema_hash does not cover nested struct schemas

1 participant