Linked designs: one changed while the assembly was closed is read again when it opens (#9739) (#9872)

* Claim #9739

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Linked designs: one changed while the assembly was closed is read when it opens (#9739)

A link now keeps the SHA-256 of its design file's bytes as the assembly
last read them (DesignLink::file_sha256, a pending format change), set by
Insert Design, Relink, Extract to File and Update Links. component.links
reports `changed` from it, hashing a file again only when its time or
size changed (vfs::design_path_stamp, behind the design-path rule). The
app treats a link it meets for the first time whose file changed as not
read yet, so opening an assembly, in its own tab or in place of the blank
design, reads those parts again as a tab coming back does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Linked designs: read what changed last when a design opens in place of the blank one (#9739)

A read is taken up only by the design revision it started from, and
adopt bumped the revision after starting it, so the read was dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
austin62jake
2026-10-31 07:28:24 +00:00
committed by GitHub
parent bfd6aa9b7d
commit 3c0d4e120e
8 changed files with 199 additions and 23 deletions
+13
View File
@@ -2628,6 +2628,19 @@ pub struct DesignLink {
/// local overrides and survive a source update. Older links start with no baseline.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub inherited: Vec<LinkedBodyProperties>,
/// SHA-256 of the design file's bytes as this design last read them ([`Self::file_digest`]):
/// opened again, this design tells which linked files changed meanwhile (#9739). Links made
/// before it was kept have none and are taken as up to date.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub file_sha256: Option<String>,
}
impl DesignLink {
/// What [`Self::file_sha256`] keeps for a design file's `bytes`.
pub fn file_digest(bytes: &[u8]) -> String {
use sha2::{Digest, Sha256};
format!("{:x}", Sha256::digest(bytes))
}
}
/// The values last inherited by a linked body, not another editable material library.
@@ -0,0 +1,5 @@
//! A linked component's link saves `file_sha256`, the SHA-256 of the linked design file's bytes
//! as the assembly last read them, so an assembly opened again knows which linked designs changed
//! while it was closed (#9739). Older designs read unchanged: their links have no digest and are
//! taken as up to date until Update Links reads them. The last release refuses the newer format
//! and asks for an update instead of dropping the digests.