Skip to content

feat: implement visitors#107

Open
sonicfromnewyoke wants to merge 9 commits into
codama-idl:mainfrom
sonicfromnewyoke:sonic/implement-visitors
Open

feat: implement visitors#107
sonicfromnewyoke wants to merge 9 commits into
codama-idl:mainfrom
sonicfromnewyoke:sonic/implement-visitors

Conversation

@sonicfromnewyoke

@sonicfromnewyoke sonicfromnewyoke commented Jun 14, 2026

Copy link
Copy Markdown

Problem

previously, codama-rs had the node model and a Rust-source -> IDL extractor but no IDL-level visitor layer at all - the TypeScript @codama/visitors-core and @codama/visitors were entirely absent, so a built IDL couldn't be traversed, transformed, or reshaped in Rust (the foundation every renderer/transform pipeline needs). This branch ports that whole layer and verifies it against the upstream TypeScript.

Summary of Changes

  • add codama-visitors-core crate: the syn::fold-style TransformVisitor framework
  • add codama-visitors crate: ported all 24 upstream transform visitors
  • add cross-language conformance suite verifying the Rust visitors against the real @codama/visitors TypeScript output (38 upstream cases: node-transforms + histogram + PDA-seed fill)

related to #106

@sonicfromnewyoke sonicfromnewyoke force-pushed the sonic/implement-visitors branch from 6ebfe0b to 437e6dd Compare June 14, 2026 15:32
@sonicfromnewyoke sonicfromnewyoke force-pushed the sonic/implement-visitors branch from 437e6dd to e41ca88 Compare June 14, 2026 15:33
@sonicfromnewyoke sonicfromnewyoke marked this pull request as ready for review June 14, 2026 15:37
@lorisleiva

Copy link
Copy Markdown
Member

Thanks for the PR! Would it be possible to split this is in several parts so we can discuss about the core architectural decisions first before going on to port all the main visitors from the JS side.

For instance, I would expect the core visitor crate to have some sort of trait defining what a visitor does. Perhaps there are several versions as well. One that mutate, one that provides an immutable copy (the JS side, my preference but I understand this may not be desired on the Rust side), some return another Node tree, some return any type T, etc.

I had a brief look at the PR and I could write a review with 30-ish comments but I think it's best to design this step by step so the reviews can be more focused and we can build on top of the decisions we make. 🙏

@sonicfromnewyoke

Copy link
Copy Markdown
Author

Thanks for the PR! Would it be possible to split this is in several parts so we can discuss about the core architectural decisions first before going on to port all the main visitors from the JS side.

For instance, I would expect the core visitor crate to have some sort of trait defining what a visitor does. Perhaps there are several versions as well. One that mutate, one that provides an immutable copy (the JS side, my preference but I understand this may not be desired on the Rust side), some return another Node tree, some return any type T, etc.

I had a brief look at the PR and I could write a review with 30-ish comments but I think it's best to design this step by step so the reviews can be more focused and we can build on top of the decisions we make. 🙏

sure, i'll split it for simplicity of review

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