Skip to content

chore: make IDL internal components public for crate consumers#82

Merged
blockiosaurus merged 1 commit into
metaplex-foundation:masterfrom
txtx:feat/public-submodules
Feb 6, 2026
Merged

chore: make IDL internal components public for crate consumers#82
blockiosaurus merged 1 commit into
metaplex-foundation:masterfrom
txtx:feat/public-submodules

Conversation

@MicaiahReid

@MicaiahReid MicaiahReid commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Don't know if this is something you're open to, but if so, fixes #49 :)

@coderabbitai

coderabbitai Bot commented Jan 28, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • Refactor
    • Expanded the public API surface by making six core internal modules publicly accessible.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Six internal modules in shank-idl/src/lib.rs were changed from private to public visibility: idl_field, idl_instruction, idl_metadata, idl_type, idl_type_definition, and idl_variant. No functional or runtime logic changes occurred.

Changes

Cohort / File(s) Summary
Public module visibility exports
shank-idl/src/lib.rs
Changed 6 module declarations from private (mod) to public (pub mod): idl_field, idl_instruction, idl_metadata, idl_type, idl_type_definition, idl_variant

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: making internal IDL components public. It accurately reflects the changeset content.
Description check ✅ Passed The description references issue #49, which is related to the changeset's objective of making internal components public for external crate consumers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@shank-idl/src/lib.rs`:
- Around line 10-16: The idl_error_code module is private but its IdlErrorCode
type is exposed via the public Idl struct's errors field; change the module
declaration for idl_error_code (currently "mod idl_error_code;") to be public
("pub mod idl_error_code;") so external crates can import IdlErrorCode and
related items; update the module declaration where idl_error_code is declared to
match other public idl_* modules and ensure consumers can reference IdlErrorCode
when using Idl::errors.

Comment thread shank-idl/src/lib.rs
Comment on lines 10 to +16
mod idl_error_code;
mod idl_field;
mod idl_instruction;
mod idl_metadata;
mod idl_type;
mod idl_type_definition;
mod idl_variant;
pub mod idl_field;
pub mod idl_instruction;
pub mod idl_metadata;
pub mod idl_type;
pub mod idl_type_definition;
pub mod idl_variant;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the structure and usage of idl_error_code module

echo "=== Finding idl_error_code file ==="
fd -t f "idl_error_code" shank-idl/

echo ""
echo "=== Contents of idl_error_code.rs ==="
cat shank-idl/src/idl_error_code.rs

echo ""
echo "=== Check imports of idl_error_code in other modules ==="
rg "idl_error_code" shank-idl/src/ -A 2 -B 2

echo ""
echo "=== List all files in shank-idl/src ==="
ls -la shank-idl/src/

Repository: metaplex-foundation/shank

Length of output: 2377


🏁 Script executed:

#!/bin/bash
# Check if IdlErrorCode is re-exported from public modules

echo "=== Check idl.rs (public module) exports ==="
head -30 shank-idl/src/idl.rs

echo ""
echo "=== Check if IdlErrorCode is in public signatures ==="
rg "IdlErrorCode" shank-idl/src/idl.rs -B 3 -A 3

echo ""
echo "=== Full lib.rs to see the complete module structure ==="
cat shank-idl/src/lib.rs

echo ""
echo "=== Check if any public module re-exports IdlErrorCode ==="
rg "pub.*IdlErrorCode|pub use.*idl_error_code" shank-idl/src/

Repository: metaplex-foundation/shank

Length of output: 3811


Make idl_error_code module public for API consistency.

The IdlErrorCode struct is used in the public Idl struct's errors field but cannot be directly imported by external crate consumers because the module is private. Change line 10 from mod idl_error_code; to pub mod idl_error_code; to align with the other public idl_* modules and allow users to properly work with error code definitions in the public API.

🤖 Prompt for AI Agents
In `@shank-idl/src/lib.rs` around lines 10 - 16, The idl_error_code module is
private but its IdlErrorCode type is exposed via the public Idl struct's errors
field; change the module declaration for idl_error_code (currently "mod
idl_error_code;") to be public ("pub mod idl_error_code;") so external crates
can import IdlErrorCode and related items; update the module declaration where
idl_error_code is declared to match other public idl_* modules and ensure
consumers can reference IdlErrorCode when using Idl::errors.

@blockiosaurus blockiosaurus merged commit 3da6272 into metaplex-foundation:master Feb 6, 2026
6 checks passed
@blockiosaurus

Copy link
Copy Markdown
Contributor

Looks good, thank you for the PR! This will be shipped in the next release, today.

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.

Consider making shank-idl sub-modules public

2 participants