0%

Publication and the replace-or-fail primitive (D2)

Goal

Two concurrent rebuilds of one identity yield a last-writer-wins current pointer with both generations present and no silently-discarded newer build.

Implementation Sketch

Derived from compiler_repo/docs/ori_lang/proposals/approved/binary-generation-lifecycle-proposal.md. Depends on the cache root, budget, collection pass, and D3a in-flight-reference primitive delivered by plans/cache-lifecycle/ (approved cache-lifecycle-proposal.md). Implement the work items in order.

Spec References

  • Approved proposal: compiler_repo/docs/ori_lang/proposals/approved/binary-generation-lifecycle-proposal.md
  • Depends on: compiler_repo/docs/ori_lang/proposals/approved/cache-lifecycle-proposal.md (D3a primitive, composed bound)
  • Umbrella invariant T4: compiler_repo/docs/ori_lang/proposals/approved/toolchain-philosophy-proposal.md

Work Items

  • Keep the content-first/visibility-second publication: write generation content to a create_new path, then switch the current pointer as a separate step
  • Add the replace-or-fail primitive — POSIX rename(2), Windows MoveFileExW with MOVEFILE_REPLACE_EXISTING — that atomically replaces and surfaces genuine failures; ban the Err(_) if destination.exists() => Ok(()) arm on the pointer path