@@ -144,10 +144,9 @@ export class SyncEngine {
144144 // Map from path to handle for leaf-first sync ordering
145145 // Path depth determines sync order (deepest first)
146146 private handlesByPath : Map < string , DocHandle < unknown > > = new Map ( )
147- // Paths pushed by shard-ingest workers this run (shared-nothing
148- // experiment). These docs were created, persisted, and uploaded in
149- // worker-owned repos; the main thread must NOT materialize them —
150- // detect:post and the snapshot head-update loop skip these paths.
147+ // Paths handled by worker-owned repos this run (shard mode). The main
148+ // thread must NOT materialize these docs — detect:post and the snapshot
149+ // head-update loop skip them; their reported heads are already current.
151150 private workerPushedPaths : Set < string > = new Set ( )
152151 private config : DirectoryConfig
153152
@@ -549,9 +548,7 @@ export class SyncEngine {
549548 undefined ,
550549 currentFiles ,
551550 undefined ,
552- // Shared-nothing experiment: don't materialize new remote
553- // file docs during discovery; shard-pull workers fetch them.
554- parallelIngestMode ( ) === "shard"
551+ parallelIngestMode ( ) === "shard" // defer remote fetches to workers
555552 )
556553 )
557554
@@ -709,24 +706,16 @@ export class SyncEngine {
709706 debug ( `sync: excluding ${ deletedPaths . size } deleted paths from re-detection` )
710707 }
711708 debug ( "sync: re-detecting changes after network sync" )
712- // Shared-nothing experiment: paths pushed via worker-owned repos
713- // must not be re-checked here — that would repo.find (and thus
714- // materialize) every doc on the main thread, reinstating the
715- // serial cost the workers exist to avoid. Their snapshot heads
716- // were written from worker reports moments ago; genuinely
717- // concurrent remote edits get picked up on the next sync.
718709 const freshChanges = await profileAsync ( "detect:post" , ( ) =>
719710 this . changeDetector . detectChanges (
720711 snapshot ,
721712 deletedPaths ,
722713 currentFiles ,
714+ // Skip worker-pushed paths (see workerPushedPaths).
723715 this . workerPushedPaths . size > 0
724716 ? this . workerPushedPaths
725717 : undefined ,
726- // Shared-nothing experiment: emit deferred (URL-only)
727- // changes for new remote files; pull routes them to
728- // shard-pull workers.
729- parallelIngestMode ( ) === "shard"
718+ parallelIngestMode ( ) === "shard" // defer remote fetches to workers
730719 )
731720 )
732721 const freshRemoteChanges = freshChanges . filter (
@@ -759,9 +748,7 @@ export class SyncEngine {
759748 // can't find the entries to splice out).
760749 await profileAsync ( "snapshot:head-update" , async ( ) => {
761750 for ( const [ filePath , snapshotEntry ] of snapshot . files . entries ( ) ) {
762- // Shared-nothing experiment: worker-pushed docs aren't (and
763- // must not be) materialized on the main thread; their heads
764- // were recorded from the worker reports and are current.
751+ // Worker-pushed heads are already current (see workerPushedPaths).
765752 if ( this . workerPushedPaths . has ( filePath ) ) continue
766753 try {
767754 const handle = await this . repo . find ( getPlainUrl ( snapshotEntry . url ) )
@@ -883,16 +870,11 @@ export class SyncEngine {
883870 debug ( `push: ${ localChanges . length } local changes (${ newFiles . length } new, ${ modifiedFiles . length } modified, ${ deletedFiles . length } deleted)` )
884871 out . update ( `Pushing ${ localChanges . length } local changes (${ newFiles . length } new, ${ modifiedFiles . length } modified, ${ deletedFiles . length } deleted)` )
885872
886- // EXPERIMENT (PUSHWORK_PARALLEL_INGEST=2, "shard"): build + persist +
887- // upload the docs for NEW files in worker-owned repos (darn-style
888- // parallel leaf phase), then proceed with the normal serial directory
889- // phase below. Workers own full repos (own Wasm/storage-writes/
890- // socket); the main thread never materializes the docs, only records
891- // {url, heads}. Files whose worker failed aren't in the map and fall
892- // back to main-thread creation in the per-file loop.
893- // (The "import" variant — workers shipping doc bytes for main-thread
894- // repo.import — was measured wall-neutral and removed; see
895- // .ignore/PARALLEL_INGEST_EXPERIMENT.md.)
873+ // Shard mode (PUSHWORK_PARALLEL_INGEST=2): NEW files are built,
874+ // persisted, and uploaded by worker-owned repos; the serial directory
875+ // phase below stitches the reported {url, heads} in. Files whose
876+ // worker failed are absent from the map and fall back to main-thread
877+ // creation. See ingestNewFilesInShardedRepos.
896878 const ingestMode = newFiles . length > 1 ? parallelIngestMode ( ) : null
897879 let shardResults = new Map < string , { url : AutomergeUrl ; heads : UrlHeads } > ( )
898880 if ( ingestMode === "shard" ) {
@@ -1168,10 +1150,8 @@ export class SyncEngine {
11681150 c . changeType === ChangeType . BOTH_CHANGED
11691151 )
11701152
1171- // EXPERIMENT (shared-nothing clone): deferred changes carry only
1172- // an entry URL — fetch + materialize + write them in shard-pull
1173- // workers. Failed paths fall back to the normal serial loop by
1174- // re-fetching content on the main thread.
1153+ // Deferred changes (shard mode) carry only an entry URL; shard-pull
1154+ // workers fetch + write them. Failures fall back to the serial loop.
11751155 const deferred = remoteChanges . filter ( c => c . deferredFetch )
11761156 const immediate = remoteChanges . filter ( c => ! c . deferredFetch )
11771157 let fallbackPaths : Set < string > | undefined
@@ -1230,14 +1210,13 @@ export class SyncEngine {
12301210 }
12311211
12321212 /**
1233- * EXPERIMENT (shared-nothing clone): pull deferred remote files in
1234- * worker-owned repos. Workers download/load + materialize the docs
1235- * with their own Wasm instances, write the local files themselves,
1236- * and report `{url, heads, contentHash}`; the main thread records
1237- * snapshot entries without ever materializing the documents.
1213+ * Shard-mode pull: fetch deferred remote files in worker-owned repos.
1214+ * Workers materialize the docs with their own Wasm instances, write the
1215+ * local files themselves, and report `{url, heads, contentHash}`; the
1216+ * main thread records snapshot entries without materializing anything.
12381217 *
1239- * Returns the set of paths the workers could NOT handle (caller runs
1240- * the main-thread fallback for those).
1218+ * Returns the paths the workers could not handle (caller runs the
1219+ * main-thread fallback for those).
12411220 */
12421221 private async pullRemoteFilesInShardedRepos (
12431222 deferred : DetectedChange [ ] ,
@@ -1507,18 +1486,18 @@ export class SyncEngine {
15071486 }
15081487
15091488 /**
1510- * EXPERIMENT (shared-nothing) : ingest new files in worker-owned repos.
1489+ * Shard-mode push : ingest new files in worker-owned repos.
15111490 *
1512- * Workers build, persist (shared storage directory, disjoint doc
1513- * keys), and upload their shard with their OWN Repo + Wasm + socket,
1514- * reporting only `{url, heads}`. The main thread never materializes
1515- * these docs; the per-file loop stitches the URLs into directory
1516- * entries and the snapshot.
1491+ * Workers build, persist (shared storage directory, disjoint doc keys),
1492+ * and upload their shard with their own Repo + Wasm + socket, reporting
1493+ * only `{url, heads}`. The main thread never materializes these docs;
1494+ * the per-file loop stitches the URLs into directory entries and the
1495+ * snapshot.
15171496 *
15181497 * Paths that failed or did not converge to the server are absent from
15191498 * the returned map, so the per-file loop falls back to main-thread
1520- * `createRemoteFile` for them (the worker's copy becomes an
1521- * unreferenced orphan in storage , same class as deleted-file orphans).
1499+ * `createRemoteFile` (the worker's copy becomes an unreferenced storage
1500+ * orphan, same class as deleted-file orphans).
15221501 */
15231502 private async ingestNewFilesInShardedRepos (
15241503 newFiles : DetectedChange [ ] ,
0 commit comments