v0.2 slice 1: remote head comparison + download path #1
No reviewers
Labels
No labels
agent
blocked
agent
new
agent
review
agent
working
complexity
high
complexity
low
priority
high
priority
low
priority
medium
risk
high
risk
low
risk
medium
type
bug
type
chore
type
feature
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tfks/dropbear!1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "v02-slice1-remote-head-download"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
v0.2 slice 1 of 5: remote head comparison + download path.
dropbear syncis no longer upload-only — it enumerates peer heads, fetches and verifies peer manifests, downloads missing blobs, and warns on conflicts. Conflict file generation lands in slice 3.What's in
internal/blobio(atomic per-blob download + restore-tmp orphan cleanup, extracted frominternal/restore).internal/download(peer enumeration, fetch+verify, decider, fail-fast worker pool).internal/objectstoreextended.List(ctx, prefix) iter.Seq2[ObjectInfo, error];ObjectInfo.Keynow populated by every method.internal/syncplanextended. Newdownload/conflict-skipactions,PeerDeviceIDfield on every action row, ↓/↑ summary line. JSON envelope is additive —schema_versionstays at 1.peers_skipped/conflicts_skippedcounters in JSON. Real-time progress emits inline viaOptions.Progressinstead of post-hoc CLI rendering — JSON mode stays silent until the final envelope.openspec/changes/v02-remote-head-download/.internal/upload/integration_test.gocovering two-roots convergence, cross-pull, conflict-skip, peer manifest tampering, peer-skip, empty peer set, and restore-tmp cleanup at sync entry.What's out (intentional)
Tombstone propagation, conflict-file generation, and sync modes are all deferred to later slices. Conflicting paths print a stderr warning every run until slice 3 lands the resolution mechanism — this is by design.
Test plan
just validategreen (format, vet, lint, race-tests at ~72% coverage, gitleaks clean, govulncheck 0 reachable)Follow-up
Slice 2 (tombstones + safer deletes) is the next slice. Wiki's "Where We Are" updated.
Add bidirectional sync foundation: `dropbear sync` now enumerates peer heads under dropbear/roots/<root_id>/heads/, fetches and verifies peer manifests, decides per-entry actions (download / already-present / conflict-skip), and downloads missing blobs with the same atomic temp-then-rename guarantee restore uses. Conflicts are detected and warned to stderr — full conflict-file generation lands in slice 3. New packages: internal/blobio (extracted from restore; shared per-blob atomic download primitive and restore-tmp orphan cleanup) and internal/download (peer-head enumeration, per-peer fetch+verify, entry merging with <multiple> sentinel for peer↔peer disagreement, per-entry decider, fail-fast bounded worker pool). Extended internal/objectstore with List(ctx, prefix) iter.Seq2[ObjectInfo, error]; ObjectInfo.Key is now populated by every method. internal/syncplan gained `download` and `conflict-skip` actions, a PeerDeviceID field on every action, an additive JSON envelope still at schema_version 1, and a ↓/↑ summary line. internal/upload (the sync engine) now runs phases in download → upload order, writes one end-of-run manifest reflecting merged on-disk state, introduces exit codes 11 (hash mismatch) and 12 (peer-list failure), and reports peers_skipped / conflicts_skipped counters in JSON output. Progress reporting moved into the engines via Options.Progress (io.Writer), replacing post-hoc CLI rendering; JSON mode stays silent until the final envelope. Spec lives in openspec/changes/v02-remote-head-download/{proposal,design,specs/,tasks}.md. Integration tests in internal/upload/integration_test.go cover two-roots convergence, cross-pull, conflict-skip, peer manifest tampering, peer-skip, empty peer set, and restore-tmp cleanup at sync entry. \`just validate\` green. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>