@amalgm/shell 0.1.164-main.42779063775 → 0.1.164-main.42790312725

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/PURPOSE.md CHANGED
@@ -937,7 +937,7 @@ after adoption.
937
937
  25. **Each cold stage performs only its necessary byte pass.** Registration
938
938
  reads every ordinary text or binary file once through the bounded capture
939
939
  stream to classify it, derive its content head, and retain large-file
940
- manifest evidence; a graph publication does not also copy those bytes into
940
+ manifest evidence; a package publication does not also copy those bytes into
941
941
  the disposable cache. Upload first proves which heads are already sealed,
942
942
  touches no source for those heads, and reads each remaining artifact once
943
943
  from the strongest available evidence: an existing verified cache object,
@@ -0,0 +1,33 @@
1
+ /**
2
+ * One examination per ground at a time.
3
+ *
4
+ * Two Detect lanes that read the same ground at once read it twice, and the
5
+ * one that admits second finds that the first one's commit changed what it
6
+ * read, so it discards its whole collection and reads again. A folder copied
7
+ * into a root showed this: its repositories' lane and the complete lane each
8
+ * read all of it, at once, and one threw its reading away.
9
+ *
10
+ * So a lane starts only on ground no running examination reads. Its names
11
+ * stay owed, and the running lane's end dispatches again. A complete cut
12
+ * that waits on a running lane reserves its ground for the rest of that
13
+ * dispatch, so names that keep ringing there never start ahead of it.
14
+ *
15
+ * Ground is the footprint a lane gates on (runtime.ts `footprint`): cones,
16
+ * conflicting when one contains the other. Every lane reads its root's
17
+ * sharing policy; that shared read examines nothing, so it never conflicts.
18
+ */
19
+ export declare class Examinations {
20
+ #private;
21
+ /** The cones of this root a lane examines: its footprint without the
22
+ * policy every lane reads. */
23
+ static examined(directory: string, footprint: readonly string[]): readonly string[];
24
+ /** True when a running examination or a waiting complete cut holds ground
25
+ * these cones meet. */
26
+ busy(cones: readonly string[]): boolean;
27
+ /** A lane examines these cones until it ends. A later call for the same
28
+ * lane replaces them, as a complete attempt's continuation widens. */
29
+ begin(lane: string, cones: readonly string[]): void;
30
+ end(lane: string): void;
31
+ /** Each dispatch reserves afresh what its waiting complete cuts read. */
32
+ reserve(cones: readonly string[]): void;
33
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * One examination per ground at a time.
3
+ *
4
+ * Two Detect lanes that read the same ground at once read it twice, and the
5
+ * one that admits second finds that the first one's commit changed what it
6
+ * read, so it discards its whole collection and reads again. A folder copied
7
+ * into a root showed this: its repositories' lane and the complete lane each
8
+ * read all of it, at once, and one threw its reading away.
9
+ *
10
+ * So a lane starts only on ground no running examination reads. Its names
11
+ * stay owed, and the running lane's end dispatches again. A complete cut
12
+ * that waits on a running lane reserves its ground for the rest of that
13
+ * dispatch, so names that keep ringing there never start ahead of it.
14
+ *
15
+ * Ground is the footprint a lane gates on (runtime.ts `footprint`): cones,
16
+ * conflicting when one contains the other. Every lane reads its root's
17
+ * sharing policy; that shared read examines nothing, so it never conflicts.
18
+ */
19
+ import { join } from "node:path";
20
+ import { USER_IGNORE_FILE_NAME } from "@amalgm/core/identity";
21
+ import { conesConflict } from "../ground-coordination.js";
22
+ export class Examinations {
23
+ #running = new Map();
24
+ #reserved = [];
25
+ /** The cones of this root a lane examines: its footprint without the
26
+ * policy every lane reads. */
27
+ static examined(directory, footprint) {
28
+ const policy = join(directory, USER_IGNORE_FILE_NAME);
29
+ return footprint.filter(cone => cone !== policy);
30
+ }
31
+ /** True when a running examination or a waiting complete cut holds ground
32
+ * these cones meet. */
33
+ busy(cones) {
34
+ const meets = (held) => cones.some(cone => held.some(other => conesConflict(cone, other)));
35
+ return meets(this.#reserved) || [...this.#running.values()].some(meets);
36
+ }
37
+ /** A lane examines these cones until it ends. A later call for the same
38
+ * lane replaces them, as a complete attempt's continuation widens. */
39
+ begin(lane, cones) {
40
+ this.#running.set(lane, cones);
41
+ }
42
+ end(lane) {
43
+ this.#running.delete(lane);
44
+ }
45
+ /** Each dispatch reserves afresh what its waiting complete cuts read. */
46
+ reserve(cones) {
47
+ this.#reserved = cones;
48
+ }
49
+ }
50
+ //# sourceMappingURL=examinations.js.map
@@ -0,0 +1 @@
1
+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EAAyE;IACzE,OAAO,CAAC,KAAwB;QAC9B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;CACF"}
@@ -9,11 +9,9 @@
9
9
  * reads or commits is kept, and a baseline adoption keeps its head in the
10
10
  * same commit.
11
11
  *
12
- * One watermark can name more than one head: a Register publication changes
13
- * the graph at the prefix it folded without a delivery of its own. The
14
- * authority's head version orders them, and the newest one known is the
15
- * state before delivery M + 1, so a kept head yields only to a newer version
16
- * at its watermark.
12
+ * Entity records are the graph's only writer, so a head at M is the state
13
+ * before delivery M + 1. A kept head yields only to a newer authority version
14
+ * at its watermark, so a stale re-read never moves it backward.
17
15
  *
18
16
  * Receipt: a kept head at M proves receipt of every delivery through M, so
19
17
  * a machine with no delivery cursor yet receives above its newest kept head,
@@ -1 +1 @@
1
- {"version":3,"file":"graph-heads.js","sourceRoot":"","sources":["../src/graph-heads.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAqB9C;mDACmD;AACnD,MAAM,UAAU,aAAa,CAAC,QAA2B,EAAE,KAAqB;IAC9E,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAClF,IAAI,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,iBAAiB,GAAG,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAChI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,MAAM,IAAI,KAAK,C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O,GAAG,eAAe,CAAC,QAAQ,EAAE;;GAEzC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,WAAW,CAAuB,CAAC;IAClD,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,iBAAiB,CAAC,QAA2B,EAAE,WAAmB,EAAE,QAAgB;IAC3F,OAAO,eAAe,CAAC,QAAQ,EAAE;;;GAGhC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAkB,IAAI,SAAS,CAAC;AACtE,CAAC"}
Binary file
Binary file
@@ -274,6 +274,8 @@ export declare class UserGroundHost {
274
274
  private groundLookQueued;
275
275
  /** The one complete-lane attempt. */
276
276
  private completeAttempt;
277
+ /** The ground each running lane examines: one examination per ground. */
278
+ private readonly examinations;
277
279
  /** Ground reads running in the background (discovery warms, maintenance
278
280
  * visits): close drains them with the attempts before the ground database
279
281
  * goes, so none reopens it. */
@@ -586,7 +588,9 @@ export declare class UserGroundHost {
586
588
  private proveOwed;
587
589
  /** Run lanes until everything this ticket scoped at its cutoff is settled.
588
590
  * An attempt that covered the ticket and failed fails the caller honestly;
589
- * attempts on other ground, or frozen before the ticket, never do. */
591
+ * attempts on other ground, or frozen before the ticket, never do. A wait
592
+ * (an owner, moving or unreadable ground) is never a failure: the ticket
593
+ * answers every wait its lanes parked on together, once none still runs. */
590
594
  private proveTicket;
591
595
  /** Every attempt and background ground read already running, drained.
592
596
  * Outcomes stay with their lanes. */
@@ -870,6 +874,8 @@ export declare class UserGroundHost {
870
874
  * complete lane proves those paths, not the whole root. */
871
875
  private escalateMaintenance;
872
876
  private startComplete;
877
+ /** The complete lane examines the ground its cuts read. */
878
+ private examineCuts;
873
879
  /** Whole-root proofs, one attempt at a time. Every cut it freezes is
874
880
  * released when it ends, proved or not. */
875
881
  private completeLane;
@@ -902,12 +908,9 @@ export declare class UserGroundHost {
902
908
  private directScope;
903
909
  private syncLocalChangesUnlocked;
904
910
  /** AV: the authority's current head H plus every accepted result Receive
905
- * has delivered after its watermark M. The head is read fresh, because a
906
- * graph-head commit is never an entity delivery. `beyond` is a delivery a
907
- * refused watermark proved the authority holds, so Receive reaches past it
908
- * before the tail is read. Neither Apply nor Send is waited on: accepted
909
- * state is what the authority has accepted, whatever this machine has
910
- * physically applied or still owes. */
911
+ * has delivered after its watermark M. Neither Apply nor Send is waited on:
912
+ * accepted state is what the authority has accepted, whatever this machine
913
+ * has physically applied or still owes. */
911
914
  private freshAcceptedView;
912
915
  /** Which of these heads does the authority hold sealed under the current
913
916
  * content contract — and which of the sealed ones are packed, their whole
@@ -76,6 +76,7 @@ import { readVerifiedRegistryPage, writeVerifiedRegistryPage, } from "./registry
76
76
  import { GitStorageDependencies, NodeWatchHost, presentDirectory, } from "./watching/index.js";
77
77
  import { beginGroundWait, GroundCoordinator, GroundEffectCrossedError, GroundFootprintExceededError, PackedPhysicalKeys, PhysicalKeySet } from "./ground-coordination.js";
78
78
  import { physicalPath } from "./sync-address.js";
79
+ import { Examinations } from "./detection/examinations.js";
79
80
  import { keptPackagePages, statedResults } from "./package-pages.js";
80
81
  import { readAcceptedTail } from "./accepted-tail.js";
81
82
  import { readDeliveryReceipt, readGraphBasis, readNewestGraphHead } from "./graph-heads.js";
@@ -220,6 +221,8 @@ export class UserGroundHost {
220
221
  groundLookQueued = false;
221
222
  /** The one complete-lane attempt. */
222
223
  completeAttempt = null;
224
+ /** The ground each running lane examines: one examination per ground. */
225
+ examinations = new Examinations();
223
226
  /** Ground reads running in the background (discovery warms, maintenance
224
227
  * visits): close drains them with the attempts before the ground database
225
228
  * goes, so none reopens it. */
@@ -1205,7 +1208,7 @@ export class UserGroundHost {
1205
1208
  let cloudHead;
1206
1209
  let alreadyRegistered = false;
1207
1210
  try {
1208
- const view = await this.freshAcceptedView(identity, resourceId, 0);
1211
+ const view = await this.freshAcceptedView(identity, resourceId);
1209
1212
  alreadyRegistered = await this.registeredIn(identity, view, workspaceId);
1210
1213
  if (alreadyRegistered) {
1211
1214
  // Whatever W or its reference holds beyond the accepted view is
@@ -1215,7 +1218,7 @@ export class UserGroundHost {
1215
1218
  }
1216
1219
  else {
1217
1220
  await this.publishRegistered(directory, referencePath);
1218
- const accepted = await this.freshAcceptedView(identity, resourceId, 0);
1221
+ const accepted = await this.freshAcceptedView(identity, resourceId);
1219
1222
  if (!await this.registeredIn(identity, accepted, workspaceId)) {
1220
1223
  throw failedDuring("pipeline", "cloud graph commit", new Error(`workspace ${workspaceId} or its durable reference is absent from the accepted view`));
1221
1224
  }
@@ -1456,7 +1459,9 @@ export class UserGroundHost {
1456
1459
  }
1457
1460
  /** Run lanes until everything this ticket scoped at its cutoff is settled.
1458
1461
  * An attempt that covered the ticket and failed fails the caller honestly;
1459
- * attempts on other ground, or frozen before the ticket, never do. */
1462
+ * attempts on other ground, or frozen before the ticket, never do. A wait
1463
+ * (an owner, moving or unreadable ground) is never a failure: the ticket
1464
+ * answers every wait its lanes parked on together, once none still runs. */
1460
1465
  async proveTicket(ticket) {
1461
1466
  const roots = new Set(ticket.map(({ rootId }) => rootId));
1462
1467
  const waiter = { ticket, failure: null, wake: () => { } };
@@ -1487,7 +1492,7 @@ export class UserGroundHost {
1487
1492
  && (cut.domain !== undefined || cut.rootId === laneRoot(lane)))
1488
1493
  : open.some(cut => cut.suspicion.paths !== null && cut.rootId === laneRoot(lane));
1489
1494
  const parks = [...this.parkedDetect].flatMap(([lane, park]) => ours(lane) ? [park] : []);
1490
- const failure = parks.find(({ error }) => !(error instanceof ApplyAttributionDeferred) && !unsettledGround(error));
1495
+ const failure = parks.find(({ error }) => !waits(error));
1491
1496
  const owners = parks.flatMap(({ error }) => error instanceof ApplyAttributionDeferred ? error.owners : [])
1492
1497
  .filter((owner, index, all) => all.findIndex(other => sameAttempt(other, owner)) === index);
1493
1498
  const moving = [...new Set(parks.flatMap(({ error }) => error instanceof DetectResidual ? error.roots
@@ -1547,6 +1552,7 @@ export class UserGroundHost {
1547
1552
  return;
1548
1553
  const pending = this.watchHost.pending();
1549
1554
  const proving = (rootId, named) => ticket.some(wanted => wanted.rootId === rootId && (!named || wanted.suspicion.paths !== null));
1555
+ this.examinations.reserve([]);
1550
1556
  if (!this.completeAttempt) {
1551
1557
  try {
1552
1558
  if (pending.some(({ pending: owed }) => owed.complete))
@@ -1556,9 +1562,22 @@ export class UserGroundHost {
1556
1562
  // waits off-slot, as a named lane does, so a long Register or Add
1557
1563
  // never delays another root's proof. Its release dispatches again.
1558
1564
  // A park answers only the root it names, so one root's owner wait
1559
- // or retry never holds another root's proof.
1560
- const { cuts, withheld } = this.watchHost.selectComplete((directory, paths) => this.ground.holds(this.cutFootprint(directory, paths)), rootId => this.blocked(`complete:${rootId}`, pending, proving(rootId, false)));
1561
- if (withheld.length > 0)
1565
+ // or retry never holds another root's proof. A root another lane
1566
+ // is examining waits for that lane's end, its ground reserved.
1567
+ let effectHeld = false;
1568
+ const waiting = [];
1569
+ const { cuts, withheld } = this.watchHost.selectComplete((directory, paths) => {
1570
+ const footprint = this.cutFootprint(directory, paths);
1571
+ if (this.ground.holds(footprint))
1572
+ return effectHeld = true;
1573
+ const examined = Examinations.examined(directory, footprint);
1574
+ if (!this.examinations.busy(examined))
1575
+ return false;
1576
+ waiting.push(...examined);
1577
+ return true;
1578
+ }, rootId => this.blocked(`complete:${rootId}`, pending, proving(rootId, false)));
1579
+ this.examinations.reserve(waiting);
1580
+ if (effectHeld)
1562
1581
  this.awaitGround("complete");
1563
1582
  this.coverMaintenance(cuts);
1564
1583
  if (cuts.length > 0)
@@ -1603,10 +1622,14 @@ export class UserGroundHost {
1603
1622
  // as it stands. It freezes nothing; the lane activates at a boundary.
1604
1623
  // A name under held ground stays owed while the root's other names
1605
1624
  // proceed, so unrelated ground never waits on that hold.
1625
+ // A name on ground another lane examines waits for that lane's end.
1606
1626
  const started = performance.now();
1607
- const free = this.ground.holds(routes.footprint(paths))
1608
- ? paths.filter(path => !this.ground.holds(routes.footprint([path]))) : paths;
1609
- if (free.length < paths.length)
1627
+ const examined = (cones) => this.examinations.busy(Examinations.examined(directory, cones));
1628
+ const unexamined = examined(routes.footprint(paths))
1629
+ ? paths.filter(path => !examined(routes.footprint([path]))) : paths;
1630
+ const free = this.ground.holds(routes.footprint(unexamined))
1631
+ ? unexamined.filter(path => !this.ground.holds(routes.footprint([path]))) : unexamined;
1632
+ if (free.length < unexamined.length)
1610
1633
  this.awaitGround(lane);
1611
1634
  if (free.length === 0)
1612
1635
  continue;
@@ -1706,7 +1729,7 @@ export class UserGroundHost {
1706
1729
  }
1707
1730
  // Neither an owner wait, moving nor unreadable ground ends by rerunning
1708
1731
  // unchanged work: an owner's release, a new ring or the timer does.
1709
- return !proving || park.error instanceof ApplyAttributionDeferred || unsettledGround(park.error);
1732
+ return !proving || waits(park.error);
1710
1733
  }
1711
1734
  /** What a lane's failure is to the tickets it covered. A basis that
1712
1735
  * advanced while Detect read is truth still arriving, never a fault: its
@@ -2412,10 +2435,11 @@ export class UserGroundHost {
2412
2435
  state: "incomplete",
2413
2436
  cutoff: cutoff.map(({ rootId, pending }) => ({ rootId, generation: pending.generation })),
2414
2437
  // Deferred attribution withholds the whole shared examination; a
2415
- // refusal, moving ground or unreadable ground withholds only its own root.
2416
- unresolvedRoots: (owningIntents.length ? [...roots]
2417
- : [...new Set([...refusedRoots.map(refused => refused.directory), ...moving,
2418
- ...unavailableRootList.map(root => root.directory)])]).sort(),
2438
+ // refusal, moving ground or unreadable ground withholds only its own
2439
+ // root, whether or not that root was still bound at the cutoff.
2440
+ unresolvedRoots: [...new Set([...(owningIntents.length ? roots : []),
2441
+ ...refusedRoots.map(refused => refused.directory), ...moving,
2442
+ ...unavailableRootList.map(root => root.directory)])].sort(),
2419
2443
  owningIntents,
2420
2444
  refusedRoots,
2421
2445
  movingRoots: moving,
@@ -2572,7 +2596,7 @@ export class UserGroundHost {
2572
2596
  const kept = this.keptComputerFolder();
2573
2597
  if (kept !== null)
2574
2598
  return kept;
2575
- const view = await this.freshAcceptedView(identity, this.authorityId, 0);
2599
+ const view = await this.freshAcceptedView(identity, this.authorityId);
2576
2600
  const coreRootId = await this.acceptedCoreRoot(identity, view);
2577
2601
  const core = await view.fold.root(coreRootId);
2578
2602
  const folder = core.find((record) => record.parentUUID === coreRootId && record.name === FILES_FOLDER
@@ -3739,6 +3763,7 @@ export class UserGroundHost {
3739
3763
  startNamed(identity, kind, rootId, directory, paths, cones, prepareMs) {
3740
3764
  const lane = `${kind}:${rootId}`;
3741
3765
  const runtime = this.namedDetect, prepared = performance.now();
3766
+ this.examinations.begin(lane, Examinations.examined(directory, cones));
3742
3767
  this.namedAttempts.set(lane, (async () => {
3743
3768
  await turnBoundary();
3744
3769
  const activated = this.activateNamed(identity, runtime, rootId, directory, paths, cones);
@@ -3749,6 +3774,7 @@ export class UserGroundHost {
3749
3774
  await this.namedLane(identity, kind, rootId, activated.paths, activated.lease);
3750
3775
  })().finally(() => {
3751
3776
  this.namedAttempts.delete(lane);
3777
+ this.examinations.end(lane);
3752
3778
  this.passRead(identity, cones);
3753
3779
  this.laneFreed();
3754
3780
  }));
@@ -3815,7 +3841,7 @@ export class UserGroundHost {
3815
3841
  }
3816
3842
  else {
3817
3843
  // Ground still moving or unreadable fails no ticket, as in the complete lane.
3818
- if (this.racyUnsettled(lane, error) || !unsettledGround(error))
3844
+ if (this.racyUnsettled(lane, error) || !waits(error))
3819
3845
  failure = { error };
3820
3846
  this.park(lane, new Map(cuts.map(cut => [cut.rootId, cut.suspicion.generation])), error);
3821
3847
  }
@@ -4031,12 +4057,18 @@ export class UserGroundHost {
4031
4057
  }
4032
4058
  }
4033
4059
  startComplete(identity, boundary, cuts) {
4060
+ this.examineCuts(cuts);
4034
4061
  this.completeAttempt = this.completeLane(identity, boundary, cuts).finally(() => {
4035
4062
  this.completeAttempt = null;
4063
+ this.examinations.end("complete");
4036
4064
  this.passRead(identity, cuts.map(cut => cut.directory));
4037
4065
  this.laneFreed();
4038
4066
  });
4039
4067
  }
4068
+ /** The complete lane examines the ground its cuts read. */
4069
+ examineCuts(cuts) {
4070
+ this.examinations.begin("complete", cuts.flatMap(cut => Examinations.examined(cut.directory, this.cutFootprint(cut.directory, cut.suspicion.paths))));
4071
+ }
4040
4072
  /** Whole-root proofs, one attempt at a time. Every cut it freezes is
4041
4073
  * released when it ends, proved or not. */
4042
4074
  async completeLane(identity, boundary, cuts) {
@@ -4058,7 +4090,7 @@ export class UserGroundHost {
4058
4090
  // Ground still moving or unreadable fails no ticket: the lane waits for
4059
4091
  // its next ring or a timer, and then proves the rest.
4060
4092
  const error = this.laneCause(caught, held.flat());
4061
- if (this.racyUnsettled("complete", error) || !unsettledGround(error))
4093
+ if (this.racyUnsettled("complete", error) || !waits(error))
4062
4094
  failure = { error };
4063
4095
  const generations = new Map();
4064
4096
  for (const cut of held.flat()) {
@@ -4124,6 +4156,7 @@ export class UserGroundHost {
4124
4156
  continuation = this.watchHost.freeze();
4125
4157
  this.coverMaintenance(continuation);
4126
4158
  held.push(continuation);
4159
+ this.examineCuts(held.flat());
4127
4160
  promoted = true;
4128
4161
  }
4129
4162
  collection.close(UNDISPOSED);
@@ -4884,20 +4917,17 @@ export class UserGroundHost {
4884
4917
  });
4885
4918
  }
4886
4919
  /** AV: the authority's current head H plus every accepted result Receive
4887
- * has delivered after its watermark M. The head is read fresh, because a
4888
- * graph-head commit is never an entity delivery. `beyond` is a delivery a
4889
- * refused watermark proved the authority holds, so Receive reaches past it
4890
- * before the tail is read. Neither Apply nor Send is waited on: accepted
4891
- * state is what the authority has accepted, whatever this machine has
4892
- * physically applied or still owes. */
4893
- async freshAcceptedView(identity, resourceId, beyond) {
4920
+ * has delivered after its watermark M. Neither Apply nor Send is waited on:
4921
+ * accepted state is what the authority has accepted, whatever this machine
4922
+ * has physically applied or still owes. */
4923
+ async freshAcceptedView(identity, resourceId) {
4894
4924
  const head = (await this.readHead(identity, resourceId, { kind: "none" }))?.state;
4895
4925
  if (!head || head.resourceId !== resourceId) {
4896
4926
  throw new Error("the authority holds no entity registry for this user");
4897
4927
  }
4898
4928
  if (!this.recordRail)
4899
4929
  throw new Error("the entity record rail is not running");
4900
- await this.recordRail.receiveThrough(Math.max(head.deliveryWatermark, beyond));
4930
+ await this.recordRail.receiveThrough(head.deliveryWatermark);
4901
4931
  return acceptedView(head, readAcceptedTail(groundDatabase(this.databasePath()), resourceId, head.deliveryWatermark), sha256Hex);
4902
4932
  }
4903
4933
  /** Which of these heads does the authority hold sealed under the current
@@ -5057,6 +5087,11 @@ function assertHealthyWatch(evidence, rootId) {
5057
5087
  }
5058
5088
  /** A finished attempt answers a ticket when it proved some root the ticket
5059
5089
  * names, through the ticket's generation and in at least the ticket's scope. */
5090
+ /** A lane that ended on an owner, moving or unreadable ground waits: its
5091
+ * park, not a ticket failure, is the answer, joined with every other wait. */
5092
+ function waits(error) {
5093
+ return error instanceof ApplyAttributionDeferred || unsettledGround(error);
5094
+ }
5060
5095
  function coversTicket(cuts, ticket) {
5061
5096
  return ticket.some(wanted => cuts.some(cut => cut.rootId === wanted.rootId
5062
5097
  && cut.suspicion.generation >= wanted.suspicion.generation