forked from longtao.wu/droboticflow
Add scripts/part_index_migration.py, which produces the missing part.json for a part that was delivered in the directory form. It reuses the package operator's own builder by loading the operator source the way the runner does, so a migrated index is structurally identical to an online package and byte-identical to what the same evidence would have produced, apart from a lineage.migratedFrom marker. A test compares both routes on one evidence set to keep the two from forking. The tool never writes object storage: publication has to go through the API/Worker path so the owner marker, conditional create and no-overwrite guarantees stay in effect. It refuses to run when the delivery directory lacks a completion manifest, when a slice has an unknown disposition, when the revision has no per-slice disposition evidence, and when the part already has a part.json with different bytes. Also fix a leak found while building this: the index wrote the operator's absolute workspace path into calibration[].path. It now records the logical delivery-relative path, matching the directory form's packages-manifest, and keeps the local location out of customer-facing output. Verification: 19 operator and migration tests pass. tests/backend failure set is identical to the HEAD baseline (25 failed, 829 subtests passed, 516 vs 525 passing), so no regression.