Skip to content

feat(hydro_lang): ungate ir_json from runtime_support#2855

Draft
jhellerstein wants to merge 3 commits into
mainfrom
ungate-ir-json
Draft

feat(hydro_lang): ungate ir_json from runtime_support#2855
jhellerstein wants to merge 3 commits into
mainfrom
ungate-ir-json

Conversation

@jhellerstein

@jhellerstein jhellerstein commented May 8, 2026

Copy link
Copy Markdown
Contributor

Tiny change: ir_json() only needs serde_json, not the full runtime (dfir_rs). Gate it on the viz dep which enables serde_json.

ir_json() only needs serde_json, not the full runtime (dfir_rs).
Gate it on the serde_json optional dep directly so it's available
whenever any feature enables serde_json (viz, maelstrom_runtime,
trybuild, or runtime_support).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the feature gating for BuiltFlow::ir_json() so that JSON IR serialization is available whenever serde_json is enabled, rather than requiring the heavier runtime_support feature (and its dfir_rs dependency).

Changes:

  • Switch BuiltFlow::ir_json() to be #[cfg(feature = "serde_json")] instead of #[cfg(feature = "runtime_support")].

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hydro_lang/src/compile/built.rs Outdated
Comment thread hydro_lang/src/compile/built.rs Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 8, 2026

Copy link
Copy Markdown

Deploying hydro with  Cloudflare Pages  Cloudflare Pages

Latest commit: 09a3ba2
Status: ✅  Deploy successful!
Preview URL: https://ee06d864.hydroflow.pages.dev
Branch Preview URL: https://ungate-ir-json.hydroflow.pages.dev

View logs

Add IrJson variant to GraphType enum so paxos and map_reduce examples
can output serialized IR via --graph ir-json. Extract ir_to_json()
helper in compile::ir for shared use by BuiltFlow::ir_json() and
GraphApi::render().

Also adds a paxos_ir_json snapshot test in paxos_bench.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Comment on lines +261 to +263
let json = hydro_lang::compile::ir::serialize_dedup_shared(|| {
serde_json::to_string_pretty(built.ir()).unwrap()
});
/// Serialize a slice of [`HydroRoot`]s to a JSON string with shared-node deduplication.
#[cfg(feature = "viz")]
pub fn ir_to_json(ir: &[HydroRoot]) -> Result<String, serde_json::Error> {
serialize_dedup_shared(|| serde_json::to_string(ir))
Comment thread hydro_lang/src/viz/api.rs
Comment on lines +43 to +45
crate::viz::config::GraphType::IrJson => {
crate::compile::ir::ir_to_json(self.ir).expect("failed to serialize IR to JSON")
}
@MingweiSamuel MingweiSamuel force-pushed the main branch 2 times, most recently from a15a670 to e70eab6 Compare June 11, 2026 18:42
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.

3 participants