Skip to content

Write vex.lock atomically #22

Closed

Description

@LunaStev

Problem

write_lockfile writes directly to vex.lock. A process interruption, disk-full error, or failed write can truncate the existing lockfile and destroy the last known reproducible graph.

Lockfile replacement is a transaction boundary and should not expose partially written contents.

Expected behavior

Vex should render and persist a complete replacement before atomically installing it as vex.lock.

Acceptance criteria

  • Write a uniquely named temporary file in the project directory.
  • Flush the completed content before replacing the destination.
  • Use a cross-platform atomic replacement strategy with clear Windows behavior.
  • Preserve the previous lockfile if preparation fails.
  • Clean up temporary files on handled failures.
  • Add tests that inject a write or replacement failure where practical.
  • Keep normalized lockfile output byte-for-byte deterministic.

Activity

  1. added
    bug
    technical debt
    dependencies
    on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdependenciestechnical debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions