Skip to main content

STATE_VERSION

Constant STATE_VERSION 

Source
pub const STATE_VERSION: u32 = 2;
Expand description

The version of the state document this build writes and reads.

A file-backed state outlives the process that wrote it and is read by the next one, which makes it a stored contract like onevcs’s own registry document — and like that document, a version this build does not read is refused by name rather than guessed at. 2 is the shape the goldens in tests/golden/ hold, and those goldens are compared byte for byte, so a field that changes shape cannot reach a consumer without the diff saying so.

2 is what both sides learned when publishing and closing a session came through the interface: VcsState::policy, VcsState::closed_sessions, VcsState::publications, and HostState::titles. A document at version 1 is refused by name rather than read: it describes a provider that could not publish, and every session in it would read back as open — which for a journey asserting on a session it had closed is a wrong answer rather than a missing one.