fix(silo): pull assembly dependencies on all open paths (#337)

SiloOrigin.openDocument() bypassed open_item() when a local file
existed, skipping dependency pulling for assemblies. Silo_Pull also
skipped dependency pulling when no revisions had files but a local
file existed.

Changes:
- SiloOrigin.openDocument(): remove local-file shortcut, route all
  opens through open_item() which already handles dependency pulling
- Silo_Pull.Activated(): add _pull_dependencies() call before opening
  existing local assembly files in the no-revisions-have-files path

Closes #337
This commit is contained in:
2026-03-02 13:13:58 -06:00
parent cc6a79f1b1
commit 65b87ef605
2 changed files with 9 additions and 7 deletions

View File

@@ -1894,6 +1894,13 @@ class Silo_Pull:
if not has_any_file:
if existing_local:
FreeCAD.Console.PrintMessage(f"Opening existing local file: {existing_local}\n")
# Pull assembly dependencies before opening (#337)
try:
item = _client.get_item(part_number)
except Exception:
item = {}
if item.get("item_type") == "assembly":
_pull_dependencies(part_number)
FreeCAD.openDocument(str(existing_local))
else:
try:

View File

@@ -315,13 +315,8 @@ class SiloOrigin:
FreeCAD.Console.PrintError(f"Silo open failed: {e}\n")
return None
# Try to find existing local file by part number
# (UUID lookup would require API enhancement)
local_path = find_file_by_part_number(identity)
if local_path and local_path.exists():
return FreeCAD.openDocument(str(local_path))
# Download from Silo
# Route through open_item() which pulls assembly dependencies
# before opening, ensuring PropertyXLink references resolve (#337)
try:
doc = _sync.open_item(identity)
return doc