# FCStd Web 保存/重开 gate ## FW-P2-002A-G - 状态:`completed` - 前置:`FW-P2-002A-S`、`FW-P2-002A-O` - 时间:2026-08-19 15:58 +0800 - revision:`4f4e9244e613ea2df06e70027074a562695048cb` ### 合同 同一 Web WASM runtime 创建一个 2x3x4 `Part::Box`,保存为 FCStd,恢复归档中的 Document.xml 和 BRep 数据,重新枚举对象并重算体积。 ### 实现差异 - Emscripten 下将 FCStd 读入 seekable memory stream,避免 zipios 在 Web filebuf 上的跨条目定位失败。 - 开始读取数据条目前清理底层 archive stream 状态。 - `XMLReader::readFiles()` 处理最后一个已注册文件后停止,不再对归档尾部执行无必要 seek。 - BRep stream restore 前清理 `Base::Reader` 状态,避免 EOF 状态与严格异常掩码冲突。 ### 回放 ```sh EM_CACHE=$PWD/build-web/emscripten-cache EM_FROZEN_CACHE=0 \ ninja -C build-web/configure FreeCADWebDocumentProbe -j8 node src/WebAssembly/FreeCADCoreProbe/part-box-smoke.js build-web/configure/bin node src/WebAssembly/FreeCADCoreProbe/document-smoke.js build-web/configure/bin node src/WebAssembly/FreeCADCoreProbe/document-smoke.js build-web/configure/bin unzip -t build-web/configure/bin/WebBox.FCStd ``` ### 结果 - Part smoke:构造=1,volume=24,非法尺寸错误固定为 `Length of box too small`,恢复=1。 - Document smoke 两次:1 文档、1 对象、类型 `Part::Box`、尺寸 `2x3x4`、重开体积 `24`、error 为空。 - ZIP 条目:`Document.xml`、`Box.Shape.brp`,`unzip -t` 无错误。 - WASM SHA-256:`25aa7c2df3835f71933e3c1fe7eca9f84b87101ef3439506e9e5d305ae2b881d`。 - JS SHA-256:`6c7bd27d97bd40d5c4e6d09c1a6b555cbf3873ee621af78a4ee2552c0e081679`。 - FCStd SHA-256:每次保存包含时间/UUID 元数据,大小和结构稳定但 hash 会变化;本次产物为 `6d297a6b020b2b711b42170d2abd44a0cf70a63ca76f61a40edd45279e44dcfb`。 ### 边界 不包含非法保存路径、事务、Undo/Redo、OPFS 同步和 GUI Document。 证据:`freecad-fcstd-open-gate-final-build.log`、`freecad-fcstd-open-gate-final-part-smoke.log`、`freecad-fcstd-open-gate-final-smoke-r1.log`、`freecad-fcstd-open-gate-final-smoke-r2.log`、`freecad-fcstd-open-gate-final-zip.log`、`freecad-fcstd-open-gate-final-hash.log`。