@ref0/git 0.8.0 → 0.9.0
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/dist/contracts/calls-spent.d.mts +2 -12
- package/dist/contracts/calls-spent.mjs +4 -5
- package/dist/contracts/events.d.mts +70 -4
- package/dist/contracts/events.mjs +27 -3
- package/dist/contracts/git.d.mts +13 -3
- package/dist/contracts/objects.d.mts +18 -0
- package/dist/contracts/queue.d.mts +3 -2
- package/dist/contracts/queue.mjs +4 -2
- package/dist/core/ancestry.mjs +5 -4
- package/dist/core/index-job.mjs +23 -1
- package/dist/core/index-lost.d.mts +11 -0
- package/dist/core/index-lost.mjs +55 -0
- package/dist/core/objects/commit-writes.mjs +1 -1
- package/dist/core/objects/commits.mjs +10 -9
- package/dist/core/objects/merges.mjs +1 -1
- package/dist/core/objects/reading.mjs +28 -13
- package/dist/core/objects/trees.mjs +1 -1
- package/dist/core/parts.d.mts +7 -0
- package/dist/core/publish.mjs +9 -5
- package/dist/core/purge.mjs +16 -3
- package/dist/core/push.mjs +27 -11
- package/dist/core/repack.mjs +36 -14
- package/dist/core/view.d.mts +10 -1
- package/dist/core/view.mjs +15 -6
- package/dist/effect.d.mts +2 -3
- package/dist/effect.mjs +2 -3
- package/dist/engine/commits.mjs +4 -3
- package/dist/engine/merge-bases.mjs +5 -3
- package/dist/engine/merge.mjs +4 -3
- package/dist/engine/parts.d.mts +1 -0
- package/dist/engine/parts.mjs +1 -1
- package/dist/engine/walk.mjs +15 -11
- package/dist/http/core-parts.mjs +17 -8
- package/dist/index.d.mts +2 -2
- package/dist/lfs/objects.mjs +7 -4
- package/dist/lfs/upkeep.mjs +6 -5
- package/dist/lfs/upload-most.mjs +7 -1
- package/dist/protocol/bytes/streams.mjs +84 -2
- package/dist/protocol/diff/read.d.mts +1 -0
- package/dist/protocol/diff/read.mjs +5 -2
- package/dist/protocol/objects/commit.d.mts +7 -0
- package/dist/protocol/objects/commit.mjs +5 -1
- package/dist/queue/advance.mjs +39 -10
- package/dist/queue/host.d.mts +4 -0
- package/dist/queue/layer.mjs +4 -2
- package/dist/queue/limits.mjs +18 -2
- package/dist/queue/rows.mjs +2 -1
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/commits.d.mts +238 -238
- package/dist/rest/forks.d.mts +71 -71
- package/dist/rest/refs.d.mts +143 -143
- package/dist/rest/repos.d.mts +81 -81
- package/dist/rest/topics.d.mts +112 -112
- package/dist/rest/trees.d.mts +77 -77
- package/dist/rest/wire.d.mts +19 -1
- package/dist/rest/work.d.mts +39 -39
- package/dist/server/joined.d.mts +11 -5
- package/dist/server/joined.mjs +3 -2
- package/dist/server/registry.mjs +11 -5
- package/dist/server/server.mjs +16 -4
- package/dist/storage/index-bitmaps.mjs +16 -10
- package/dist/storage/index-build.mjs +61 -13
- package/dist/storage/index-graph.d.mts +1 -0
- package/dist/storage/index-graph.mjs +29 -5
- package/dist/storage/index-layers.d.mts +1 -0
- package/dist/storage/index-layers.mjs +5 -2
- package/dist/storage/index-reach.mjs +7 -5
- package/dist/storage/index-remap.mjs +5 -5
- package/dist/storage/index-visible.mjs +16 -5
- package/dist/storage/links.mjs +3 -3
- package/dist/storage/pack-order.d.mts +1 -0
- package/dist/storage/pack-order.mjs +18 -1
- package/dist/storage/prune-walk.mjs +5 -2
- package/dist/storage/prune.mjs +107 -37
- package/dist/storage/receive-bounds.mjs +3 -2
- package/dist/storage/visible.mjs +3 -2
- package/dist/storage/walk.d.mts +1 -0
- package/dist/storage/walk.mjs +9 -5
- package/dist/storage/wants.mjs +17 -11
- package/dist/store/call-count.d.mts +8 -0
- package/dist/store/call-count.mjs +15 -7
- package/dist/store/errors.d.mts +7 -1
- package/dist/store/errors.mjs +7 -1
- package/dist/store/job-try.mjs +3 -1
- package/dist/store/records.mjs +17 -2
- package/dist/store/repo-record.mjs +9 -2
- package/dist/store/scopes.mjs +10 -2
- package/dist/sync/bound.d.mts +1 -1
- package/dist/sync/import.mjs +1 -1
- package/dist/sync/layer.mjs +4 -7
- package/dist/sync/mirror.mjs +1 -1
- package/dist/topics/advance.mjs +4 -4
- package/dist/topics/layer.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./result.mjs";
|
|
2
2
|
import "effect/Effect";
|
|
3
3
|
import "effect/Cause";
|
|
4
|
-
import "effect/Exit";
|
|
5
|
-
/**
|
|
6
|
-
* The refusal of the spent bound `cause` holds, `spentAt`'s, or `undefined` for a cause that holds
|
|
7
|
-
* none. A Promise edge reads it for its answer, such as a host's route catching what a door's
|
|
8
|
-
* defect rejected with (Q826): a bridge, as Q787 names one, carrying a spent bound across a
|
|
9
|
-
* Promise edge, where `answerSpent` can't reach, since Effect's context stops at a Promise. The
|
|
10
|
-
* drop-in's import reads it too, outside Git, where `answerSpent` isn't exported: a spent
|
|
11
|
-
* publication answers `RESOURCE_EXHAUSTED`, typed. The drop-in's Effect step 2b (Q783) deletes
|
|
12
|
-
* the edges' reads with the Promise edges, once its routes answer as Effects.
|
|
13
|
-
*/
|
|
14
|
-
export declare const spentRefusalOf: (cause: unknown) => GitError | undefined;
|
|
4
|
+
import "effect/Exit";
|
|
@@ -45,7 +45,8 @@ const callLimitTry = "The server reached its limit of store calls for one reques
|
|
|
45
45
|
/**
|
|
46
46
|
* `spent`'s refusal, as an edge answers it, with `spent` its cause: a request's count's, named by
|
|
47
47
|
* its bound, which a fetch's route words as `tooManyCalls`, and the platform cap's, its own
|
|
48
|
-
* message, each with `callLimitTry`; or a budget's, `reason: 'call-budget'`.
|
|
48
|
+
* message, each with `callLimitTry`; or a budget's, `reason: 'call-budget'`. The drop-in words each the
|
|
49
|
+
* same, in `shapes/spent.ts`, since no entry exports this one.
|
|
49
50
|
*/
|
|
50
51
|
const spentRefusal = (spent) => spent.of === "budget" ? gitError("RESOURCE_EXHAUSTED", spent.message, {
|
|
51
52
|
hint: "Make fewer calls inside it",
|
|
@@ -130,10 +131,8 @@ const catchSpent = (effect, spent) => Effect.catchCause(effect, (cause) => {
|
|
|
130
131
|
* The refusal of the spent bound `cause` holds, `spentAt`'s, or `undefined` for a cause that holds
|
|
131
132
|
* none. A Promise edge reads it for its answer, such as a host's route catching what a door's
|
|
132
133
|
* defect rejected with (Q826): a bridge, as Q787 names one, carrying a spent bound across a
|
|
133
|
-
* Promise edge, where `answerSpent` can't reach, since Effect's context stops at a Promise.
|
|
134
|
-
* drop-in
|
|
135
|
-
* publication answers `RESOURCE_EXHAUSTED`, typed. The drop-in's Effect step 2b (Q783) deletes
|
|
136
|
-
* the edges' reads with the Promise edges, once its routes answer as Effects.
|
|
134
|
+
* Promise edge, where `answerSpent` can't reach, since Effect's context stops at a Promise. Internal:
|
|
135
|
+
* the drop-in keeps its own, `shapes/spent.ts`.
|
|
137
136
|
*/
|
|
138
137
|
const spentRefusalOf = (cause) => {
|
|
139
138
|
const spent = spentAt(cause);
|
|
@@ -2,7 +2,7 @@ import * as Schema from "effect/Schema";
|
|
|
2
2
|
import { JobInput } from "@ref0/infra";
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
4
|
declare namespace events_d_exports {
|
|
5
|
-
export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, EventFeature, EventLog, Events, EventsService, FeedItem, FenceReason, FencedPack, GitEvent, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, keepsEvents };
|
|
5
|
+
export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, EventFeature, EventLog, Events, EventsService, FeedItem, FenceReason, FencedPack, GitEvent, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoPruneRefused, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, keepsEvents };
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* What every event carries. `seq` orders a scope's events: a repo's name keeps one sequence
|
|
@@ -363,7 +363,37 @@ export declare const RepoIndexRefused: Schema.Struct<{
|
|
|
363
363
|
readonly error: Schema.String;
|
|
364
364
|
}>;
|
|
365
365
|
export type RepoIndexRefused = typeof RepoIndexRefused.Type;
|
|
366
|
-
/**
|
|
366
|
+
/**
|
|
367
|
+
* The repo's prune pass has waited `periods` prune periods in a row, each because pushes moved its
|
|
368
|
+
* refs onto what its rewrite was about to drop: the repo's unreachable objects stay until a period
|
|
369
|
+
* quiet enough for a pass to end. Sent once the pass has waited `prunePeriodsMost` periods, then
|
|
370
|
+
* once each further one, in the commit that writes the wait, and no more once a pass ends. No job
|
|
371
|
+
* is failed, so there is nothing to retry or discard. `error` says why, in the core's words.
|
|
372
|
+
*/
|
|
373
|
+
export declare const RepoPruneRefused: Schema.Struct<{
|
|
374
|
+
readonly seq: Schema.Int;
|
|
375
|
+
readonly at: Schema.Number;
|
|
376
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
377
|
+
readonly id: Schema.String;
|
|
378
|
+
}>>;
|
|
379
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
380
|
+
readonly id: Schema.String;
|
|
381
|
+
}>>;
|
|
382
|
+
readonly repo: Schema.String;
|
|
383
|
+
readonly internalId: Schema.TemplateLiteral<readonly ["r_", Schema.String]>;
|
|
384
|
+
readonly token: Schema.optionalKey<Schema.String>;
|
|
385
|
+
readonly type: Schema.Literal<"repo.work.failed">;
|
|
386
|
+
readonly name: Schema.Literal<"git.repack">;
|
|
387
|
+
readonly key: Schema.Literal<"prune">;
|
|
388
|
+
readonly refused: Schema.Literal<"busy">;
|
|
389
|
+
readonly periods: Schema.Int;
|
|
390
|
+
readonly error: Schema.String;
|
|
391
|
+
}>;
|
|
392
|
+
export type RepoPruneRefused = typeof RepoPruneRefused.Type;
|
|
393
|
+
/**
|
|
394
|
+
* `repo.work.failed`: a job's last try failed, a round of index builds was refused, or pushes kept
|
|
395
|
+
* the prune pass from ending.
|
|
396
|
+
*/
|
|
367
397
|
export declare const RepoWorkFailed: Schema.Union<readonly [Schema.Struct<{
|
|
368
398
|
readonly name: Schema.String;
|
|
369
399
|
readonly key: Schema.String;
|
|
@@ -397,6 +427,24 @@ export declare const RepoWorkFailed: Schema.Union<readonly [Schema.Struct<{
|
|
|
397
427
|
readonly type: Schema.Literal<"repo.work.failed">;
|
|
398
428
|
readonly refused: Schema.Literals<readonly ["spent", "too-large"]>;
|
|
399
429
|
readonly error: Schema.String;
|
|
430
|
+
}>, Schema.Struct<{
|
|
431
|
+
readonly seq: Schema.Int;
|
|
432
|
+
readonly at: Schema.Number;
|
|
433
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
434
|
+
readonly id: Schema.String;
|
|
435
|
+
}>>;
|
|
436
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
437
|
+
readonly id: Schema.String;
|
|
438
|
+
}>>;
|
|
439
|
+
readonly repo: Schema.String;
|
|
440
|
+
readonly internalId: Schema.TemplateLiteral<readonly ["r_", Schema.String]>;
|
|
441
|
+
readonly token: Schema.optionalKey<Schema.String>;
|
|
442
|
+
readonly type: Schema.Literal<"repo.work.failed">;
|
|
443
|
+
readonly name: Schema.Literal<"git.repack">;
|
|
444
|
+
readonly key: Schema.Literal<"prune">;
|
|
445
|
+
readonly refused: Schema.Literal<"busy">;
|
|
446
|
+
readonly periods: Schema.Int;
|
|
447
|
+
readonly error: Schema.String;
|
|
400
448
|
}>]>;
|
|
401
449
|
export type RepoWorkFailed = typeof RepoWorkFailed.Type;
|
|
402
450
|
export declare const RepoEvent: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
@@ -581,6 +629,24 @@ export declare const RepoEvent: Schema.Union<readonly [Schema.Union<readonly [Sc
|
|
|
581
629
|
readonly type: Schema.Literal<"repo.work.failed">;
|
|
582
630
|
readonly refused: Schema.Literals<readonly ["spent", "too-large"]>;
|
|
583
631
|
readonly error: Schema.String;
|
|
632
|
+
}>, Schema.Struct<{
|
|
633
|
+
readonly seq: Schema.Int;
|
|
634
|
+
readonly at: Schema.Number;
|
|
635
|
+
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
636
|
+
readonly id: Schema.String;
|
|
637
|
+
}>>;
|
|
638
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
639
|
+
readonly id: Schema.String;
|
|
640
|
+
}>>;
|
|
641
|
+
readonly repo: Schema.String;
|
|
642
|
+
readonly internalId: Schema.TemplateLiteral<readonly ["r_", Schema.String]>;
|
|
643
|
+
readonly token: Schema.optionalKey<Schema.String>;
|
|
644
|
+
readonly type: Schema.Literal<"repo.work.failed">;
|
|
645
|
+
readonly name: Schema.Literal<"git.repack">;
|
|
646
|
+
readonly key: Schema.Literal<"prune">;
|
|
647
|
+
readonly refused: Schema.Literal<"busy">;
|
|
648
|
+
readonly periods: Schema.Int;
|
|
649
|
+
readonly error: Schema.String;
|
|
584
650
|
}>]>]>;
|
|
585
651
|
export type RepoEvent = typeof RepoEvent.Type;
|
|
586
652
|
export declare const TokenEventFields: Schema.Struct<{
|
|
@@ -704,7 +770,7 @@ export declare const EntryFailed: Schema.Struct<{
|
|
|
704
770
|
readonly url: Schema.optionalKey<Schema.String>;
|
|
705
771
|
readonly type: Schema.Literal<"queue.entry.failed">;
|
|
706
772
|
readonly entry: Schema.String;
|
|
707
|
-
readonly reason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits"]>;
|
|
773
|
+
readonly reason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits", "tooLarge"]>;
|
|
708
774
|
readonly candidate: Schema.optionalKey<Schema.String>;
|
|
709
775
|
readonly error: Schema.optionalKey<Schema.String>;
|
|
710
776
|
}>;
|
|
@@ -988,7 +1054,7 @@ export declare const QueueEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
988
1054
|
readonly url: Schema.optionalKey<Schema.String>;
|
|
989
1055
|
readonly type: Schema.Literal<"queue.entry.failed">;
|
|
990
1056
|
readonly entry: Schema.String;
|
|
991
|
-
readonly reason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits"]>;
|
|
1057
|
+
readonly reason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits", "tooLarge"]>;
|
|
992
1058
|
readonly candidate: Schema.optionalKey<Schema.String>;
|
|
993
1059
|
readonly error: Schema.optionalKey<Schema.String>;
|
|
994
1060
|
}>, Schema.Struct<{
|
|
@@ -40,6 +40,7 @@ var events_exports = /* @__PURE__ */ __exportAll({
|
|
|
40
40
|
RepoIndexRefused: () => RepoIndexRefused,
|
|
41
41
|
RepoJobFailed: () => RepoJobFailed,
|
|
42
42
|
RepoMaintained: () => RepoMaintained,
|
|
43
|
+
RepoPruneRefused: () => RepoPruneRefused,
|
|
43
44
|
RepoRenamed: () => RepoRenamed,
|
|
44
45
|
RepoTokenEvent: () => RepoTokenEvent,
|
|
45
46
|
RepoVisibilityChanged: () => RepoVisibilityChanged,
|
|
@@ -267,8 +268,31 @@ const RepoIndexRefused = /* @__PURE__ */ Schema.Struct({
|
|
|
267
268
|
refused: IndexRefusal,
|
|
268
269
|
error: Schema.String
|
|
269
270
|
});
|
|
270
|
-
/**
|
|
271
|
-
|
|
271
|
+
/**
|
|
272
|
+
* The repo's prune pass has waited `periods` prune periods in a row, each because pushes moved its
|
|
273
|
+
* refs onto what its rewrite was about to drop: the repo's unreachable objects stay until a period
|
|
274
|
+
* quiet enough for a pass to end. Sent once the pass has waited `prunePeriodsMost` periods, then
|
|
275
|
+
* once each further one, in the commit that writes the wait, and no more once a pass ends. No job
|
|
276
|
+
* is failed, so there is nothing to retry or discard. `error` says why, in the core's words.
|
|
277
|
+
*/
|
|
278
|
+
const RepoPruneRefused = /* @__PURE__ */ Schema.Struct({
|
|
279
|
+
...RepoEnvelope.fields,
|
|
280
|
+
type: Schema.Literal("repo.work.failed"),
|
|
281
|
+
name: Schema.Literal("git.repack"),
|
|
282
|
+
key: Schema.Literal("prune"),
|
|
283
|
+
refused: Schema.Literal("busy"),
|
|
284
|
+
periods: Schema.Int,
|
|
285
|
+
error: Schema.String
|
|
286
|
+
});
|
|
287
|
+
/**
|
|
288
|
+
* `repo.work.failed`: a job's last try failed, a round of index builds was refused, or pushes kept
|
|
289
|
+
* the prune pass from ending.
|
|
290
|
+
*/
|
|
291
|
+
const RepoWorkFailed = /* @__PURE__ */ Schema.Union([
|
|
292
|
+
RepoJobFailed,
|
|
293
|
+
RepoIndexRefused,
|
|
294
|
+
RepoPruneRefused
|
|
295
|
+
]);
|
|
272
296
|
const RepoEvent = /* @__PURE__ */ Schema.Union([
|
|
273
297
|
RepoCreated,
|
|
274
298
|
RepoDeletedEvent,
|
|
@@ -504,4 +528,4 @@ const keepsEvents = (log) => log !== void 0 && log.deliveries.length > 0;
|
|
|
504
528
|
* `layer`; a repo's feed is `EventStreams`'.
|
|
505
529
|
*/
|
|
506
530
|
var Events = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Events")) {};
|
|
507
|
-
export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, Events, FenceReason, FencedPack, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, events_exports, keepsEvents };
|
|
531
|
+
export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, Events, FenceReason, FencedPack, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoPruneRefused, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, events_exports, keepsEvents };
|
package/dist/contracts/git.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ import { PinnedRepo } from "./repos.mjs";
|
|
|
9
9
|
import { GitError } from "./result.mjs";
|
|
10
10
|
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Option from "effect/Option";
|
|
12
|
-
import { Committed,
|
|
12
|
+
import { Committed, CurrentJob, Job, Key, Moment, Read, Records, Row, WatchedRow } from "@ref0/infra";
|
|
13
13
|
import * as Context from "effect/Context";
|
|
14
14
|
import * as Stream from "effect/Stream";
|
|
15
15
|
/**
|
|
@@ -99,6 +99,11 @@ export interface UpkeepStep {
|
|
|
99
99
|
export type Upkeep = (input: {
|
|
100
100
|
readonly repo: InternalRepoId;
|
|
101
101
|
readonly at: Moment;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the repo is deleted: its purge deletes the rows that only wait for their day, so a
|
|
104
|
+
* step leaves them to it and answers no time for them (#2282).
|
|
105
|
+
*/
|
|
106
|
+
readonly deleted: boolean;
|
|
102
107
|
}) => Effect.Effect<UpkeepStep, GitError>;
|
|
103
108
|
/** A step of a registration's purge: `did` when it deleted some, `waits` while what it ends stands, `done`. */
|
|
104
109
|
export type PurgeStep = 'did' | 'waits' | 'done';
|
|
@@ -187,8 +192,13 @@ export interface Registration {
|
|
|
187
192
|
readonly addUpkeep: (step: Hook<Upkeep>) => Effect.Effect<void>;
|
|
188
193
|
readonly addPurge: (step: Hook<Purge>) => Effect.Effect<void>;
|
|
189
194
|
readonly addRoute: (route: Hook<Route>) => Effect.Effect<void>;
|
|
190
|
-
/**
|
|
191
|
-
|
|
195
|
+
/**
|
|
196
|
+
* A job named `<registration name>.<job>`: `job`, an infra `Job.make`, its try `handler`, and
|
|
197
|
+
* `options`' `onFailure`, each run in a budget of the adapter's `callLimits` made fresh for each
|
|
198
|
+
* run, as Git's own jobs are, so a try's store, bucket and outbound calls stop at its bound. Each
|
|
199
|
+
* runs with the services `addJob` ran with, beneath its own `CurrentJob`, fence and budget.
|
|
200
|
+
*/
|
|
201
|
+
readonly addJob: <Name extends string, Data, Encoded, E, E2 = never>(job: Job.Definition<Name, Data, Encoded>, handler: Job.Handler<Data, E, CurrentJob.CurrentJob>, options?: Job.DefinitionOptions<Data, E2, CurrentJob.CurrentJob>) => Effect.Effect<void>;
|
|
192
202
|
readonly addGrant: (resolver: Hook<GrantResolver>) => Effect.Effect<void>;
|
|
193
203
|
}
|
|
194
204
|
declare const Git_base: Context.ServiceClass<Git, "@ref0/git/Git", {
|
|
@@ -567,6 +567,14 @@ export interface ObjectsStep {
|
|
|
567
567
|
* row that every `repack` run yields to.
|
|
568
568
|
*/
|
|
569
569
|
readonly parks?: GitError;
|
|
570
|
+
/**
|
|
571
|
+
* On the step that writes the prune pass's wait for the next period because pushes moved its
|
|
572
|
+
* refs onto what its rewrite was about to drop: how many periods in a row the pass has now
|
|
573
|
+
* waited so, counting this one. A wait for any other reason, or a pass that ends, starts the
|
|
574
|
+
* count again. From `prunePeriodsMost` on, the core sends `repo.work.failed` with `refused:
|
|
575
|
+
* 'busy'` in the step's commit (#2233).
|
|
576
|
+
*/
|
|
577
|
+
readonly busy?: number;
|
|
570
578
|
}
|
|
571
579
|
/** Infra's bucket, as the Effect service the objects call. */
|
|
572
580
|
type Bucket$1 = Bucket.Bucket['Service'];
|
|
@@ -626,6 +634,11 @@ export interface VisibleInput extends CallInput {
|
|
|
626
634
|
readonly tips: readonly Oid[];
|
|
627
635
|
/** The repo's `index` row's value, from the read the tips came from, so the set reads one version. */
|
|
628
636
|
readonly row?: unknown;
|
|
637
|
+
/**
|
|
638
|
+
* The repo's roots, from the read the tips came from: the set's walks follow none's parents,
|
|
639
|
+
* so a commit only a root's stored parent reaches is never in it. None when left out.
|
|
640
|
+
*/
|
|
641
|
+
readonly roots?: ReadonlySet<Oid>;
|
|
629
642
|
}
|
|
630
643
|
/**
|
|
631
644
|
* What one caller may read of a repo: the objects its refs reach, as `IndexedObjects.visible`
|
|
@@ -794,6 +807,11 @@ export interface IndexReachInput extends CallInput {
|
|
|
794
807
|
readonly row?: unknown;
|
|
795
808
|
readonly tips: readonly Oid[];
|
|
796
809
|
readonly wants: readonly Oid[];
|
|
810
|
+
/**
|
|
811
|
+
* The repo's roots, from the read the tips came from: a walk from a tip the index doesn't hold
|
|
812
|
+
* follows none's parents, as the index's own graph doesn't. None when left out.
|
|
813
|
+
*/
|
|
814
|
+
readonly roots?: ReadonlySet<Oid> | undefined;
|
|
797
815
|
}
|
|
798
816
|
/**
|
|
799
817
|
* A repo's index as its `index` row says at a moment, one state at a time, so a host's `switch` on
|
|
@@ -39,9 +39,10 @@ export type CandidateState = typeof CandidateState.Type;
|
|
|
39
39
|
* `conflict`: it didn't merge onto the target; `reported`: a report blamed it; `host-error`: the
|
|
40
40
|
* host's `merge` or `lanes` threw; `interaction`: it passed alone and failed together twice;
|
|
41
41
|
* `refused`: a push rule, a hook group or `authorize` refused its publication; `tooManyCommits`: it
|
|
42
|
-
* adds more commits past the target's tip than `entryCommits` lets its link read
|
|
42
|
+
* adds more commits past the target's tip than `entryCommits` lets its link read; `tooLarge`: its
|
|
43
|
+
* link runs past what one build try may read, write or spend in time.
|
|
43
44
|
*/
|
|
44
|
-
export declare const EntryFailureReason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits"]>;
|
|
45
|
+
export declare const EntryFailureReason: Schema.Literals<readonly ["conflict", "reported", "host-error", "interaction", "refused", "tooManyCommits", "tooLarge"]>;
|
|
45
46
|
export type EntryFailureReason = typeof EntryFailureReason.Type;
|
|
46
47
|
/** `passed`: a bisect group's pass, which judges its entries and merges none (Q489). */
|
|
47
48
|
export declare const CandidateCloseReason: Schema.Literals<readonly ["merged", "passed", "failed", "cancelled", "timeout", "superseded", "restarted"]>;
|
package/dist/contracts/queue.mjs
CHANGED
|
@@ -48,7 +48,8 @@ const CandidateState = /* @__PURE__ */ Schema.Literals([
|
|
|
48
48
|
* `conflict`: it didn't merge onto the target; `reported`: a report blamed it; `host-error`: the
|
|
49
49
|
* host's `merge` or `lanes` threw; `interaction`: it passed alone and failed together twice;
|
|
50
50
|
* `refused`: a push rule, a hook group or `authorize` refused its publication; `tooManyCommits`: it
|
|
51
|
-
* adds more commits past the target's tip than `entryCommits` lets its link read
|
|
51
|
+
* adds more commits past the target's tip than `entryCommits` lets its link read; `tooLarge`: its
|
|
52
|
+
* link runs past what one build try may read, write or spend in time.
|
|
52
53
|
*/
|
|
53
54
|
const EntryFailureReason = /* @__PURE__ */ Schema.Literals([
|
|
54
55
|
"conflict",
|
|
@@ -56,7 +57,8 @@ const EntryFailureReason = /* @__PURE__ */ Schema.Literals([
|
|
|
56
57
|
"host-error",
|
|
57
58
|
"interaction",
|
|
58
59
|
"refused",
|
|
59
|
-
"tooManyCommits"
|
|
60
|
+
"tooManyCommits",
|
|
61
|
+
"tooLarge"
|
|
60
62
|
]);
|
|
61
63
|
/** `passed`: a bisect group's pass, which judges its entries and merges none (Q489). */
|
|
62
64
|
const CandidateCloseReason = /* @__PURE__ */ Schema.Literals([
|
package/dist/core/ancestry.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { catchSpent, ownSpentOf } from "../contracts/calls-spent.mjs";
|
|
|
3
3
|
import { fromDiff } from "../engine/failures.mjs";
|
|
4
4
|
import { walkHistory } from "../engine/walk.mjs";
|
|
5
5
|
import { ReadTally, defaultDiffLimits, drained } from "../protocol/diff/read.mjs";
|
|
6
|
-
import { decodeCommit } from "../protocol/objects/commit.mjs";
|
|
6
|
+
import { decodeCommit, noRepoRoots, parentsWithin } from "../protocol/objects/commit.mjs";
|
|
7
7
|
import { CallBudget, budgetedOn, callScope, spentBudget } from "../store/call-count.mjs";
|
|
8
8
|
import { isLimitRefusal } from "../store/errors.mjs";
|
|
9
9
|
import { runIn } from "../store/crossing.mjs";
|
|
@@ -182,6 +182,7 @@ const seenOf = (input, limit, walk, scope) => {
|
|
|
182
182
|
}), scope, signal);
|
|
183
183
|
return {
|
|
184
184
|
read,
|
|
185
|
+
roots: input.roots ?? noRepoRoots,
|
|
185
186
|
object: (oid) => object(oid),
|
|
186
187
|
type
|
|
187
188
|
};
|
|
@@ -221,7 +222,7 @@ const isBehind = (seen, from, to) => walkHistory(seen.read, {
|
|
|
221
222
|
wants: [from],
|
|
222
223
|
haves: [to],
|
|
223
224
|
page: { limit: 1 }
|
|
224
|
-
}, unclocked()).pipe(Effect.map((listed) => listed.items.length === 0), Effect.catchIf((error) => error.code === "NOT_FOUND", () => Effect.succeed(false)));
|
|
225
|
+
}, unclocked(), seen.roots).pipe(Effect.map((listed) => listed.items.length === 0), Effect.catchIf((error) => error.code === "NOT_FOUND", () => Effect.succeed(false)));
|
|
225
226
|
/**
|
|
226
227
|
* One edit's kind, or why its ref is refused. As Git's `receive-pack` does, a move is a
|
|
227
228
|
* fast-forward only when both tips are commits, not tags, and the old one is behind the new.
|
|
@@ -242,7 +243,7 @@ const kindOf = /* @__PURE__ */ Effect.fnUntraced(function* (seen, edit, absent)
|
|
|
242
243
|
}, (kind, _seen, edit) => Effect.catchIf(kind, isLimitRefusal, (error) => Effect.succeed(refusal(error.cause instanceof WalkCallsSpent ? callsPast(error.cause, edit.ref) : error))));
|
|
243
244
|
/**
|
|
244
245
|
* `Kinds.exact`: every parent from the new tip, depth first, until the old tip or the history's
|
|
245
|
-
* end. A parent the repo lacks ends its line, as a missing old tip makes a force. Past the push's
|
|
246
|
+
* end, a root of the repo's being one. A parent the repo lacks ends its line, as a missing old tip makes a force. Past the push's
|
|
246
247
|
* distinct objects, at an object past `ancestryBytes`, or past the walks' calls, `walk-limit`.
|
|
247
248
|
*/
|
|
248
249
|
const exactOf = (seen, limit) => Effect.fnUntraced(function* (update) {
|
|
@@ -256,7 +257,7 @@ const exactOf = (seen, limit) => Effect.fnUntraced(function* (update) {
|
|
|
256
257
|
const found = yield* seen.object(oid);
|
|
257
258
|
if (found === void 0) continue;
|
|
258
259
|
const commit = yield* decodeCommit(found.bytes).pipe(Effect.catch((error) => fail("DATA_LOSS", `${oid} is unreadable: ${error.message}`)));
|
|
259
|
-
for (const parent of commit.parents) {
|
|
260
|
+
for (const parent of parentsWithin(seen.roots, oid, commit.parents)) {
|
|
260
261
|
if (met.has(parent)) continue;
|
|
261
262
|
met.add(parent);
|
|
262
263
|
todo.push(parent);
|
package/dist/core/index-job.mjs
CHANGED
|
@@ -154,12 +154,17 @@ const indexAttempt = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store,
|
|
|
154
154
|
exempt: true
|
|
155
155
|
});
|
|
156
156
|
const repack = parts.repackJobRow !== void 0 && liftsHolds(indexRowOf(row), indexRowOf(step.row), listed) ? [parts.repackJobRow()] : [];
|
|
157
|
+
const retry = yield* lostRetry(step.row, landed, (when) => index.status(step.row, when, ids));
|
|
157
158
|
const committed = yield* storeCall(() => store.commit(scope, {
|
|
158
159
|
id: newChangeId(),
|
|
159
160
|
expect: snapshot.version,
|
|
160
161
|
put: [step.row, ...appended.put],
|
|
161
162
|
delete: appended.delete,
|
|
162
|
-
jobs: [
|
|
163
|
+
jobs: [
|
|
164
|
+
...appended.jobs,
|
|
165
|
+
...repack,
|
|
166
|
+
...retry
|
|
167
|
+
]
|
|
163
168
|
}));
|
|
164
169
|
return {
|
|
165
170
|
ended: committed.ok ? "landed" : "missed",
|
|
@@ -169,6 +174,23 @@ const indexAttempt = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store,
|
|
|
169
174
|
}
|
|
170
175
|
};
|
|
171
176
|
});
|
|
177
|
+
/**
|
|
178
|
+
* The try a refused row a read marked lost gets, `landed` its status: when it waits for its
|
|
179
|
+
* tries' wait, the next round's, due at its end; else none.
|
|
180
|
+
*/
|
|
181
|
+
const lostRetry = (row, landed, statusAt) => {
|
|
182
|
+
const built = indexRowOf(row);
|
|
183
|
+
if (landed.state !== "refused" || built === void 0 || "refused" in built) return Effect.succeed([]);
|
|
184
|
+
if (built.lost !== true) return Effect.succeed([]);
|
|
185
|
+
const due = statusAt(landed.retryAt);
|
|
186
|
+
if (due.state !== "retry") return Effect.succeed([]);
|
|
187
|
+
const job = IndexJob.job({
|
|
188
|
+
key: indexJobKeyOf(due.round),
|
|
189
|
+
data: {},
|
|
190
|
+
at: landed.retryAt
|
|
191
|
+
});
|
|
192
|
+
return Effect.map(Effect.orDie(job), (made) => [made]);
|
|
193
|
+
};
|
|
172
194
|
/** `repo.work.failed` for a round of index builds `refusal` stopped, in the repo's name now. */
|
|
173
195
|
const refusedEvent = (repo, refusal) => ({
|
|
174
196
|
type: "repo.work.failed",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InternalRepoId } from "../contracts/ids.mjs";
|
|
2
|
+
import "../contracts/objects.mjs";
|
|
3
|
+
import "../contracts/promises.mjs";
|
|
4
|
+
import { Listed } from "../contracts/store.mjs";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import { JobInput, Moment, Row } from "@ref0/infra";
|
|
7
|
+
/**
|
|
8
|
+
* A read's ask for the rebuild of the `index` row it read, `row`, once the index it names failed
|
|
9
|
+
* its own checks: `listed` is the listing the read was at.
|
|
10
|
+
*/
|
|
11
|
+
export type IndexLost = (repo: InternalRepoId, row: Row, listed: Listed) => Effect.Effect<void>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { bestEffort, storeCall } from "../store/errors.mjs";
|
|
2
|
+
import { newChangeId, repoScope } from "../store/scopes.mjs";
|
|
3
|
+
import { lostIndexRow } from "../storage/index-build.mjs";
|
|
4
|
+
import { indexJobs } from "./access.mjs";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
// src/core/index-lost.ts
|
|
7
|
+
/** The rows a server keeps asked, past which it forgets the oldest: each a repo's row it read. */
|
|
8
|
+
const lostRowsMost = 1024;
|
|
9
|
+
/**
|
|
10
|
+
* A server's ask for the rebuild of an `index` row whose files fail their own checks, as a
|
|
11
|
+
* `.bitmaps` lost, cut short or with a bitmap that won't decode (Q839 (5)): one commit, at the
|
|
12
|
+
* version the read was at, of the row marked lost (`lostIndexRow`) and the row's own `git.index`
|
|
13
|
+
* round. Marked, the row covers nothing, so the reads after it walk with no error, and the try
|
|
14
|
+
* builds it again whole, its new row unmarked; the commit's job makes a waiting row due now. So the
|
|
15
|
+
* walk lasts one rebuild, not until the next push. A server asks once a row while it runs.
|
|
16
|
+
*
|
|
17
|
+
* The ask is best effort: a read never fails on it. A commit that fails, a store's refusal or the
|
|
18
|
+
* read's calls spent, is a warning in the log, and one that loses its version to another commit,
|
|
19
|
+
* as a push's, is dropped quietly: either way, the row is left to the next read that meets it. A
|
|
20
|
+
* row whose round `indexJobs` saves none for, a refusal's, is left as it is.
|
|
21
|
+
*/
|
|
22
|
+
const indexLostAsk = (parts) => {
|
|
23
|
+
const asked = /* @__PURE__ */ new Set();
|
|
24
|
+
return (repo, row, listed) => {
|
|
25
|
+
const key = rowKey(repo, row);
|
|
26
|
+
return Effect.gen(function* () {
|
|
27
|
+
if (asked.has(key)) return;
|
|
28
|
+
asked.add(key);
|
|
29
|
+
for (const old of asked) {
|
|
30
|
+
if (asked.size <= 1024) break;
|
|
31
|
+
asked.delete(old);
|
|
32
|
+
}
|
|
33
|
+
const marked = lostIndexRow(row);
|
|
34
|
+
const at = yield* parts.now;
|
|
35
|
+
const packs = listed.packs.map((pack) => pack.id);
|
|
36
|
+
const jobs = indexJobs({ indexJobRow: parts.indexJobRow }, parts.status(row, at, packs));
|
|
37
|
+
if (marked === void 0 || jobs.length === 0) return;
|
|
38
|
+
const failed = (error) => {
|
|
39
|
+
asked.delete(key);
|
|
40
|
+
return Effect.logWarning(`The rebuild of repo ${repo}'s unreadable index wasn't saved, so a later read asks again: ${error.message}`);
|
|
41
|
+
};
|
|
42
|
+
const change = {
|
|
43
|
+
id: newChangeId(),
|
|
44
|
+
expect: listed.version,
|
|
45
|
+
put: [marked],
|
|
46
|
+
jobs
|
|
47
|
+
};
|
|
48
|
+
const committed = yield* bestEffort(storeCall(() => parts.store.commit(repoScope(repo), change)), failed).pipe(Effect.onInterrupt(() => Effect.sync(() => asked.delete(key))));
|
|
49
|
+
if (committed !== void 0 && !committed.ok) asked.delete(key);
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/** A repo's `index` row, as the set of rows asked keeps it. */
|
|
54
|
+
const rowKey = (repo, row) => `${repo}\u0000${JSON.stringify(row.value)}`;
|
|
55
|
+
export { indexLostAsk, lostRowsMost };
|
|
@@ -30,7 +30,7 @@ const mergedTree = /* @__PURE__ */ Effect.fnUntraced(function* (opened, made, si
|
|
|
30
30
|
const input = { ...sides };
|
|
31
31
|
if (options.limits !== void 0) input.limits = options.limits;
|
|
32
32
|
if (options.signal !== void 0) input.signal = options.signal;
|
|
33
|
-
const merged = yield* parts.mergeTrees(opened.read, input, callAllot(opened), call);
|
|
33
|
+
const merged = yield* parts.mergeTrees(opened.read, input, callAllot(opened), call, opened.roots);
|
|
34
34
|
yield* takeWrites(made, merged.objects);
|
|
35
35
|
return merged.tree;
|
|
36
36
|
});
|
|
@@ -37,16 +37,17 @@ const commitCalls = (bound) => {
|
|
|
37
37
|
const tips = opened.oids;
|
|
38
38
|
const [tip = ""] = tips;
|
|
39
39
|
const page = innerPage(input.page, held);
|
|
40
|
-
const
|
|
40
|
+
const { read, roots } = opened;
|
|
41
|
+
const listing = input.path === void 0 ? yield* walkHistory(read, {
|
|
41
42
|
...input,
|
|
42
43
|
wants: [tip],
|
|
43
44
|
page
|
|
44
|
-
}) : yield* walkPath(
|
|
45
|
+
}, void 0, roots) : yield* walkPath(read, {
|
|
45
46
|
...input,
|
|
46
47
|
want: tip,
|
|
47
48
|
path: input.path,
|
|
48
49
|
page
|
|
49
|
-
});
|
|
50
|
+
}, roots);
|
|
50
51
|
return yield* withinResponse(heldListing(listing, digest, tips), "The commit page");
|
|
51
52
|
}, Effect.scoped),
|
|
52
53
|
mergeBase: Effect.fnUntraced(function* (repo, input) {
|
|
@@ -54,7 +55,7 @@ const commitCalls = (bound) => {
|
|
|
54
55
|
return yield* mergeBases(opened.read, {
|
|
55
56
|
...input,
|
|
56
57
|
commits: opened.oids
|
|
57
|
-
});
|
|
58
|
+
}, void 0, opened.roots);
|
|
58
59
|
}, Effect.scoped),
|
|
59
60
|
diff: Effect.fnUntraced(function* (repo, input) {
|
|
60
61
|
const renames = input.renames !== false;
|
|
@@ -93,7 +94,7 @@ const commitCalls = (bound) => {
|
|
|
93
94
|
if (commitsHeld !== void 0 && filesHeld !== void 0 && commitsHeld.oids.join() !== filesHeld.oids.join()) return yield* badCursor();
|
|
94
95
|
const opened = yield* openRead(callerOf(input), repo, held?.oids ?? [input.base, input.head], input.internalId);
|
|
95
96
|
const [base = "", head = ""] = opened.oids;
|
|
96
|
-
const { read } = opened;
|
|
97
|
+
const { read, roots } = opened;
|
|
97
98
|
const deadline = yield* deadlineOf(limits.milliseconds, "diff-limit");
|
|
98
99
|
const call = {
|
|
99
100
|
tally: new ReadTally(limits.reads),
|
|
@@ -107,17 +108,17 @@ const commitCalls = (bound) => {
|
|
|
107
108
|
const { bases } = yield* mergeBases(read, {
|
|
108
109
|
...input,
|
|
109
110
|
commits: [base, head]
|
|
110
|
-
}, call);
|
|
111
|
+
}, call, roots);
|
|
111
112
|
const ahead = yield* countHistory(read, {
|
|
112
113
|
...input,
|
|
113
114
|
wants: [head],
|
|
114
115
|
haves: [base]
|
|
115
|
-
}, call);
|
|
116
|
+
}, call, roots);
|
|
116
117
|
const behind = yield* countHistory(read, {
|
|
117
118
|
...input,
|
|
118
119
|
wants: [base],
|
|
119
120
|
haves: [head]
|
|
120
|
-
}, call);
|
|
121
|
+
}, call, roots);
|
|
121
122
|
const page = innerPage(input.commits, commitsHeld);
|
|
122
123
|
const listed = {
|
|
123
124
|
...input,
|
|
@@ -125,7 +126,7 @@ const commitCalls = (bound) => {
|
|
|
125
126
|
haves: [base],
|
|
126
127
|
page
|
|
127
128
|
};
|
|
128
|
-
const commits = input.commits?.limit === 0 ? { items: [] } : yield* walkHistory(read, listed, call);
|
|
129
|
+
const commits = input.commits?.limit === 0 ? { items: [] } : yield* walkHistory(read, listed, call, roots);
|
|
129
130
|
return {
|
|
130
131
|
first: bases[0],
|
|
131
132
|
ahead,
|
|
@@ -41,7 +41,7 @@ const mergeCalls = (bound) => {
|
|
|
41
41
|
const { bases } = yield* mergeBases(opened.read, {
|
|
42
42
|
...input,
|
|
43
43
|
commits
|
|
44
|
-
}, call);
|
|
44
|
+
}, call, opened.roots);
|
|
45
45
|
if (bases.includes(theirs)) return { oid: tip };
|
|
46
46
|
const [base] = bases;
|
|
47
47
|
if (base === void 0) return yield* fail("FAILED_PRECONDITION", "refusing to merge unrelated histories", { hint: `${input.theirs} shares no history with ${ours}` });
|