Add native reftable repository support - #2096
Conversation
f34e3ea to
b0b19ed
Compare
b0b19ed to
304e345
Compare
4e4fb59 to
8390a5c
Compare
fa3a3bd to
7bd1147
Compare
5d5f8c3 to
f7dd841
Compare
f7dd841 to
857bfae
Compare
7bd1147 to
9532ee6
Compare
857bfae to
47abe06
Compare
9532ee6 to
0aada04
Compare
47abe06 to
e6a9cc7
Compare
0aada04 to
e926966
Compare
1749a4a to
700f411
Compare
700f411 to
271d943
Compare
271d943 to
8f9b711
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
🐛 1 issue in files not directly in the diff
🐛 Starting commit position of one checkout can be overwritten by another checkout's history in reftable repositories (src/daemon/ref_cursor.rs:343-362)
The starting position of the current checkout is picked from every checkout's recorded history at once (refs_at_command_start at src/daemon/ref_cursor.rs:343-362) instead of only the one the command ran in, so a command run in one working copy can be measured against another working copy's position and its changes attributed wrongly.
Impact: In repositories that use the new ref storage and have more than one working copy checked out, commits can be recorded against the wrong starting point, producing missing or incorrect AI/human attribution.
HEAD entries from several worktree stacks collapse onto one "HEAD" map key
RefCursor is per repo family and reftable_entries persists across commands. replace_reftable_stack_entries (src/daemon/ref_cursor.rs:273-289) only clears entries whose path equals the stack it just re-read, so after commands from both the main worktree and a linked worktree the map holds two distinct HEAD keys: head_key(common_git_dir) (materialized from the common stack) and head_key(linked_git_dir) (from .git/worktrees/<name>/reftable).
refs_at_command_start then iterates self.reftable_entries.values() and, for every group whose reference == "HEAD", resolves it with head_position — the offset captured for the current command's worktree — and inserts it under the literal key "HEAD". Because HashMap iteration order is unspecified, whichever HEAD group is visited last wins, so the returned snapshot can carry another worktree's HEAD OID.
The files-backed path does not have this problem: refs_at_reflog_start_offsets (src/daemon/ref_cursor.rs:2672-2695) iterates cmd.reflog_start_offsets, which only ever contains the current worktree's HEAD key.
The new integration test reftable_linked_worktree_uses_its_own_head_log does not exercise this because every command runs in the linked worktree, so common-stack HEAD entries are never materialized (main_worktree stays false and had_common_head stays false).
View 9 additional findings in Devin Review.
Part 2 of 2 in the reftable support stack; depends on the async ingestion prerequisite.
Summary:
Tests: