feat(lockfile): switch drift.lock to versioned TOML array-of-tables format#30
Merged
Conversation
…ormat drift.lock now uses TOML with `version = 1` and `[[bindings]]` tables. Each binding is a separate block with its own metadata, which reduces spurious merge conflicts on disjoint edits and adds explicit version tagging for future migrations. Compatibility: - drift check, drift status, and drift refs still read the legacy line-based format; pre-TOML lockfiles work unchanged. - The next mutating command (drift link, drift unlink) rewrites drift.lock to TOML. - After that rewrite, older drift binaries can no longer read the lockfile. Teams pinning drift in CI or dev environments should upgrade all installations together before running commands that modify drift.lock.
Require version = 1 for TOML lockfiles, reject unsupported or out-of-subset TOML constructs, and add basic-string escaping/decoding for lockfile values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
drift.locknow uses a versioned TOML format:The new format reduces spurious merge conflicts on disjoint edits (each binding is a separate block with its own metadata) and adds explicit lockfile versioning for future migrations.
Compatibility
drift check,drift status, anddrift refsparse the legacy line-based format unchanged.drift link,drift unlink) rewritesdrift.locktoversion = 1TOML.drift.lock.Doc updates
README.md— TOML examples for the lockfile and origin-qualified anchorsdocs/DESIGN.md— TOML data model, on-disk format section, and lockfile.zig descriptiondocs/DECISIONS.md— new §11 covering format, canonical sort, and forward-compat parser rules.claude/skills/drift/SKILL.md— TOML anchor and origin examplesdocs/CLI.md—drift linkdescription references the TOML lockfileTest plan
zig build test— all 293 tests pass, including new TOML parser/serializer tests, version handling, and the legacy-line-format compatibility testdrift checkclean on this repo's own (already-rewritten)drift.lock