Skip to content

fix: IO tools report failures as errors (#218) - #225

Merged
gsdali merged 1 commit into
mainfrom
fix-218-io
Oct 9, 2026
Merged

gsdali merged 1 commit into
mainfrom
fix-218-io

Conversation

@gsdali

@gsdali gsdali commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

What & why

IOTools returned isError: false on failure paths, and two try? store.write(...) calls swallowed a failed manifest write.

Changed to isError: true:

  • read_brep: BREP file not found, body id already exists, manifest write failure.
  • import_file: File not found, format not determinable, manifest write failure.
  • export_scene: No scene loaded, Body ids not found, "No bodies to export." (the call was asked to produce a file and produced none, so I treated it as a failure; flag if you would rather keep it informational).

Left deliberately: import_file "Format auto-detection failed." (.auto after ImportFormat.resolve), which looks unreachable, so I could not write a test that reaches it.

Refs #218

Checklist

  • New or changed behavior is covered by a unit test in the same PR (IOToolsErrorPathTests, 5 tests). Each asserts isError and the error text; mutating paths assert manifest.json bytes unchanged.

  • Proven to fail: tests written first and run against the unfixed source.

Site Test Red before fix Green after
read_brep file missing, id exists readBrepErrors yes, 2 issues yes
read_brep manifest write readBrepManifestWriteFails yes, 2 issues yes
import_file file missing, no format importFileErrors yes, 2 issues yes
import_file manifest write importFileManifestWriteFails yes, 2 issues yes
export_scene no scene, unknown ids, empty scene exportSceneErrors yes, 3 issues yes

Write failure is injected by marking manifest.json immutable (.immutable attribute): readable, but the atomic replace in ManifestStore.write fails.

Full swift test: 277 tests in 45 suites pass.

Notes for the reviewer

  • The body file is already on disk when the manifest write fails; the error reports the write failure and does not roll back.

🤖 Generated with Claude Code

read_brep, import_file and export_scene returned isError false on bad input,
and two try? store.write calls swallowed a failed manifest write. Refs #218.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@kilo-code-bot

kilo-code-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • Sources/OCCTMCPCore/Tools/IOTools.swift
  • SwiftTests/OCCTMCPCoreTests/IOToolsErrorPathTests.swift

Reviewed by nemotron-3-ultra-550b-a55b:free · Input: 199K · Output: 7.3K · Cached: 99.4K

@gsdali
gsdali merged commit a45c02e into main Oct 9, 2026
6 checks passed
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