Skip to content

feat: update to template_metadata 0.5 with supersedes and commit_hash#122

Open
sdbondi wants to merge 1 commit intomainfrom
feat/template-metadata-0.5
Open

feat: update to template_metadata 0.5 with supersedes and commit_hash#122
sdbondi wants to merge 1 commit intomainfrom
feat/template-metadata-0.5

Conversation

@sdbondi
Copy link
Copy Markdown
Member

@sdbondi sdbondi commented Apr 15, 2026

Summary

  • Bump tari_ootle_template_metadata to 0.5 and tari_ootle_template_build to 0.5
  • Add --supersedes CLI arg to tari template init (interactive prompt + Cargo.toml writer)
  • Display commit_hash and supersedes fields in tari template inspect and tari template publish
  • Temporary [patch.crates-io] section for local Ootle path deps until next coordinated release

Test plan

  • cargo test — all 7 tests pass
  • Manual: tari template init --supersedes <addr> writes to Cargo.toml
  • Manual: tari template inspect displays new fields

… support

- Bump tari_ootle_template_metadata to 0.5
- Add --supersedes CLI arg to `tari template init` with interactive prompt
- Display commit_hash and supersedes in `tari template inspect` and `tari template publish`
- Add [patch.crates-io] for local Ootle path deps until next release
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request bumps the tari_ootle_template_metadata version to 0.5 and introduces a supersedes field to template metadata, allowing users to link a new template to a previous version. Changes include CLI updates for metadata initialization, inspection, and publishing, along with various dependency updates in Cargo.lock. Review feedback highlights a portability issue caused by relative path overrides in Cargo.toml and suggests implementing input validation and trimming for the new supersedes field.

Comment thread Cargo.toml
Comment on lines +30 to +40
[patch.crates-io]
tari_ootle_template_metadata = { path = "../dan/crates/template_metadata" }
tari_ootle_template_build = { path = "../dan/crates/template_build" }
tari_engine = { path = "../dan/crates/engine" }
tari_engine_types = { path = "../dan/crates/engine_types" }
tari_ootle_common_types = { path = "../dan/crates/common_types" }
tari_ootle_transaction = { path = "../dan/crates/transaction" }
tari_template_lib_types = { path = "../dan/crates/template_lib_types" }
tari_ootle_walletd_client = { path = "../dan/clients/wallet_daemon_client" }
tari_ootle_wallet_sdk = { path = "../dan/crates/wallet/sdk" }
tari_bor = { path = "../dan/crates/tari_bor" }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The [patch.crates-io] section uses relative paths to a sibling directory (../dan/...). This makes the repository non-portable and will cause build failures for any developer or CI environment that does not have the dan repository checked out at that specific relative location. While the description notes this is temporary, it should be replaced with git dependencies (pointing to specific tags or commits) or removed before merging to the main branch to ensure the project remains buildable for all contributors.

documentation: args.documentation.clone(),
homepage: args.homepage.clone(),
logo_url: args.logo_url.clone(),
supersedes: args.supersedes.clone(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The supersedes value from CLI arguments should be trimmed and filtered to ensure that empty or whitespace-only strings are treated as None.

Suggested change
supersedes: args.supersedes.clone(),
supersedes: args.supersedes.as_ref().map(|s| s.trim().to_string()).filter(|s| !s.is_empty()),

Comment on lines +182 to +187
let supersedes: String = Input::new()
.with_prompt("Supersedes template address (64-char hex, leave empty to skip)")
.default(args.supersedes.clone().unwrap_or_default())
.allow_empty(true)
.interact_text()?;
let supersedes = if supersedes.is_empty() { None } else { Some(supersedes) };
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The supersedes input should be validated to ensure it matches the expected 64-character hex format mentioned in the prompt. Additionally, the input should be trimmed to handle accidental whitespace.

Suggested change
let supersedes: String = Input::new()
.with_prompt("Supersedes template address (64-char hex, leave empty to skip)")
.default(args.supersedes.clone().unwrap_or_default())
.allow_empty(true)
.interact_text()?;
let supersedes = if supersedes.is_empty() { None } else { Some(supersedes) };
let supersedes: String = Input::new()
.with_prompt("Supersedes template address (64-char hex, leave empty to skip)")
.default(args.supersedes.as_ref().map(|s| s.trim()).unwrap_or_default().to_string())
.allow_empty(true)
.validate_with(|input: &String| -> Result<(), &str> {
let trimmed = input.trim();
if trimmed.is_empty() {
return Ok(());
}
if trimmed.len() != 64 {
return Err("Template address must be 64 characters long");
}
if !trimmed.chars().all(|c| c.is_ascii_hexdigit()) {
return Err("Template address must be a hex string");
}
Ok(())
})
.interact_text()?;
let supersedes = supersedes.trim();
let supersedes = if supersedes.is_empty() { None } else { Some(supersedes.to_string()) };

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.

1 participant