Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.57 KB

operation-database.md

File metadata and controls

40 lines (27 loc) · 1.57 KB

Operation Database

Trail stores a history of operations rather than only snapshots. Each operation records who changed the workspace, which root it changed from and to, which paths changed, and which parent operations it follows.

Operation Shape

The public Operation model contains:

  • change_id: stable operation identifier.
  • kind: operation type such as Init, ManualRecord, WatchRecord, LanePatch, LaneRecord, LaneMerge, Merge, or GitExport.
  • parents: parent operation IDs.
  • before_root and after_root: root objects before and after the operation.
  • branch: branch name.
  • actor: human, agent, or system actor.
  • session_id: optional durable lane session link.
  • message: optional human-readable message.
  • changes: file and line change summaries.
  • created_at: timestamp.

Roots and Refs

Branches and lane branches point to refs. Refs point to operations and roots. A root describes the full worktree state at that point.

This lets Trail answer questions such as:

  • What changed in this operation?
  • Which operation introduced this line?
  • Which branch root should be materialized?
  • Is a lane branch merge-ready?

Relationship to Git

Trail can import from and export to Git, but it is not just a Git wrapper. It tracks stable file IDs, line IDs, lane sessions, messages, approvals, test/eval gates, trace events, and merge queue state.

Code Facts Used

  • Operation model: trail/src/model/domain/operations.rs
  • Ref storage: trail/src/db/storage/refs.rs
  • Reports: trail/src/model/reports/worktree.rs, trail/src/model/reports/merge.rs