Skip to content

Conversation

@mduthey
Copy link
Contributor

@mduthey mduthey commented Sep 30, 2025

Summary by CodeRabbit

  • New Features

    • Interactive transaction construction CLI: wizard, add-input, add-output, and build subcommands integrated into the tx command.
  • Documentation

    • Added TX3 examples (transfer, mint_token, mint_with_script) and expanded docs for tx, search, and overall usage with examples and quick-start guidance.
  • Chores

    • Bumped dependencies and removed a crate keyword from metadata.
  • Bug Fixes

    • Table output now displays transaction hash as the raw hash string.

@mduthey mduthey requested a review from scarmuega as a code owner September 30, 2025 13:24
@coderabbitai
Copy link

coderabbitai bot commented Sep 30, 2025

Walkthrough

Adds a new tx3 transaction construction CLI with subcommands (wizard, add-input, add-output, build), a TransactionBuilder utility for interactive AST editing and tx3 generation, three TX3 examples plus README, a small tx invoke output tweak, and crate dependency/version bumps.

Changes

Cohort / File(s) Summary
Crate metadata & deps
Cargo.toml
Removes "cardano" from keywords; bumps tx3-lang and tx3-cardano from 0.11.10.11.5.
Examples & docs
examples/README.md, docs/commands/*, docs/usage.mdx
Adds examples README and multiple docs pages (docs/commands/tx.mdx, docs/commands/search.mdx, docs/commands/_meta.yml, docs/usage.mdx) describing tx workflow, search, and usage; UI imports adjusted.
TX3 example files
examples/transfer.tx3, examples/mint_token.tx3, examples/mint_with_script.tx3
Adds three TX3 example transactions: transfer, mint_token, and mint_with_script (policy/asset/mint/witness details included).
Construct CLI: core builder
src/tx/construct/common.rs
New TransactionBuilder type with new, from_ast, interactive collect_inputs/collect_outputs, and generate_tx3_content.
Construct CLI: subcommands
src/tx/construct/wizard.rs, src/tx/construct/add_input.rs, src/tx/construct/add_output.rs, src/tx/construct/build.rs
Adds subcommand modules exposing Args and pub async fn run(...); read/write .ast, collect inputs/outputs interactively or skip prompts, and generate/write .tx3.
Construct CLI: wiring
src/tx/construct/mod.rs, src/tx/mod.rs
New construct module, Args/Commands enum with subcommands, dispatcher that wires Construct(construct::Args) into tx command routing.
Invoke output tweak
src/tx/invoke.rs
Table output now prints the raw Tx hash directly (was hex-encoded).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as "cshell tx (CLI)"
  participant Construct as "tx construct (subcommand)"
  participant TB as "TransactionBuilder"
  participant FS as "File System"

  User->>CLI: cshell tx construct --tx3-file <path> <subcommand>
  CLI->>Construct: dispatch subcommand
  Construct->>FS: read `<path>.ast` (if exists)
  Construct->>TB: TransactionBuilder::from_ast(ast_path)
  alt Wizard
    Construct->>TB: generate_tx3_content()
    TB-->>Construct: tx3 content
    Construct->>FS: write `<path>.tx3` and `<path>.ast`
  else AddInput / AddOutput
    Construct->>TB: collect_inputs()/collect_outputs()
    TB-->>Construct: updated AST
    Construct->>FS: write `<path>.ast`
  else Build
    Construct->>TB: generate_tx3_content()
    TB-->>Construct: tx3 content
    Construct->>FS: write `<path>.tx3`
  end
  Construct-->>CLI: Result<()>
  CLI-->>User: completion message
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

Hop-hop, I tweak an AST tonight,
I nibble bytes and set outputs right.
A wizard guides, inputs neatly spawned,
Coins are minted, txs are drawn.
Files saved—builder hops along! 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely highlights the addition of the transaction builder feature and associated examples, which are the primary changes introduced by this pull request. It avoids generic terms and clearly signals a new feature implementation.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3415bb and 170403d.

📒 Files selected for processing (4)
  • docs/commands/_meta.yml (1 hunks)
  • docs/commands/search.mdx (1 hunks)
  • docs/commands/tx.mdx (1 hunks)
  • docs/usage.mdx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • docs/commands/_meta.yml
  • docs/commands/search.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (9)
src/tx/construct/mod.rs (1)

33-41: Add a lightweight trace of the selected subcommand.

Helps correlate runs without logging args/ctx.

 #[instrument("construct", skip_all)]
 pub async fn run(args: Args, ctx: &crate::Context) -> anyhow::Result<()> {
-    match args.command {
+    let cmd = match &args.command {
+        Commands::Wizard(_) => "wizard",
+        Commands::AddInput(_) => "add-input",
+        Commands::AddOutput(_) => "add-output",
+        Commands::Build(_) => "build",
+    };
+    tracing::debug!(cmd, "dispatching construct subcommand");
+    match args.command {
         Commands::Wizard(args) => wizard::run(args, ctx).await,
         Commands::AddInput(args) => add_input::run(args, ctx).await,
         Commands::AddOutput(args) => add_output::run(args, ctx).await,
         Commands::Build(args) => build::run(args, ctx).await,
     }
 }
src/tx/construct/add_output.rs (2)

7-12: Improve CLI ergonomics for file args.

Provide shell hints for file paths.

-#[derive(Parser, Clone)]
+#[derive(Parser, Clone)]
 pub struct Args {
     /// Path for tx3 file to create the transaction
-    #[arg(long)]
+    #[arg(long, value_hint = clap::ValueHint::FilePath)]
     tx3_file: PathBuf,
 }

14-15: Optional: record the target file in the span.

Keeps traces useful while still skipping arg dumps.

-#[instrument("add-output", skip_all)]
+#[instrument(name = "add-output", skip_all)]
 pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
+    tracing::debug!(file = %args.tx3_file.display(), "adding output");
@@
     println!("\n✅ Output added successfully!");
-    println!("📄 File saved to: {}", ast_path_buf.display());
+    println!("📄 File saved to: {}", ast_path_buf.display());

Also applies to: 28-31

src/tx/construct/add_input.rs (2)

7-12: Improve CLI ergonomics for file args.

Provide shell hints for file paths.

 #[derive(Parser, Clone)]
 pub struct Args {
     /// Path for tx3 file to create the transaction
-    #[arg(long)]
+    #[arg(long, value_hint = clap::ValueHint::FilePath)]
     tx3_file: PathBuf,
 }

14-16: Optional: record the target file in the span.

Consistent with other subcommands.

-#[instrument("add-input", skip_all)]
+#[instrument(name = "add-input", skip_all)]
 pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
+    tracing::debug!(file = %args.tx3_file.display(), "adding input");
@@
     println!("\n✅ Input added successfully!");
     println!("📄 File saved to: {}", ast_path_buf.display());

Also applies to: 28-31

src/tx/construct/build.rs (2)

7-12: Guard against accidental overwrites; add --force and better error context.

Prevents data loss and improves diagnostics.

 #[derive(Parser, Clone)]
 pub struct Args {
     /// Path for tx3 file to create the transaction
-    #[arg(long)]
+    #[arg(long, value_hint = clap::ValueHint::FilePath)]
     tx3_file: PathBuf,
+    /// Overwrite existing tx3 file without prompting
+    #[arg(long, default_value_t = false)]
+    force: bool,
 }
 
 #[instrument("build", skip_all)]
 pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
     let ast_path_buf = args.tx3_file.with_extension("ast");
 
+    if args.tx3_file.exists() && !args.force {
+        anyhow::bail!(
+            "Refusing to overwrite existing file: {} (use --force)",
+            args.tx3_file.display()
+        );
+    }
+
     let tx_builder = super::common::TransactionBuilder::from_ast(&ast_path_buf)?;
@@
-    fs::write(&args.tx3_file, tx3_content)
-        .context("Failed to write tx3 file")?;
+    fs::write(&args.tx3_file, tx3_content)
+        .with_context(|| format!("Failed to write tx3 file: {}", args.tx3_file.display()))?;

Also applies to: 14-26


14-15: Optional: trace the target file.

Aligns with other subcommands’ trace hints.

-#[instrument("build", skip_all)]
+#[instrument(name = "build", skip_all)]
 pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
+    tracing::debug!(file = %args.tx3_file.display(), "building tx3 from AST");
@@
     println!("\n✅ Transaction created successfully!");
     println!("📄 File saved to: {}", args.tx3_file.display());

Also applies to: 27-31

examples/mint_with_script.tx3 (2)

1-6: Add a short header comment noting test-only values.

Clarify that the policy ID and script blob are sample data to avoid unintended mainnet reuse. If the TX3 DSL supports // comments, prepend a brief note.


30-33: Consider externalizing the large script blob.

Referencing a file (if supported by the DSL) improves readability and diffs; keeps examples concise.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2837f50 and 764e778.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • Cargo.toml (1 hunks)
  • examples/README.md (1 hunks)
  • examples/mint_token.tx3 (1 hunks)
  • examples/mint_with_script.tx3 (1 hunks)
  • examples/transfer.tx3 (1 hunks)
  • src/tx/construct/add_input.rs (1 hunks)
  • src/tx/construct/add_output.rs (1 hunks)
  • src/tx/construct/build.rs (1 hunks)
  • src/tx/construct/common.rs (1 hunks)
  • src/tx/construct/mod.rs (1 hunks)
  • src/tx/construct/wizard.rs (1 hunks)
  • src/tx/mod.rs (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
src/tx/construct/add_output.rs (5)
src/tx/construct/add_input.rs (1)
  • run (15-32)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/wizard.rs (1)
  • run (16-53)
src/tx/construct/common.rs (1)
  • from_ast (50-62)
src/tx/construct/wizard.rs (5)
src/tx/construct/add_input.rs (1)
  • run (15-32)
src/tx/construct/add_output.rs (1)
  • run (15-32)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/common.rs (2)
  • new (17-48)
  • from_ast (50-62)
src/tx/construct/common.rs (1)
src/wallet/types.rs (1)
  • address (113-135)
src/tx/construct/build.rs (5)
src/tx/construct/add_input.rs (1)
  • run (15-32)
src/tx/construct/add_output.rs (1)
  • run (15-32)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/wizard.rs (1)
  • run (16-53)
src/tx/construct/common.rs (1)
  • from_ast (50-62)
src/tx/construct/mod.rs (4)
src/tx/construct/add_input.rs (1)
  • run (15-32)
src/tx/construct/add_output.rs (1)
  • run (15-32)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/wizard.rs (1)
  • run (16-53)
src/tx/construct/add_input.rs (5)
src/tx/construct/add_output.rs (1)
  • run (15-32)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/wizard.rs (1)
  • run (16-53)
src/tx/construct/common.rs (1)
  • from_ast (50-62)
🪛 GitHub Actions: Clippy
src/tx/construct/common.rs

[error] 6-6: unused import: hex::ToHex


[error] 52-52: clippy: needlessly_borrows_for_generic_args. Change fs::read_to_string(&ast_path_buf) to fs::read_to_string(ast_path_buf)


[error] 171-175: clippy: manual_map. Replace manual map pattern with output_name.as_ref().map(|name| tx3_lang::ast::Identifier::new(name.clone()))


[error] 231-236: clippy: collapsible_match. Consider using if let instead of match for single-pattern destructuring


[error] 239-244: clippy: collapsible_match. Consider using if let instead of match for single-pattern destructuring


[error] 247-256: clippy: collapsible_match. Consider using if let instead of match for single-pattern destructuring


[error] 275-280: clippy: single-match. Use if let for destructuring a single pattern


[error] 283-292: clippy: single-match. Use if let for destructuring a single pattern

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: integration
🔇 Additional comments (5)
Cargo.toml (1)

17-18: Dependency bump aligns with construct tooling

Line 17 and Line 18: Updating both tx3-lang and tx3-cardano to 0.11.5 keeps the CLI in sync with the new transaction builder capabilities introduced in this PR.

examples/mint_token.tx3 (1)

3-27: Mint example covers balances cleanly

Line 3 through Line 27: The example walks through token creation while preserving the source balance after fees, making it a solid template for users.

examples/README.md (1)

1-72: Docs match the new workflows

Line 1 through Line 72: Clear prerequisites and command snippets give users everything needed to run the added TX3 examples.

examples/transfer.tx3 (1)

4-21: Transfer example handles change

Line 4 through Line 21: The transfer template accounts for both the receiver payout and sender change after fees—good baseline example.

src/tx/mod.rs (1)

10-44: Construct command wired correctly

Line 10 through Line 44: Registering the construct module and delegating via the new enum variant cleanly exposes the builder workflow in the CLI.

Comment on lines 1 to 32
use std::{fs, path::PathBuf};

use anyhow::{Result, Context};
use clap::Parser;
use tracing::instrument;

#[derive(Parser, Clone)]
pub struct Args {
/// Path for tx3 file to create the transaction
#[arg(long)]
tx3_file: PathBuf,
}

#[instrument("add-output", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");

let mut tx_builder = super::common::TransactionBuilder::from_ast(&ast_path_buf)?;

tx_builder.collect_outputs(true)?;

let ast = tx_builder.ast.clone();

// Write to AST file
fs::write(&ast_path_buf, serde_json::to_string_pretty(&ast).unwrap())
.context("Failed to write tx3 AST file")?;

println!("\n✅ Output added successfully!");
println!("📄 File saved to: {}", ast_path_buf.display());

Ok(())
} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Search and fix similar unwraps across the PR.

There are identical patterns in sibling modules (e.g., add_input.rs). Run this to find them.


🏁 Script executed:

#!/bin/bash
rg -nP 'to_string_pretty\([^)]*\)\.unwrap\(\)' -S --glob '!target/**'

Length of output: 148


🏁 Script executed:

#!/bin/bash
# Search for serde_json::to_string_pretty(...).unwrap across Rust source (excluding target directory)
rg -nP --type=rs 'serde_json::to_string_pretty\([^)]*\)\.unwrap' --glob '!target/**'

Length of output: 26


🏁 Script executed:

#!/bin/bash
# Search for serde_json::to_string_pretty(...).unwrap across Rust source (excluding target directory)
rg -nP 'to_string_pretty\([^)]*\)\.unwrap\(\)' -g '*.rs' --glob '!target/**'

Length of output: 678


Remove .unwrap() on serde_json::to_string_pretty and propagate errors

  • In src/types.rs (lines 86, 127) and src/provider/types.rs (lines 355, 377): replace .unwrap() with ? or .context("failed to serialize").
  • In src/tx/construct/wizard.rs:46, add_input.rs:25, add_output.rs:25: apply the same error‐propagating change.
🤖 Prompt for AI Agents
In src/tx/construct/add_output.rs lines 1-32, remove the unwrap on
serde_json::to_string_pretty and propagate serialization errors: call
serde_json::to_string_pretty(&ast).context("Failed to serialize AST to JSON")?
to get the JSON string, then pass that string to fs::write(&ast_path_buf,
json).context("Failed to write tx3 AST file")? so both serialization and
file-write errors are properly returned.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/tx/invoke.rs (2)

1-1: Replace unwrap on hex decode with fallible handling

Avoid panics on malformed tx by propagating an error with context.

Apply:

- use anyhow::{bail, Result};
+ use anyhow::{bail, Context, Result};
@@
-    let cbor = hex::decode(tx).unwrap();
+    let cbor = hex::decode(tx)
+        .context("Invalid hex in tx field returned by resolve_tx")?;

Based on learnings

Also applies to: 68-71


83-91: Don’t unwrap JSON serialization

Propagate serialization failure instead of panicking.

-            println!(
-                "{}",
-                serde_json::to_string_pretty(&json!({
-                    "hash": hash,
-                    "cbor": hex::encode(&cbor),
-                }))
-                .unwrap()
-            );
+            let payload = json!({
+                "hash": hash.clone(),
+                "cbor": hex::encode(&cbor),
+            });
+            println!(
+                "{}",
+                serde_json::to_string_pretty(&payload)
+                    .context("Failed to serialize JSON output")?
+            );

Based on learnings

♻️ Duplicate comments (3)
src/tx/construct/common.rs (3)

109-114: Reject invalid UTxO data without panicking

hex::decode(...).unwrap() and parse::<u64>().unwrap() will crash on bad input. Parse with context and return an error (or re-prompt).

-            input_block.fields.push(tx3_lang::ast::InputBlockField::Ref(
-                tx3_lang::ast::DataExpr::UtxoRef(tx3_lang::ast::UtxoRef {
-                    txid: hex::decode(parts[0]).unwrap(),
-                    index: parts[1].parse::<u64>().unwrap(),
-                    span: tx3_lang::ast::Span::default(),
-                }),
-            ));
+            let txid = hex::decode(parts[0])
+                .context("Invalid txid hex in Utxo Ref (expected 32-byte hex)")?;
+            let index = parts[1]
+                .parse::<u64>()
+                .context("Invalid UTxO index (must be an integer)")?;
+
+            input_block.fields.push(tx3_lang::ast::InputBlockField::Ref(
+                tx3_lang::ast::DataExpr::UtxoRef(tx3_lang::ast::UtxoRef {
+                    txid,
+                    index,
+                    span: tx3_lang::ast::Span::default(),
+                }),
+            ));

Based on learnings


120-126: Parse min_amount fallibly

Avoid unwrap() so interactive flows don’t crash on typos.

-            input_block.fields.push(tx3_lang::ast::InputBlockField::MinAmount(
-                tx3_lang::ast::DataExpr::StaticAssetConstructor(tx3_lang::ast::StaticAssetConstructor {
-                    amount: Box::new(tx3_lang::ast::DataExpr::Number(min_amount.parse::<i64>().unwrap())),
-                    span: tx3_lang::ast::Span::default(),
-                    r#type: tx3_lang::ast::Identifier::new("Ada".to_string()),
-                })
-            ));
+            let min_amount_value = min_amount
+                .parse::<i64>()
+                .context("Invalid minimum amount (must be an integer)")?;
+
+            input_block.fields.push(tx3_lang::ast::InputBlockField::MinAmount(
+                tx3_lang::ast::DataExpr::StaticAssetConstructor(tx3_lang::ast::StaticAssetConstructor {
+                    amount: Box::new(tx3_lang::ast::DataExpr::Number(min_amount_value)),
+                    span: tx3_lang::ast::Span::default(),
+                    r#type: tx3_lang::ast::Identifier::new("Ada".to_string()),
+                })
+            ));

Based on learnings


191-197: Gracefully parse output amount

Same panic risk as inputs; parse with context.

-            output_block.fields.push(tx3_lang::ast::OutputBlockField::Amount(
-                Box::new(tx3_lang::ast::DataExpr::StaticAssetConstructor(tx3_lang::ast::StaticAssetConstructor {
-                    amount: Box::new(tx3_lang::ast::DataExpr::Number(amount.parse::<i64>().unwrap())),
-                    span: tx3_lang::ast::Span::default(),
-                    r#type: tx3_lang::ast::Identifier::new("Ada".to_string()),
-                }))
-            ));
+            let amount_value = amount
+                .parse::<i64>()
+                .context("Invalid Ada amount (must be an integer)")?;
+
+            output_block.fields.push(tx3_lang::ast::OutputBlockField::Amount(
+                Box::new(tx3_lang::ast::DataExpr::StaticAssetConstructor(
+                    tx3_lang::ast::StaticAssetConstructor {
+                        amount: Box::new(tx3_lang::ast::DataExpr::Number(amount_value)),
+                        span: tx3_lang::ast::Span::default(),
+                        r#type: tx3_lang::ast::Identifier::new("Ada".to_string()),
+                    }
+                ))
+            ));

Based on learnings

🧹 Nitpick comments (2)
src/tx/construct/common.rs (2)

44-46: Avoid cloning the whole AST

ast is owned; cloning here is unnecessary and expensive.

-        Self {
-            ast: ast.clone(),
-            def_index: def_index.unwrap(),
-        }
+        let def_index = def_index.unwrap();
+        Self { ast, def_index }

202-205: UX consistency: align “Add another …?” defaults

Inputs default to false while outputs default to true. Consider making both false for consistency.

-            let add_more = Confirm::new("Add another output?")
-                .with_default(true)
+            let add_more = Confirm::new("Add another output?")
+                .with_default(false)
                 .prompt()?;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 764e778 and 25c613f.

📒 Files selected for processing (2)
  • src/tx/construct/common.rs (1 hunks)
  • src/tx/invoke.rs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/tx/construct/common.rs (1)
src/wallet/types.rs (1)
  • address (113-135)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unit
  • GitHub Check: integration
🔇 Additional comments (1)
src/tx/invoke.rs (1)

94-96: Print hash directly: LGTM (avoid double-encoding). Please confirm type.

Assuming TxEnvelope.hash is already a hex string, this is correct and fixes the previous double-encode risk. If it’s raw bytes, this will not Display and will fail to compile—ensure both JSON/Table paths use the same hex-string representation.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25c613f and e3415bb.

📒 Files selected for processing (4)
  • src/tx/construct/add_input.rs (1 hunks)
  • src/tx/construct/add_output.rs (1 hunks)
  • src/tx/construct/common.rs (1 hunks)
  • src/tx/construct/wizard.rs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tx/construct/common.rs
🧰 Additional context used
🧬 Code graph analysis (3)
src/tx/construct/wizard.rs (5)
src/tx/construct/add_input.rs (1)
  • run (15-33)
src/tx/construct/add_output.rs (1)
  • run (15-33)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/common.rs (2)
  • new (16-51)
  • from_ast (53-65)
src/tx/construct/add_output.rs (5)
src/tx/construct/add_input.rs (1)
  • run (15-33)
src/tx/construct/wizard.rs (1)
  • run (16-57)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/common.rs (1)
  • from_ast (53-65)
src/tx/construct/add_input.rs (5)
src/tx/construct/add_output.rs (1)
  • run (15-33)
src/tx/construct/wizard.rs (1)
  • run (16-57)
src/tx/construct/build.rs (1)
  • run (15-31)
src/tx/construct/mod.rs (1)
  • run (34-41)
src/tx/construct/common.rs (1)
  • from_ast (53-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unit
  • GitHub Check: integration

Comment on lines +14 to +16
#[instrument("add-input", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix invalid tracing::instrument usage

#[instrument("add-input", skip_all)] won’t compile—the attribute macro requires named parameters. Use the supported form instead.

-#[instrument("add-input", skip_all)]
+#[instrument(name = "add-input", skip_all)]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[instrument("add-input", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
#[instrument(name = "add-input", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
🤖 Prompt for AI Agents
In src/tx/construct/add_input.rs around lines 14 to 16, the attribute macro is
using positional parameters which won't compile; change the attribute to use
named parameters, e.g. replace #[instrument("add-input", skip_all)] with
#[instrument(name = "add-input", skip_all)] so the macro receives a named `name`
argument while retaining the `skip_all` flag.

Comment on lines +14 to +16
#[instrument("add-output", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix invalid tracing::instrument usage

#[instrument("add-output", skip_all)] does not compile—the macro expects key/value pairs like name = "add-output" rather than a bare string literal. Please switch to the supported syntax so the module builds.

-#[instrument("add-output", skip_all)]
+#[instrument(name = "add-output", skip_all)]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[instrument("add-output", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
#[instrument(name = "add-output", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
🤖 Prompt for AI Agents
In src/tx/construct/add_output.rs around lines 14 to 16, the tracing attribute
uses an unsupported bare string literal (`#[instrument("add-output",
skip_all)]`); replace it with the proper key/value form so the macro compiles,
e.g. use `#[instrument(name = "add-output", skip_all)]`, preserving skip_all and
any other attributes.

Comment on lines +15 to +17
#[instrument("wizard", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix invalid tracing::instrument usage

#[instrument("wizard", skip_all)] is not valid syntax; the macro expects named arguments. Update it so the module compiles.

-#[instrument("wizard", skip_all)]
+#[instrument(name = "wizard", skip_all)]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[instrument("wizard", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
#[instrument(name = "wizard", skip_all)]
pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> {
let ast_path_buf = args.tx3_file.with_extension("ast");
🤖 Prompt for AI Agents
In src/tx/construct/wizard.rs around lines 15 to 17, the tracing attribute uses
invalid positional syntax #[instrument("wizard", skip_all)]; change it to use
named arguments by replacing the attribute with the correct form that names the
instrument (e.g., use name = "wizard") while keeping skip_all, so the macro
compiles and the function remains async.

@scarmuega scarmuega merged commit e6e722a into txpipe:main Oct 20, 2025
10 checks passed
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