-
Notifications
You must be signed in to change notification settings - Fork 4
feat: transaction builder and invoke examples #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (2)
⏰ 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)
Comment |
There was a problem hiding this 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
⛔ Files ignored due to path filters (1)
Cargo.lockis 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 toolingLine 17 and Line 18: Updating both
tx3-langandtx3-cardanoto 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 cleanlyLine 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 workflowsLine 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 changeLine 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 correctlyLine 10 through Line 44: Registering the
constructmodule and delegating via the new enum variant cleanly exposes the builder workflow in the CLI.
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this 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 handlingAvoid panics on malformed
txby 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 serializationPropagate 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()andparse::<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 falliblyAvoid
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 amountSame 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
astis 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 …?” defaultsInputs default to
falsewhile outputs default totrue. Consider making bothfalsefor 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
📒 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.hashis already a hex string, this is correct and fixes the previous double-encode risk. If it’s raw bytes, this will notDisplayand will fail to compile—ensure both JSON/Table paths use the same hex-string representation.
There was a problem hiding this 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
📒 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
| #[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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| #[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.
| #[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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| #[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.
| #[instrument("wizard", skip_all)] | ||
| pub async fn run(args: Args, _ctx: &crate::Context) -> Result<()> { | ||
| let ast_path_buf = args.tx3_file.with_extension("ast"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| #[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.
Summary by CodeRabbit
New Features
Documentation
Chores
Bug Fixes