Commit 541b684
feat: add remote URL support to multi-repo hydration (PR #2827)
* /{cmd,internal}: add remote URL support to multi-repo hydration
Multi-repo hydration (`bd repo sync`) reads issues.jsonl from local
filesystem paths, predating beads' dolt remote support. This adds
remote URL support so hydration, `--repo`, and `bd repo add` can
accept dolt remote URLs (dolthub://, https://, s3://, etc.) alongside
local paths.
New internal/remotecache package manages cached dolt clones at
~/.cache/beads/remotes/<hash>/ with clone/pull/push lifecycle and
file-based locking for concurrent access.
Closes #2826
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: address review issues in remote hydration PR
- Fix gosec G306: tighten meta file permissions from 0644 to 0600
- Make lock polling context-aware (respects Ctrl+C / ctx cancellation)
- Replace defer cache.Push with explicit call (FatalError calls os.Exit,
which skips deferred functions — silent data loss on remote creates)
- Log remoteStore.Close() errors as warnings instead of discarding
- Quantify CacheKey birthday-bound collision risk in comment
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(remotecache): address code review findings from #2827
- Fix lock file race: remove os.Remove in releaseLock to prevent TOCTOU
race where another process's lock gets deleted; stale lock cleanup in
acquireLock handles orphaned files
- Add debug.Logf to writeMeta for error visibility
- Rename cacheErr to idiomatic err in repo sync remote block
- Escalate remote push failure to FatalError in create (silent warning
meant the remote never received the issue)
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(remotecache): defer store close, add Push test, add freshness TTL
- Replace defer-in-loop with eager close in repo sync (defer inside a
for loop leaks connections until function return)
- Add FreshFor TTL to Cache (default 30s) — Ensure() skips pull when
last pull is within the window, FreshFor=0 preserves always-pull
- Add TestPush: full round-trip integration test (clone → insert → push
→ re-clone → verify data)
- Add TestEnsureFreshFor: validates TTL skip and FreshFor=0 bypass
- Add concurrency doc comment to OpenStore
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>1 parent 5297286 commit 541b684
7 files changed
Lines changed: 789 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
| |||
503 | 500 | | |
504 | 501 | | |
505 | 502 | | |
506 | | - | |
| 503 | + | |
| 504 | + | |
507 | 505 | | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
| 506 | + | |
527 | 507 | | |
528 | 508 | | |
529 | 509 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
423 | 424 | | |
424 | 425 | | |
425 | 426 | | |
| 427 | + | |
426 | 428 | | |
427 | | - | |
428 | | - | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
429 | 446 | | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
434 | 451 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
441 | 459 | | |
442 | 460 | | |
443 | 461 | | |
| |||
742 | 760 | | |
743 | 761 | | |
744 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
745 | 772 | | |
746 | 773 | | |
747 | 774 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | | - | |
63 | 68 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
140 | 152 | | |
141 | 153 | | |
142 | 154 | | |
| |||
244 | 256 | | |
245 | 257 | | |
246 | 258 | | |
247 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
248 | 303 | | |
249 | 304 | | |
250 | 305 | | |
| |||
0 commit comments