@amalgm/shell 0.1.164-main.41281684198 → 0.1.164-main.41283098420
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 +9 -1
- package/dist/ground-database.d.ts +7 -0
- package/dist/ground-database.js +12 -3
- package/dist/ground-database.js.map +1 -1
- package/dist/user-ground-host.d.ts +7 -0
- package/dist/user-ground-host.js +50 -5
- package/dist/user-ground-host.js.map +1 -1
- package/dist/watching/host.d.ts +20 -1
- package/dist/watching/host.js +40 -8
- package/dist/watching/host.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
package/PURPOSE.md
CHANGED
|
@@ -782,7 +782,15 @@ after adoption.
|
|
|
782
782
|
one examination across every configured materialization root. Such a shared
|
|
783
783
|
obligation settles only when every participating root completes against the
|
|
784
784
|
same frozen Watch generation and binding set. Unavailable ground remains
|
|
785
|
-
pending; a changed binding set requires a new complete examination.
|
|
785
|
+
pending; a changed binding set requires a new complete examination. A cut
|
|
786
|
+
frozen under it is proved by root identity, never binding instance: once
|
|
787
|
+
every root it named is bound again and examined completely through its
|
|
788
|
+
generation, by that examination or a returning root's own whole catch-up.
|
|
789
|
+
A named root still away keeps the cut pending and is answered unavailable,
|
|
790
|
+
never settled. The runtime's database is never opened a second time by its
|
|
791
|
+
name: while its home, or a directory down to it, is not the object it was
|
|
792
|
+
opened in, that ground is unavailable and flush says so at once; the file
|
|
793
|
+
alone changing beneath directories that still stand is a fault. Native
|
|
786
794
|
event IDs are diagnostics, never identities or settlement cutoffs. Unexpected
|
|
787
795
|
coverage loss retains one episode through repeated reopen failures; its
|
|
788
796
|
qualifying observation starts only after replacement coverage is healthy.
|
|
@@ -32,6 +32,13 @@ export declare function migrateGroundDatabase(file: string): GroundMigration;
|
|
|
32
32
|
* behind a commit on its own thread. None checkpoints, so the first one starts the file's
|
|
33
33
|
* checkpoint thread and its saver thread. */
|
|
34
34
|
export declare function openGroundConnection(file: string): Database.Database;
|
|
35
|
+
/** A held name no longer names the object it opened: another stands there, or
|
|
36
|
+
* none. Whether the ground holding it is away or the file alone changed is
|
|
37
|
+
* the host's to judge; either way no second file is ever read. */
|
|
38
|
+
export declare class GroundDatabaseAway extends Error {
|
|
39
|
+
readonly file: string;
|
|
40
|
+
constructor(file: string);
|
|
41
|
+
}
|
|
35
42
|
export declare function groundDatabase(file: string): Database.Database;
|
|
36
43
|
/** Every other owner has closed by now: each content thread lets its read
|
|
37
44
|
* connection go after the job it is running, the saver finishes its queue,
|
package/dist/ground-database.js
CHANGED
|
@@ -341,6 +341,16 @@ export function openGroundConnection(file) {
|
|
|
341
341
|
startGroundSaver(name, objectAt(name));
|
|
342
342
|
return database;
|
|
343
343
|
}
|
|
344
|
+
/** A held name no longer names the object it opened: another stands there, or
|
|
345
|
+
* none. Whether the ground holding it is away or the file alone changed is
|
|
346
|
+
* the host's to judge; either way no second file is ever read. */
|
|
347
|
+
export class GroundDatabaseAway extends Error {
|
|
348
|
+
file;
|
|
349
|
+
constructor(file) {
|
|
350
|
+
super(`the ground database ${JSON.stringify(file)} was replaced beneath its open binding`);
|
|
351
|
+
this.file = file;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
344
354
|
const held = new Map();
|
|
345
355
|
function bound(file) {
|
|
346
356
|
const name = databaseFileName(file);
|
|
@@ -351,9 +361,8 @@ function bound(file) {
|
|
|
351
361
|
held.set(name, entry);
|
|
352
362
|
return entry;
|
|
353
363
|
}
|
|
354
|
-
if (objectAt(name) !== current.key)
|
|
355
|
-
throw new
|
|
356
|
-
}
|
|
364
|
+
if (objectAt(name) !== current.key)
|
|
365
|
+
throw new GroundDatabaseAway(file);
|
|
357
366
|
return current;
|
|
358
367
|
}
|
|
359
368
|
export function groundDatabase(file) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ground-database.js","sourceRoot":"","sources":["../src/ground-database.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,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AAC;IAClB,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IAC1B,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -287,6 +287,9 @@ export declare class UserGroundHost {
|
|
|
287
287
|
* Add hold the ground they materialize. Unrelated cones never wait. */
|
|
288
288
|
private readonly ground;
|
|
289
289
|
private boundUserRoot;
|
|
290
|
+
/** The directories from the home down to the folder holding this runtime's
|
|
291
|
+
* database, each as the object that stood there when it opened. */
|
|
292
|
+
private databaseGround;
|
|
290
293
|
/** Apply waits on ground without a deadline; shutdown cancels them just
|
|
291
294
|
* before it stops the Apply rail, which resumes from durable intents. */
|
|
292
295
|
private readonly applyWaits;
|
|
@@ -402,6 +405,10 @@ export declare class UserGroundHost {
|
|
|
402
405
|
* refused at that boundary are named: their local rows are current, and
|
|
403
406
|
* their last complete result remains the official one. */
|
|
404
407
|
flush(): Promise<FlushOutcome>;
|
|
408
|
+
/** A database that stands aside with its home is that home's ground away:
|
|
409
|
+
* unavailable, retried on its timer and heard returning by Watch. One whose
|
|
410
|
+
* home stands is a fault, as is a refusal that races the home's return. */
|
|
411
|
+
private databaseCause;
|
|
405
412
|
/** Prove everything owed now, through its current cutoff. Ground still
|
|
406
413
|
* moving when no retry remains names every root the cutoff left unsettled
|
|
407
414
|
* that no unreadable ground explains. */
|
package/dist/user-ground-host.js
CHANGED
|
@@ -13,7 +13,7 @@ import { groundRowProjection, portableGroundRecord as portableRecord, storedWith
|
|
|
13
13
|
import { groundStore } from "./ground-store.js";
|
|
14
14
|
import { RETAINED_BY_KEY, STORED_CHILDREN } from "./ground-inventory-schema.js";
|
|
15
15
|
import { groundSaveDurability, hearOwedExaminations, save, saved as groundSaved } from "./ground-saver.js";
|
|
16
|
-
import { groundDatabase, openGroundConnection, releaseGroundDatabase } from "./ground-database.js";
|
|
16
|
+
import { GroundDatabaseAway, groundDatabase, openGroundConnection, releaseGroundDatabase } from "./ground-database.js";
|
|
17
17
|
import { assertGroundInitialized, initializeGroundDatabase } from "./ground-initialization.js";
|
|
18
18
|
import { GroundBasisChangedError, readGroundRow, rootRevision } from "./ground-basis.js";
|
|
19
19
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -288,6 +288,9 @@ export class UserGroundHost {
|
|
|
288
288
|
* Add hold the ground they materialize. Unrelated cones never wait. */
|
|
289
289
|
ground = new GroundCoordinator();
|
|
290
290
|
boundUserRoot;
|
|
291
|
+
/** The directories from the home down to the folder holding this runtime's
|
|
292
|
+
* database, each as the object that stood there when it opened. */
|
|
293
|
+
databaseGround = [];
|
|
291
294
|
/** Apply waits on ground without a deadline; shutdown cancels them just
|
|
292
295
|
* before it stops the Apply rail, which resumes from durable intents. */
|
|
293
296
|
applyWaits = new AbortController();
|
|
@@ -357,6 +360,7 @@ export class UserGroundHost {
|
|
|
357
360
|
// No ground connection exists before its migration and epoch commit
|
|
358
361
|
// on the bootstrap thread; the main thread only awaits them.
|
|
359
362
|
const initialization = await initializeGroundDatabase(this.databasePath());
|
|
363
|
+
this.databaseGround = standingDirectories(this.userRoot(), physicalPath(this.options.dir));
|
|
360
364
|
this.forgetOwed();
|
|
361
365
|
this.hearingOwed = hearOwedExaminations(this.databasePath(), owed => this.owedExaminations.owe(owed));
|
|
362
366
|
this.stage({ primitive: "detect", stage: "ground-initialization", status: "completed",
|
|
@@ -1292,12 +1296,29 @@ export class UserGroundHost {
|
|
|
1292
1296
|
finally {
|
|
1293
1297
|
this.watchHost.release(cutoff);
|
|
1294
1298
|
}
|
|
1295
|
-
|
|
1296
|
-
|
|
1299
|
+
// A lane's cause is already judged; the rails read the same database.
|
|
1300
|
+
try {
|
|
1301
|
+
await this.recordRail?.flush();
|
|
1302
|
+
await this.applyRail?.flush();
|
|
1303
|
+
}
|
|
1304
|
+
catch (error) {
|
|
1305
|
+
throw this.databaseCause(error);
|
|
1306
|
+
}
|
|
1297
1307
|
if (!this.closing)
|
|
1298
1308
|
this.ensureWatchers(identity);
|
|
1299
1309
|
return { refused: [...this.rootRefusals].map(([directory, reason]) => ({ directory, reason })) };
|
|
1300
1310
|
}
|
|
1311
|
+
/** A database that stands aside with its home is that home's ground away:
|
|
1312
|
+
* unavailable, retried on its timer and heard returning by Watch. One whose
|
|
1313
|
+
* home stands is a fault, as is a refusal that races the home's return. */
|
|
1314
|
+
databaseCause(error) {
|
|
1315
|
+
if (!(error instanceof GroundDatabaseAway)
|
|
1316
|
+
|| this.databaseGround.every(({ path, key }) => standingKey(path) === key))
|
|
1317
|
+
return error;
|
|
1318
|
+
const home = this.userRoot();
|
|
1319
|
+
return new DetectUnavailable([{ directory: home,
|
|
1320
|
+
reason: `${home}, which holds this runtime's database, is not where it was opened; its ground stays unexamined until it returns` }]);
|
|
1321
|
+
}
|
|
1301
1322
|
/** Prove everything owed now, through its current cutoff. Ground still
|
|
1302
1323
|
* moving when no retry remains names every root the cutoff left unsettled
|
|
1303
1324
|
* that no unreadable ground explains. */
|
|
@@ -1355,7 +1376,12 @@ export class UserGroundHost {
|
|
|
1355
1376
|
.filter((owner, index, all) => all.findIndex(other => sameAttempt(other, owner)) === index);
|
|
1356
1377
|
const moving = [...new Set(parks.flatMap(({ error }) => error instanceof DetectResidual ? error.roots
|
|
1357
1378
|
: error instanceof ApplyAttributionDeferred ? error.moving : []))].sort();
|
|
1358
|
-
|
|
1379
|
+
// A root this ticket named that is no longer bound cannot be proved
|
|
1380
|
+
// until it returns: it is unavailable, never settled.
|
|
1381
|
+
const away = this.watchHost.unbound(open).map(({ directory, absent }) => ({ directory,
|
|
1382
|
+
reason: absent ? `${directory} is absent; its ground stays unexamined until it returns`
|
|
1383
|
+
: `${directory} is no longer bound` }));
|
|
1384
|
+
const unavailable = unavailableRoots([...parks.flatMap(({ error }) => unavailableOf(error)), ...away]);
|
|
1359
1385
|
const held = [...new Set(parks.flatMap(({ error }) => error instanceof DeclarationHeld ? error.roots : []))].sort();
|
|
1360
1386
|
const idle = !serving && this.namedAttempts.size === 0 && this.groundWaits.size === 0;
|
|
1361
1387
|
// A fault answers once nothing can run it again; no retry timer hides it.
|
|
@@ -1571,7 +1597,8 @@ export class UserGroundHost {
|
|
|
1571
1597
|
* merely stale, ground still moving, and their release's ring reruns it.
|
|
1572
1598
|
* This read and the park share one synchronous turn, so a release after it
|
|
1573
1599
|
* finds the park. Unreadable ownership keeps the wait. */
|
|
1574
|
-
laneCause(
|
|
1600
|
+
laneCause(caught, cuts) {
|
|
1601
|
+
const error = this.databaseCause(caught);
|
|
1575
1602
|
if (detectionBasisAdvanced(error)) {
|
|
1576
1603
|
return new DetectResidual(cuts.map(cut => cut.directory), [], { settlesInMs: settlesAfter(movementOf(error)) });
|
|
1577
1604
|
}
|
|
@@ -4920,6 +4947,24 @@ class DetectUnavailable extends Error {
|
|
|
4920
4947
|
this.roots = roots;
|
|
4921
4948
|
}
|
|
4922
4949
|
}
|
|
4950
|
+
/** Each directory from `home` down to `folder`, as the object standing there
|
|
4951
|
+
* now; `folder` alone when it lies outside `home`. */
|
|
4952
|
+
function standingDirectories(home, folder) {
|
|
4953
|
+
const below = relative(home, folder);
|
|
4954
|
+
const parts = below === "" ? [] : below.split(sep);
|
|
4955
|
+
const paths = below.startsWith("..") || isAbsolute(below) ? [folder]
|
|
4956
|
+
: [home, ...parts.map((_, index) => join(home, ...parts.slice(0, index + 1)))];
|
|
4957
|
+
return paths.map(path => ({ path, key: standingKey(path) }));
|
|
4958
|
+
}
|
|
4959
|
+
/** The object standing at `path` itself, or null when none can be seen there. */
|
|
4960
|
+
const standingKey = (path) => {
|
|
4961
|
+
try {
|
|
4962
|
+
return physicalKey(lstatSync(path, { bigint: true }));
|
|
4963
|
+
}
|
|
4964
|
+
catch {
|
|
4965
|
+
return null;
|
|
4966
|
+
}
|
|
4967
|
+
};
|
|
4923
4968
|
/** Ground still moving, unreadable or held by a Register declaration is
|
|
4924
4969
|
* unsettled: a cause, never a fault. */
|
|
4925
4970
|
const unsettledGround = (error) => error instanceof DetectResidual || error instanceof DetectUnavailable
|