Repository navigation
Commit 14a9cb0
v5 WS4/WS6: one hosted engine for disk + memory; unified Ledgers view (#282)
* Share one hosted engine between disk and memory
Extract the plan -> rewrite -> edits stages of `run_redirect_selected`
into `socket_patch_core::hosted::engine`, a set of pure functions over a
`ProjectView` (build_candidates, bun_lockb_symlinked, withhold_everywhere,
read_candidate_files, wheel_targets, rewrite, guard). The disk flow
(`scan`/`get --mode hosted`) keeps only the apply lock, the host probes
(pipenv version, gem/python/vlt stale installs), the vendored takeover,
the symlink refusal and the commit of the rewritten files.
The in-memory engine moves to `socket_patch_core::hosted::memory` and
runs the same stages over `ProjectView::Memory`; its duplicated
redirect.rs / ledger.rs orchestration is deleted. The pnpm trust / npm
allow-remote planners move to `hosted::guidance`, the vlt preflight to
`hosted::vlt`, and the redirect-ledger delta to `hosted::ledger`, which
the engine never calls, so removing the hosted ledger only touches the
two callers. `socket-patch-node` now depends on socket-patch-core only;
the CLI re-exports `hosted_memory` for `hosted-bundle` and the tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
* Split the vendored takeover out of run_redirect_selected
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
* Undo unrelated rustfmt churn from the takeover split
The previous commit ran `cargo fmt --all` over a tree that is not
rustfmt-clean, reformatting ~30 files it does not otherwise touch.
Restore those files; no code changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
* Read the patch stores through one Ledgers view and ProjectContext
`socket_patch_core::ledgers` holds the one owner-precedence rule for the
manifest, the vendor ledger and the hosted redirect ledger (manifest >
vendored > hosted by ledger key; a manifest key claims every vendor entry
filed under it or naming it as base purl) and the views every reader
derives from it: `owned` (one group per owner key, losers as alternates),
`listed` (every copy worth showing), `matching` (remove/rollback
identifiers) and `hosted_vendored_overlap`. It replaces list's
combined_entries, fold_vendor_records / vendor_record_is_unowned, scan's
merge_ledger_records_for_updates, vex_sources' build_candidates and
overlap_from_states, and rollback/remove's per-store matching loops.
`LoadedLedgers::load` loads the three stores once, each with its own
outcome so every caller keeps its error posture.
`commands::context::ProjectContext` lazily loads the stores, the
lockfile inventory and the wiring discovery at most once per run; scan's
discovery phase, list and get read through it. `get`'s installed-version
narrowing now reuses scan's lockfile and vendored-ledger supplements
instead of its own inventory and ledger reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
* Index vendor-ledger claims once per view
`Ledgers::owned` re-sorted and scanned every vendor key for each
manifest key. Group the vendor entries under their claiming manifest key
in one pass over the sorted ledger (`claims`), so each view is
O(V log V + M) instead of O(M * V log V). Same ordering and alternates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
* Return typed warnings from the hosted engine; JSON in hosted::render
The engine's own warnings (rush repo-state, pnpm trustLockfile, npm
allow-remote, vlt artifact-unverifiable, record_fetch_failed, the
in-memory takeover refusal) were built as serde_json values inside
orchestration. They are now RewriteWarning values; the new
hosted::render module holds the only JSON spelling (warnings, skipped
entries, the nested redirect block), consumed by the disk adapter and
the in-memory engine. No output change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
* Read the lock set and discovery through one per-run snapshot
ProjectView gains a Snapshot variant: the disk under a read-through
cache (DiskSnapshot), so each lock or config file is read at most once
per run and every reader sees the same bytes; probes that are not
content reads still go to the disk. Lockfile discovery's guarded reads
now go through a ProjectView (discover_patched_refs_in), and
ProjectContext backs both locks() and discovery() with one snapshot of
--cwd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KHZ8uzdXfkG2zH8ZYDG8ju
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f6bdad5 commit 14a9cb0
44 files changed
Lines changed: 4716 additions & 4057 deletions
File tree
- crates
- socket-patch-cli
- src
- commands
- scan
- hosted
- hosted_memory
- socket-patch-core
- src
- hosted
- memory
- manifest
- utils
- vendor/lock_inventory
- vex
- discover
- socket-patch-node
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1817 | 1817 | | |
1818 | 1818 | | |
1819 | 1819 | | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
1820 | 1833 | | |
1821 | 1834 | | |
1822 | 1835 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | | - | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | 371 | | |
407 | 372 | | |
408 | 373 | | |
| |||
426 | 391 | | |
427 | 392 | | |
428 | 393 | | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | 394 | | |
468 | 395 | | |
469 | 396 | | |
| |||
1523 | 1450 | | |
1524 | 1451 | | |
1525 | 1452 | | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1529 | 1457 | | |
1530 | 1458 | | |
1531 | 1459 | | |
| |||
1564 | 1492 | | |
1565 | 1493 | | |
1566 | 1494 | | |
| 1495 | + | |
1567 | 1496 | | |
1568 | 1497 | | |
1569 | 1498 | | |
1570 | | - | |
| 1499 | + | |
1571 | 1500 | | |
1572 | 1501 | | |
1573 | 1502 | | |
1574 | | - | |
1575 | | - | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
1576 | 1506 | | |
1577 | | - | |
1578 | | - | |
1579 | | - | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1580 | 1510 | | |
1581 | | - | |
1582 | | - | |
1583 | | - | |
1584 | | - | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
1585 | 1516 | | |
1586 | 1517 | | |
1587 | 1518 | | |
| |||
0 commit comments