Asset descriptions can change: books.label_asset description, journaled as asset.described (with the old one), replayed, projected, shown in the journal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
swaitsandClaude Opus 5.5 committed 2026-10-15 12:43:28 -06:00
1 parent 7f199737ef
commit 6adc7b34c7
6 files changed
+127 -3

No files matched your search

+21 -3
View File
@@ -2561,7 +2561,7 @@ impl BooksServer {
#[tool(
name = "books.label_asset",
description = "Link a fixed asset to the entry that acquired it (acquisition_entry), or set or change its tag (the label on the thing: letters, digits, - _ . /, at most 32; unique ignoring case and never reused by another asset, even after a retag or disposal) and its manufacturer serial number. The asset is its id or current tag. Journaled. Print labels with books.asset_labels."
description = "Change a fixed asset's description, link it to the entry that acquired it (acquisition_entry), or set or change its tag (the label on the thing: letters, digits, - _ . /, at most 32; unique ignoring case and never reused by another asset, even after a retag or disposal) and its manufacturer serial number. The asset is its id or current tag. Journaled. Print labels with books.asset_labels."
)]
async fn label_asset(
&self,
@@ -2574,11 +2574,23 @@ impl BooksServer {
if clear && p.serial.is_some() {
return Err("pass serial or clear_serial, not both".into());
}
if p.tag.is_none() && p.serial.is_none() && !clear && p.acquisition_entry.is_none() {
if p.tag.is_none()
&& p.serial.is_none()
&& !clear
&& p.acquisition_entry.is_none()
&& p.description.is_none()
{
return Err(
"nothing to change: pass tag, serial, clear_serial, or acquisition_entry".into(),
"nothing to change: pass tag, serial, clear_serial, description, or acquisition_entry"
.into(),
);
}
if let Some(d) = &p.description {
store
.ledger()
.check_asset_description(id, d)
.map_err(|e| e.to_string())?;
}
if let Some(entry) = p.acquisition_entry {
store
.ledger()
@@ -2612,12 +2624,18 @@ impl BooksServer {
.set_asset_acquisition(id, entry)
.map_err(|e| e.to_string())?;
}
if let Some(d) = &p.description {
store
.set_asset_description(id, d)
.map_err(|e| e.to_string())?;
}
let a = store.ledger().get_asset(id).expect("resolved");
Ok(Json(LabelAssetOut {
asset_id: id,
tag: a.tag.clone(),
serial: a.serial.clone(),
acquisition_entry: a.acquired_by,
description: a.description.clone(),
}))
}
+5
View File
@@ -1537,6 +1537,9 @@ pub struct LabelAssetParams {
pub serial: Option<String>,
/// True to clear the serial number.
pub clear_serial: Option<bool>,
/// A new description (what it is, as the register and label print it).
/// Omit to keep it.
pub description: Option<String>,
/// Link the posted entry that put it on the books (purchase or
/// contribution; it must debit the asset's cost account and not be
/// reversed). Use after correcting that entry, to link the replacement.
@@ -1554,6 +1557,8 @@ pub struct LabelAssetOut {
pub serial: Option<String>,
/// The entry that acquired it, if linked.
pub acquisition_entry: Option<u64>,
/// Its description now.
pub description: String,
}
/// Parameters for `books.asset_labels`.