@ref0/git 0.7.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/access/private-refs.mjs +0 -2
- package/dist/auth/authorize.mjs +31 -24
- package/dist/auth/bridge.mjs +8 -8
- package/dist/auth/fences.d.mts +0 -1
- package/dist/auth/fences.mjs +1 -1
- package/dist/auth/grants.d.mts +0 -1
- package/dist/auth/grants.mjs +2 -2
- package/dist/auth/host-function.d.mts +1 -7
- package/dist/auth/host-function.mjs +38 -38
- package/dist/auth/identify.d.mts +0 -1
- package/dist/auth/identify.mjs +1 -1
- package/dist/auth/policy.d.mts +7 -4
- package/dist/auth/policy.mjs +13 -10
- package/dist/auth/token-rows.mjs +2 -5
- package/dist/auth/tokens-layer.d.mts +0 -2
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens-public.mjs +4 -2
- package/dist/auth/tokens.d.mts +6 -1
- package/dist/auth/tokens.mjs +7 -1
- package/dist/client/client.d.mts +22 -15
- package/dist/client/client.mjs +31 -27
- package/dist/client/git-http.mjs +22 -5
- package/dist/client/local.mjs +1 -1
- package/dist/client/namespace.d.mts +2 -0
- package/dist/client/push-upload.d.mts +1 -0
- package/dist/client/push-upload.mjs +169 -2
- package/dist/client/remote-helper.mjs +2 -4
- package/dist/client/remote.mjs +37 -15
- package/dist/client/run-remote-helper.mjs +4 -4
- package/dist/client/transport.mjs +26 -19
- package/dist/contracts/actors.d.mts +57 -28
- package/dist/contracts/actors.mjs +38 -2
- package/dist/contracts/authorize.d.mts +21 -15
- package/dist/contracts/callers.mjs +40 -0
- package/dist/contracts/calls-spent.d.mts +2 -12
- package/dist/contracts/calls-spent.mjs +4 -5
- package/dist/contracts/client.d.mts +16 -9
- package/dist/contracts/events.d.mts +82 -14
- package/dist/contracts/events.mjs +35 -9
- package/dist/contracts/files.d.mts +42 -42
- package/dist/contracts/forks.d.mts +0 -24
- package/dist/contracts/git-hooks.d.mts +217 -0
- package/dist/contracts/git-hooks.mjs +3 -1
- package/dist/contracts/git.d.mts +13 -3
- package/dist/contracts/grants.d.mts +46 -27
- package/dist/contracts/lfs.d.mts +17 -4
- package/dist/contracts/merges.d.mts +7 -7
- package/dist/contracts/objects.d.mts +38 -4
- package/dist/contracts/opaque.mjs +19 -1
- package/dist/contracts/operations.d.mts +8 -1
- package/dist/contracts/operations.mjs +209 -0
- package/dist/contracts/queue.d.mts +6 -5
- package/dist/contracts/queue.mjs +9 -20
- package/dist/contracts/remote.d.mts +13 -4
- package/dist/contracts/remote.mjs +3 -3
- package/dist/contracts/repos.d.mts +11 -40
- package/dist/contracts/repos.mjs +11 -10
- package/dist/contracts/result.d.mts +28 -11
- package/dist/contracts/result.mjs +32 -2
- package/dist/contracts/rules.d.mts +706 -46
- package/dist/contracts/rules.mjs +81 -2
- package/dist/contracts/server.d.mts +5 -275
- package/dist/contracts/services.d.mts +0 -3
- package/dist/contracts/services.mjs +1 -3
- package/dist/contracts/signin.d.mts +2 -2
- package/dist/contracts/signin.mjs +4 -5
- package/dist/contracts/sync.d.mts +1 -4
- package/dist/contracts/tokens.d.mts +29 -17
- package/dist/contracts/tokens.mjs +14 -3
- package/dist/contracts/topics.d.mts +38 -11
- package/dist/contracts/topics.mjs +8 -2
- package/dist/core/access.d.mts +0 -2
- package/dist/core/access.mjs +15 -4
- package/dist/core/ancestry.mjs +5 -4
- package/dist/core/events/deliver.mjs +19 -1
- package/dist/core/forks.mjs +30 -11
- package/dist/core/hooks/groups.d.mts +0 -1
- package/dist/core/hooks/groups.mjs +8 -9
- 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/loose-tally.mjs +46 -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/objects/writing.mjs +1 -0
- package/dist/core/parts.d.mts +7 -0
- package/dist/core/promise.mjs +1 -15
- package/dist/core/publish.mjs +9 -5
- package/dist/core/purge.mjs +30 -12
- package/dist/core/push.mjs +39 -16
- package/dist/core/ref-view.mjs +14 -6
- package/dist/core/repack.mjs +54 -27
- package/dist/core/repo-info.mjs +8 -6
- package/dist/core/repos.mjs +1 -0
- package/dist/core/rules/check.mjs +10 -10
- package/dist/core/rules/context.d.mts +3 -1
- package/dist/core/rules/context.mjs +16 -13
- package/dist/core/rules/fetch.mjs +17 -23
- package/dist/core/tokens.mjs +2 -1
- package/dist/core/view.d.mts +10 -1
- package/dist/core/view.mjs +15 -6
- package/dist/effect.d.mts +3 -6
- package/dist/effect.mjs +3 -6
- package/dist/engine/commits.mjs +23 -50
- package/dist/engine/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +9 -7
- package/dist/engine/merge.mjs +20 -17
- package/dist/engine/parts.d.mts +1 -0
- package/dist/engine/parts.mjs +1 -1
- package/dist/engine/walk.mjs +15 -11
- package/dist/extend.d.mts +1 -2
- package/dist/extend.mjs +1 -2
- package/dist/http/core-parts.mjs +18 -10
- package/dist/http/handler.mjs +11 -31
- package/dist/http/parts.d.mts +0 -1
- package/dist/index.d.mts +29 -22
- package/dist/index.mjs +5 -2
- package/dist/lfs/base.d.mts +6 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +23 -9
- package/dist/lfs/objects.mjs +93 -41
- package/dist/lfs/pointers.mjs +69 -18
- package/dist/lfs/purge.mjs +6 -2
- package/dist/lfs/rows.mjs +24 -7
- package/dist/lfs/service.d.mts +6 -3
- package/dist/lfs/service.mjs +8 -2
- package/dist/lfs/upkeep.mjs +47 -28
- package/dist/lfs/upload-most.mjs +47 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/streams.mjs +84 -2
- package/dist/protocol/bytes/text.mjs +6 -1
- 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/protocol/objects/fsck.mjs +6 -3
- package/dist/queue/advance.mjs +77 -18
- package/dist/queue/calls.mjs +4 -14
- package/dist/queue/host.d.mts +4 -0
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/layer.mjs +4 -2
- package/dist/queue/limits.mjs +18 -2
- package/dist/queue/rows.mjs +10 -1
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +3 -4
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client-namespace.d.mts +2 -0
- package/dist/rest/client.d.mts +32 -8
- package/dist/rest/client.mjs +308 -382
- package/dist/rest/commits.d.mts +150 -150
- package/dist/rest/files.d.mts +18 -18
- package/dist/rest/forks.d.mts +77 -89
- package/dist/rest/handlers.mjs +2 -1
- package/dist/rest/listen.d.mts +8 -6
- package/dist/rest/listen.mjs +31 -75
- package/dist/rest/me.d.mts +2 -2
- package/dist/rest/merges.d.mts +7 -7
- package/dist/rest/refs.d.mts +27 -27
- package/dist/rest/repos.d.mts +40 -52
- package/dist/rest/tokens.d.mts +12 -12
- package/dist/rest/topics.d.mts +13 -13
- package/dist/rest/trees.d.mts +66 -66
- package/dist/rest/wire.d.mts +20 -2
- package/dist/rest/work.d.mts +39 -39
- package/dist/rest.d.mts +1 -7
- package/dist/rest.mjs +1 -5
- package/dist/server/git-layer.d.mts +10 -2
- package/dist/server/git-layer.mjs +29 -10
- package/dist/server/joined.d.mts +12 -6
- package/dist/server/joined.mjs +3 -2
- package/dist/server/registry.mjs +11 -5
- package/dist/server/server.d.mts +0 -1
- package/dist/server/server.mjs +42 -49
- package/dist/signin/context.d.mts +0 -1
- package/dist/signin/context.mjs +5 -9
- package/dist/storage/clean-up.mjs +3 -1
- package/dist/storage/fsck.mjs +12 -2
- package/dist/storage/graph-rebuild.mjs +262 -0
- package/dist/storage/index-bitmaps.mjs +16 -10
- package/dist/storage/index-build.mjs +160 -24
- 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/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/links.mjs +3 -3
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +1 -1
- package/dist/storage/merge-fence.mjs +81 -19
- package/dist/storage/merge-most.mjs +1 -0
- package/dist/storage/merge-row.mjs +16 -4
- package/dist/storage/merge-stream.mjs +9 -6
- package/dist/storage/object-rows.mjs +17 -1
- package/dist/storage/pack-order.d.mts +1 -0
- package/dist/storage/pack-order.mjs +18 -1
- package/dist/storage/pack-receive.mjs +10 -6
- package/dist/storage/packs.mjs +58 -27
- package/dist/storage/prune-walk.mjs +5 -2
- package/dist/storage/prune.mjs +168 -70
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +12 -3
- package/dist/storage/receive-bounds.mjs +3 -2
- package/dist/storage/receive-state.mjs +1 -1
- package/dist/storage/repack-contained.mjs +22 -14
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +3 -2
- package/dist/storage/unpack.mjs +7 -0
- 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 +31 -3
- package/dist/store/call-count.mjs +51 -20
- 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 +26 -5
- package/dist/store/repo-record.mjs +36 -12
- package/dist/store/scopes.mjs +15 -2
- package/dist/sync/bound.d.mts +1 -1
- package/dist/sync/import.mjs +15 -3
- package/dist/sync/layer.d.mts +5 -1
- package/dist/sync/layer.mjs +11 -9
- package/dist/sync/mirror.mjs +1 -1
- package/dist/sync/step.mjs +15 -15
- package/dist/topics/advance.mjs +11 -10
- package/dist/topics/layer.mjs +1 -1
- package/dist/topics/members.mjs +38 -9
- package/package.json +3 -3
- package/dist/engine/merge-base-walk.d.mts +0 -3
- package/dist/server/routes.d.mts +0 -32
- package/dist/server/routes.mjs +0 -69
- package/dist/sync/bridge.d.mts +0 -6
- package/dist/sync/bridge.mjs +0 -29
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import { ActorId, CallInput, Credentials, NamedActor } from "./actors.mjs";
|
|
2
|
-
import { InternalRepoId, RepoName } from "./ids.mjs";
|
|
3
1
|
import { Awaitable } from "./result.mjs";
|
|
4
|
-
import
|
|
5
|
-
export
|
|
6
|
-
readonly credentials:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
export declare const GrantInput: Schema.Struct<{
|
|
4
|
+
readonly credentials: Schema.Union<readonly [Schema.Struct<{
|
|
5
|
+
readonly kind: Schema.Literal<"basic">;
|
|
6
|
+
readonly username: Schema.String;
|
|
7
|
+
readonly password: Schema.String;
|
|
8
|
+
}>, Schema.Struct<{
|
|
9
|
+
readonly kind: Schema.Literal<"bearer">;
|
|
10
|
+
readonly token: Schema.String;
|
|
11
|
+
}>]>;
|
|
12
|
+
readonly request: Schema.declare<Request, Request>;
|
|
13
|
+
readonly signal: Schema.declare<AbortSignal, AbortSignal>;
|
|
14
|
+
}>;
|
|
15
|
+
export type GrantInput = typeof GrantInput.Type;
|
|
10
16
|
/**
|
|
11
17
|
* `internalId`: which repo `repo` names, when Git holds it: decide by it, since a rename can give
|
|
12
18
|
* the name to another repo while a request runs.
|
|
13
19
|
*/
|
|
14
|
-
export
|
|
15
|
-
readonly repo:
|
|
16
|
-
readonly internalId
|
|
17
|
-
readonly signal: AbortSignal
|
|
18
|
-
}
|
|
20
|
+
export declare const GrantReachInput: Schema.Struct<{
|
|
21
|
+
readonly repo: Schema.String;
|
|
22
|
+
readonly internalId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["r_", Schema.String]>>;
|
|
23
|
+
readonly signal: Schema.declare<AbortSignal, AbortSignal>;
|
|
24
|
+
}>;
|
|
25
|
+
export type GrantReachInput = typeof GrantReachInput.Type;
|
|
19
26
|
/**
|
|
20
27
|
* What a credential an extension issued holds: who it acts as, its ceiling, and which repos it
|
|
21
28
|
* reaches, asked on each request and again in a write's final read, so a grant that ends stops at
|
|
@@ -23,11 +30,17 @@ export interface GrantReachInput extends CallInput {
|
|
|
23
30
|
* so work that outlives the request, such as a merge queue entry, keeps the ID, never the
|
|
24
31
|
* credential, and asks for the grant again.
|
|
25
32
|
*/
|
|
26
|
-
export
|
|
27
|
-
readonly id:
|
|
28
|
-
readonly actor:
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
export declare const Grant: Schema.Struct<{
|
|
34
|
+
readonly id: Schema.String;
|
|
35
|
+
readonly actor: Schema.Struct<{
|
|
36
|
+
readonly id: Schema.String;
|
|
37
|
+
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
38
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
39
|
+
}>;
|
|
40
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
41
|
+
readonly id: Schema.String;
|
|
42
|
+
}>>;
|
|
43
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
31
44
|
/**
|
|
32
45
|
* The folder every repo `reaches` answers yes for sits under, read as a prefix token's `prefix`
|
|
33
46
|
* is: `''`, or a prefix that ends in `/`. `forks.list` reads a source's forks under it alone, so
|
|
@@ -35,16 +48,22 @@ export interface Grant {
|
|
|
35
48
|
* and asks `reaches` of each. A `reach` that leaves out a repo `reaches` answers yes for hides
|
|
36
49
|
* that repo from the list.
|
|
37
50
|
*/
|
|
38
|
-
readonly reach
|
|
39
|
-
readonly reaches: (input: GrantReachInput) => Awaitable<boolean
|
|
40
|
-
}
|
|
51
|
+
readonly reach: Schema.optionalKey<Schema.String>;
|
|
52
|
+
readonly reaches: Schema.declare<(input: GrantReachInput) => Awaitable<boolean>, (input: GrantReachInput) => Awaitable<boolean>>;
|
|
53
|
+
}>;
|
|
54
|
+
export type Grant = typeof Grant.Type;
|
|
41
55
|
/** A grant asked for again by the `id` it had, with the actor and subject it acted as then. */
|
|
42
|
-
export
|
|
43
|
-
readonly id:
|
|
44
|
-
readonly actor:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
export declare const GrantAgainInput: Schema.Struct<{
|
|
57
|
+
readonly id: Schema.String;
|
|
58
|
+
readonly actor: Schema.Struct<{
|
|
59
|
+
readonly id: Schema.String;
|
|
60
|
+
}>;
|
|
61
|
+
readonly subject: Schema.optionalKey<Schema.Struct<{
|
|
62
|
+
readonly id: Schema.String;
|
|
63
|
+
}>>;
|
|
64
|
+
readonly signal: Schema.declare<AbortSignal, AbortSignal>;
|
|
65
|
+
}>;
|
|
66
|
+
export type GrantAgainInput = typeof GrantAgainInput.Type;
|
|
48
67
|
/**
|
|
49
68
|
* What host code asks `grantAgain` with: `GrantAgainInput`, its `signal` optional. The resolver
|
|
50
69
|
* gets it joined with Git's own, so a request that goes away stops the read.
|
package/dist/contracts/lfs.d.mts
CHANGED
|
@@ -2,13 +2,26 @@ import { ActorInput } from "./actors.mjs";
|
|
|
2
2
|
import { RepoName } from "./ids.mjs";
|
|
3
3
|
import "./objects.mjs";
|
|
4
4
|
import { RepoInput } from "./repos.mjs";
|
|
5
|
-
import { Bytes } from "./object-values.mjs";
|
|
6
5
|
import { Result } from "./result.mjs";
|
|
6
|
+
import { Bytes } from "./object-values.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* The caps an upload through the server meets, on a bucket that signs no links, so each upload's
|
|
9
|
+
* bytes stream through it: an upload past what they let finish is refused at the batch, 422, and
|
|
10
|
+
* its PUT, 413, before a byte streams. Each wins over the adapter's `RequestLimits`, which the
|
|
11
|
+
* platform's Layer gives, as Cloudflare's 100 MiB and 30,000 ms: set them where the host's differ,
|
|
12
|
+
* a zone's plan that takes a larger body, or a Worker's raised `limits.cpu_ms`.
|
|
13
|
+
*/
|
|
14
|
+
export interface LfsOptions {
|
|
15
|
+
/** The largest request body the host's platform passes on, in bytes. */
|
|
16
|
+
readonly bodyCap?: number;
|
|
17
|
+
/** The CPU one of the host's requests may use, in milliseconds, as a Worker's `limits.cpu_ms`. */
|
|
18
|
+
readonly cpuMs?: number;
|
|
19
|
+
}
|
|
7
20
|
/**
|
|
8
|
-
* Turns on Git LFS: `lfs()`, from `@ref0/git`, which `createGitServer` builds `Lfs.layer()` for
|
|
9
|
-
* bucket alone turns nothing on.
|
|
21
|
+
* Turns on Git LFS: `lfs()`, from `@ref0/git`, which `createGitServer` builds `Lfs.layer()` for,
|
|
22
|
+
* with its options. A bucket alone turns nothing on.
|
|
10
23
|
*/
|
|
11
|
-
export interface LfsFeature {
|
|
24
|
+
export interface LfsFeature extends LfsOptions {
|
|
12
25
|
readonly kind: 'lfs';
|
|
13
26
|
}
|
|
14
27
|
/** An LFS object, by its oid, the SHA-256 of its bytes in 64 hex digits. */
|
|
@@ -8,6 +8,13 @@ import * as Schema from "effect/Schema";
|
|
|
8
8
|
* parents are `ours`' tip and `theirs`. Unrelated histories are refused.
|
|
9
9
|
*/
|
|
10
10
|
export declare const MergeCreate: Schema.Struct<{
|
|
11
|
+
readonly message: Schema.String;
|
|
12
|
+
readonly author: Schema.Struct<{
|
|
13
|
+
readonly name: Schema.String;
|
|
14
|
+
readonly email: Schema.String;
|
|
15
|
+
readonly at: Schema.Number;
|
|
16
|
+
readonly offset: Schema.Int;
|
|
17
|
+
}>;
|
|
11
18
|
readonly ours: Schema.String;
|
|
12
19
|
readonly theirs: Schema.String;
|
|
13
20
|
/** The author, when left out. */
|
|
@@ -17,13 +24,6 @@ export declare const MergeCreate: Schema.Struct<{
|
|
|
17
24
|
readonly at: Schema.Number;
|
|
18
25
|
readonly offset: Schema.Int;
|
|
19
26
|
}>>;
|
|
20
|
-
readonly message: Schema.String;
|
|
21
|
-
readonly author: Schema.Struct<{
|
|
22
|
-
readonly name: Schema.String;
|
|
23
|
-
readonly email: Schema.String;
|
|
24
|
-
readonly at: Schema.Number;
|
|
25
|
-
readonly offset: Schema.Int;
|
|
26
|
-
}>;
|
|
27
27
|
}>;
|
|
28
28
|
export type MergeCreate = typeof MergeCreate.Type;
|
|
29
29
|
export interface MergeCreateInput extends WriteInput, MergeCreate, Pick<RepoInput, 'internalId'> {}
|
|
@@ -251,11 +251,26 @@ export interface SegmentCut {
|
|
|
251
251
|
readonly commit: Oid;
|
|
252
252
|
readonly parents: readonly Oid[];
|
|
253
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* How a change moves the repo's object rows, the objects it keeps as rows in the `objects`
|
|
256
|
+
* collection and not in a pack: how many it puts less how many it deletes, and their values' bytes
|
|
257
|
+
* as UTF-8 JSON, as the store counts them, the same way. A storage that keeps no rows gives zeros.
|
|
258
|
+
* A put counts as new: the core takes out each row the repo holds already at the commit's version,
|
|
259
|
+
* which the put only writes again. The core keeps a tally of the rows that `RepoStats.ownBytes`
|
|
260
|
+
* counts, so a quota sees them (#2237): it's required, since one left out would hide them from the
|
|
261
|
+
* quota.
|
|
262
|
+
*/
|
|
263
|
+
export interface RowsMoved {
|
|
264
|
+
readonly objects: number;
|
|
265
|
+
readonly bytes: number;
|
|
266
|
+
}
|
|
254
267
|
export interface ObjectsChange {
|
|
255
268
|
readonly add?: readonly Pack[];
|
|
256
269
|
readonly remove?: readonly string[];
|
|
257
270
|
readonly put?: readonly Row[];
|
|
258
271
|
readonly delete?: readonly Key[];
|
|
272
|
+
/** The object rows the change puts and deletes, as `RowsMoved` says. */
|
|
273
|
+
readonly rows: RowsMoved;
|
|
259
274
|
}
|
|
260
275
|
/**
|
|
261
276
|
* The bytes of a server's memory budget one call takes, which it grows as it needs more and
|
|
@@ -540,9 +555,10 @@ export interface ObjectsStep {
|
|
|
540
555
|
*/
|
|
541
556
|
readonly yielded?: true;
|
|
542
557
|
/**
|
|
543
|
-
* When the `repack` row is next due, from a step of the prune pass
|
|
544
|
-
* core saves `git.repack`'s `repack` row for then, in that step's commit, as `prune`
|
|
545
|
-
* pass's. A `repack` run that yielded to the merge left its own row's work for this
|
|
558
|
+
* When the `repack` row is next due, from a step of the prune pass that ends a merge or unlists
|
|
559
|
+
* packs: the core saves `git.repack`'s `repack` row for then, in that step's commit, as `prune`
|
|
560
|
+
* saves the pass's. A `repack` run that yielded to the merge left its own row's work for this
|
|
561
|
+
* one, and clean-up deletes an unlisted pack's bytes once its `leaving` row is due.
|
|
546
562
|
*/
|
|
547
563
|
readonly repack?: Moment;
|
|
548
564
|
/**
|
|
@@ -551,6 +567,14 @@ export interface ObjectsStep {
|
|
|
551
567
|
* row that every `repack` run yields to.
|
|
552
568
|
*/
|
|
553
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;
|
|
554
578
|
}
|
|
555
579
|
/** Infra's bucket, as the Effect service the objects call. */
|
|
556
580
|
type Bucket$1 = Bucket.Bucket['Service'];
|
|
@@ -610,6 +634,11 @@ export interface VisibleInput extends CallInput {
|
|
|
610
634
|
readonly tips: readonly Oid[];
|
|
611
635
|
/** The repo's `index` row's value, from the read the tips came from, so the set reads one version. */
|
|
612
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>;
|
|
613
642
|
}
|
|
614
643
|
/**
|
|
615
644
|
* What one caller may read of a repo: the objects its refs reach, as `IndexedObjects.visible`
|
|
@@ -778,6 +807,11 @@ export interface IndexReachInput extends CallInput {
|
|
|
778
807
|
readonly row?: unknown;
|
|
779
808
|
readonly tips: readonly Oid[];
|
|
780
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;
|
|
781
815
|
}
|
|
782
816
|
/**
|
|
783
817
|
* A repo's index as its `index` row says at a moment, one state at a time, so a host's `switch` on
|
|
@@ -883,4 +917,4 @@ export type IndexTry = {
|
|
|
883
917
|
} | {
|
|
884
918
|
readonly kind: 'moved';
|
|
885
919
|
};
|
|
886
|
-
export { Bucket$1 as Bucket, type Bytes, type
|
|
920
|
+
export { Bucket$1 as Bucket, type Bytes, type Filter, type LfsPointers, type ObjectType, type ReadLimits };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
1
2
|
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as Predicate from "effect/Predicate";
|
|
4
|
+
import * as Stream from "effect/Stream";
|
|
2
5
|
// src/contracts/opaque.ts
|
|
3
6
|
/**
|
|
4
7
|
* The Web's values a contract carries as themselves, never as JSON: each is held as the very
|
|
@@ -6,4 +9,19 @@ import * as Schema from "effect/Schema";
|
|
|
6
9
|
*/
|
|
7
10
|
const AbortSignalValue = /* @__PURE__ */ Schema.declare((input) => input instanceof AbortSignal);
|
|
8
11
|
const RequestValue = /* @__PURE__ */ Schema.declare((input) => input instanceof Request);
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* A host's function, held as itself: `F` is what its contract types it as, which nothing checks
|
|
14
|
+
* past its being a function, and a JSON codec refuses it.
|
|
15
|
+
*/
|
|
16
|
+
const FunctionValue = () => Schema.declare((input) => Predicate.isFunction(input));
|
|
17
|
+
/**
|
|
18
|
+
* A host's Effect, held as itself: `A` and `E` are what its contract types it as, which nothing
|
|
19
|
+
* checks past its being an Effect, and a JSON codec refuses it.
|
|
20
|
+
*/
|
|
21
|
+
const EffectValue = () => Schema.declare((input) => Effect.isEffect(input));
|
|
22
|
+
/**
|
|
23
|
+
* A Stream, held as itself: `A` and `E` are what its contract types it as, which nothing checks
|
|
24
|
+
* past its being a Stream, and a JSON codec refuses it.
|
|
25
|
+
*/
|
|
26
|
+
const StreamValue = () => Schema.declare((input) => Stream.isStream(input));
|
|
27
|
+
export { AbortSignalValue, EffectValue, FunctionValue, RequestValue, StreamValue };
|
|
@@ -84,6 +84,7 @@ export declare const TokenCreateOperation: Schema.Union<readonly [Schema.Struct<
|
|
|
84
84
|
readonly id: Schema.String;
|
|
85
85
|
}>>;
|
|
86
86
|
readonly kind: Schema.Literal<"token.create">;
|
|
87
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
87
88
|
}>, Schema.Struct<{
|
|
88
89
|
readonly prefix: Schema.String;
|
|
89
90
|
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
@@ -94,6 +95,7 @@ export declare const TokenCreateOperation: Schema.Union<readonly [Schema.Struct<
|
|
|
94
95
|
readonly id: Schema.String;
|
|
95
96
|
}>>;
|
|
96
97
|
readonly kind: Schema.Literal<"token.create">;
|
|
98
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
97
99
|
}>]>;
|
|
98
100
|
export type TokenCreateOperation = typeof TokenCreateOperation.Type;
|
|
99
101
|
export declare const TokenOperation: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
@@ -106,6 +108,7 @@ export declare const TokenOperation: Schema.Union<readonly [Schema.Union<readonl
|
|
|
106
108
|
readonly id: Schema.String;
|
|
107
109
|
}>>;
|
|
108
110
|
readonly kind: Schema.Literal<"token.create">;
|
|
111
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
109
112
|
}>, Schema.Struct<{
|
|
110
113
|
readonly prefix: Schema.String;
|
|
111
114
|
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
@@ -116,6 +119,7 @@ export declare const TokenOperation: Schema.Union<readonly [Schema.Union<readonl
|
|
|
116
119
|
readonly id: Schema.String;
|
|
117
120
|
}>>;
|
|
118
121
|
readonly kind: Schema.Literal<"token.create">;
|
|
122
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
119
123
|
}>]>, Schema.Union<readonly [Schema.Struct<{
|
|
120
124
|
readonly repo: Schema.String;
|
|
121
125
|
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
@@ -191,7 +195,8 @@ export type TopicOperation = typeof TopicOperation.Type;
|
|
|
191
195
|
* every pattern `privateRefs` was given, as written. Accept with `{ read, publish }`, each a list
|
|
192
196
|
* of those patterns: `read` the patterns whose refs the caller sees, `publish` those whose commits
|
|
193
197
|
* the caller may make reachable from a ref more people see. An answer with neither, `accept()`
|
|
194
|
-
* with no value, or a refusal, sees no private ref and publishes nothing.
|
|
198
|
+
* with no value, or a refusal, sees no private ref and publishes nothing. An import asks it once
|
|
199
|
+
* more before it makes the repo, with no `AuthorizeInput.repo`, as `repo.create` asks.
|
|
195
200
|
*/
|
|
196
201
|
export declare const RefsPrivateOperation: Schema.Struct<{
|
|
197
202
|
readonly kind: Schema.Literal<"refs.private">;
|
|
@@ -255,6 +260,7 @@ export declare const Operation: Schema.Union<readonly [Schema.Struct<{
|
|
|
255
260
|
readonly id: Schema.String;
|
|
256
261
|
}>>;
|
|
257
262
|
readonly kind: Schema.Literal<"token.create">;
|
|
263
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
258
264
|
}>, Schema.Struct<{
|
|
259
265
|
readonly prefix: Schema.String;
|
|
260
266
|
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
@@ -265,6 +271,7 @@ export declare const Operation: Schema.Union<readonly [Schema.Struct<{
|
|
|
265
271
|
readonly id: Schema.String;
|
|
266
272
|
}>>;
|
|
267
273
|
readonly kind: Schema.Literal<"token.create">;
|
|
274
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
268
275
|
}>]>, Schema.Union<readonly [Schema.Struct<{
|
|
269
276
|
readonly repo: Schema.String;
|
|
270
277
|
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { RefName, RepoName, TopicId } from "./ids.mjs";
|
|
2
|
+
import { CandidateId, EntryFields, EntryId, HoldId } from "./queue.mjs";
|
|
3
|
+
import { RefEdit, RefSource } from "./refs.mjs";
|
|
4
|
+
import { ActorId } from "./actors.mjs";
|
|
5
|
+
import { TokenCoverage, TokenScope } from "./tokens.mjs";
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import { JobRef } from "@ref0/infra";
|
|
8
|
+
// src/contracts/operations.ts
|
|
9
|
+
/** What `authorize` is asked about. */
|
|
10
|
+
const RepoOperation = /* @__PURE__ */ Schema.Struct({
|
|
11
|
+
kind: Schema.Literals([
|
|
12
|
+
"fetch",
|
|
13
|
+
"read",
|
|
14
|
+
"object.create",
|
|
15
|
+
"repo.create",
|
|
16
|
+
"repo.update",
|
|
17
|
+
"repo.delete"
|
|
18
|
+
]),
|
|
19
|
+
repo: RepoName
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Anything that moves a ref. At advertisement, `updates` is empty. Each edit has no kind yet:
|
|
23
|
+
* whether a move is a fast-forward needs the pack, received after. The rules get the kind.
|
|
24
|
+
*/
|
|
25
|
+
const PushOperation = /* @__PURE__ */ Schema.Struct({
|
|
26
|
+
kind: Schema.Literal("push"),
|
|
27
|
+
repo: RepoName,
|
|
28
|
+
updates: Schema.Array(RefEdit)
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* A push with `-o allow-files` that adds or changes `paths` on `ref`, each a file a `Rules.files`
|
|
32
|
+
* rule there refuses: accepted, it lets them through, and the ref's `ref.updated` records them.
|
|
33
|
+
* At most 100 paths, the first refused first.
|
|
34
|
+
*/
|
|
35
|
+
const FilesAllowOperation = /* @__PURE__ */ Schema.Struct({
|
|
36
|
+
kind: Schema.Literal("files.allow"),
|
|
37
|
+
repo: RepoName,
|
|
38
|
+
ref: RefName,
|
|
39
|
+
paths: Schema.Array(Schema.String)
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* A change to `ref` that a `Rules.protect` rule (`protect.bypass`) or a `Rules.lock` rule
|
|
43
|
+
* (`lock.bypass`) there refuses, asked only once the rule would refuse it: accepted, it lifts that
|
|
44
|
+
* rule for this change, and the ref's `ref.updated` records the rule in `bypassed`. `move` is what
|
|
45
|
+
* the rule refuses, never a create, and `source` how the change came, which a rule's `sources`
|
|
46
|
+
* turn on. Git's own `authorize` and the starter's refuse it, for everyone.
|
|
47
|
+
*/
|
|
48
|
+
const BypassOperation = /* @__PURE__ */ Schema.Struct({
|
|
49
|
+
kind: Schema.Literals(["protect.bypass", "lock.bypass"]),
|
|
50
|
+
repo: RepoName,
|
|
51
|
+
ref: RefName,
|
|
52
|
+
move: Schema.Literals([
|
|
53
|
+
"fast-forward",
|
|
54
|
+
"force",
|
|
55
|
+
"delete"
|
|
56
|
+
]),
|
|
57
|
+
source: RefSource
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* A list of repos under `prefix`. An anonymous caller asks it for the public repos alone, which
|
|
61
|
+
* are all its list reads, so accepting it shows no private name.
|
|
62
|
+
*/
|
|
63
|
+
const RepoListOperation = /* @__PURE__ */ Schema.Struct({
|
|
64
|
+
kind: Schema.Literal("repo.list"),
|
|
65
|
+
prefix: Schema.optionalKey(Schema.String)
|
|
66
|
+
});
|
|
67
|
+
const ForkOperation = /* @__PURE__ */ Schema.Struct({
|
|
68
|
+
kind: Schema.Literals(["fork.create", "fork.sync"]),
|
|
69
|
+
repo: RepoName,
|
|
70
|
+
holder: Schema.String
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* A new token's parties: `subject`, whom it's for and its caller once it's used, and `actor`, who
|
|
74
|
+
* acts for them, named only when it's someone else.
|
|
75
|
+
*/
|
|
76
|
+
const TokenParties = /* @__PURE__ */ Schema.Struct({
|
|
77
|
+
subject: ActorId,
|
|
78
|
+
actor: Schema.optionalKey(ActorId)
|
|
79
|
+
});
|
|
80
|
+
/** `TokenCoverage`'s members, one repo or a prefix, which each token operation is over. */
|
|
81
|
+
const [overRepo, overPrefix] = TokenCoverage.members;
|
|
82
|
+
/** A create names the new token's parties and its `scope`, so a host decides who may mint an `admin` token. */
|
|
83
|
+
const tokenCreate = {
|
|
84
|
+
kind: Schema.Literal("token.create"),
|
|
85
|
+
...TokenParties.fields,
|
|
86
|
+
scope: TokenScope
|
|
87
|
+
};
|
|
88
|
+
const TokenCreateOperation = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
89
|
+
...tokenCreate,
|
|
90
|
+
...overRepo.fields
|
|
91
|
+
}), Schema.Struct({
|
|
92
|
+
...tokenCreate,
|
|
93
|
+
...overPrefix.fields
|
|
94
|
+
})]);
|
|
95
|
+
/**
|
|
96
|
+
* A revoke of one token, by ID, asked of what it covers. `subject` is whom the token is for, read
|
|
97
|
+
* from its stored record before `authorize` is asked, never from the call: so a host may let a
|
|
98
|
+
* person revoke their own token where it lets no one list the tokens beside it.
|
|
99
|
+
*/
|
|
100
|
+
const tokenRevoke = {
|
|
101
|
+
kind: Schema.Literal("token.revoke"),
|
|
102
|
+
subject: ActorId
|
|
103
|
+
};
|
|
104
|
+
const TokenRevokeOperation = /* @__PURE__ */ Schema.Union([Schema.Struct({
|
|
105
|
+
...tokenRevoke,
|
|
106
|
+
...overRepo.fields
|
|
107
|
+
}), Schema.Struct({
|
|
108
|
+
...tokenRevoke,
|
|
109
|
+
...overPrefix.fields
|
|
110
|
+
})]);
|
|
111
|
+
const TokenOperation = /* @__PURE__ */ Schema.Union([
|
|
112
|
+
TokenCreateOperation,
|
|
113
|
+
TokenRevokeOperation,
|
|
114
|
+
Schema.Struct({
|
|
115
|
+
kind: Schema.Literal("token.list"),
|
|
116
|
+
...overRepo.fields
|
|
117
|
+
}),
|
|
118
|
+
Schema.Struct({
|
|
119
|
+
kind: Schema.Literal("token.list"),
|
|
120
|
+
...overPrefix.fields
|
|
121
|
+
})
|
|
122
|
+
]);
|
|
123
|
+
const QueueAddOperation = /* @__PURE__ */ Schema.Struct({
|
|
124
|
+
kind: Schema.Literal("queue.add"),
|
|
125
|
+
repo: RepoName,
|
|
126
|
+
entry: EntryFields
|
|
127
|
+
});
|
|
128
|
+
/** A hold on `target`, or on `entry` there, and a restart of `target`. */
|
|
129
|
+
const QueueTargetOperation = /* @__PURE__ */ Schema.Struct({
|
|
130
|
+
kind: Schema.Literals(["queue.hold", "queue.restart"]),
|
|
131
|
+
repo: RepoName,
|
|
132
|
+
target: RefName,
|
|
133
|
+
entry: Schema.optionalKey(EntryId)
|
|
134
|
+
});
|
|
135
|
+
const QueueEntryOperation = /* @__PURE__ */ Schema.Struct({
|
|
136
|
+
kind: Schema.Literal("queue.remove"),
|
|
137
|
+
repo: RepoName,
|
|
138
|
+
entry: EntryId
|
|
139
|
+
});
|
|
140
|
+
const QueueCandidateOperation = /* @__PURE__ */ Schema.Struct({
|
|
141
|
+
kind: Schema.Literals(["queue.report", "queue.retry"]),
|
|
142
|
+
repo: RepoName,
|
|
143
|
+
candidate: CandidateId
|
|
144
|
+
});
|
|
145
|
+
const QueueReleaseOperation = /* @__PURE__ */ Schema.Struct({
|
|
146
|
+
kind: Schema.Literal("queue.release"),
|
|
147
|
+
repo: RepoName,
|
|
148
|
+
hold: HoldId
|
|
149
|
+
});
|
|
150
|
+
/** A topic's add, removal, report or read; `topic` is left out for an add and a list. */
|
|
151
|
+
const TopicOperation = /* @__PURE__ */ Schema.Struct({
|
|
152
|
+
kind: Schema.Literals([
|
|
153
|
+
"topic.add",
|
|
154
|
+
"topic.remove",
|
|
155
|
+
"topic.report",
|
|
156
|
+
"topic.read"
|
|
157
|
+
]),
|
|
158
|
+
topic: Schema.optionalKey(TopicId)
|
|
159
|
+
});
|
|
160
|
+
/**
|
|
161
|
+
* Which of a repo's private ref patterns the caller reads and publishes, asked once per caller and
|
|
162
|
+
* repo in a request, never once per ref, when the server was made with `access`. `patterns` is
|
|
163
|
+
* every pattern `privateRefs` was given, as written. Accept with `{ read, publish }`, each a list
|
|
164
|
+
* of those patterns: `read` the patterns whose refs the caller sees, `publish` those whose commits
|
|
165
|
+
* the caller may make reachable from a ref more people see. An answer with neither, `accept()`
|
|
166
|
+
* with no value, or a refusal, sees no private ref and publishes nothing. An import asks it once
|
|
167
|
+
* more before it makes the repo, with no `AuthorizeInput.repo`, as `repo.create` asks.
|
|
168
|
+
*/
|
|
169
|
+
const RefsPrivateOperation = /* @__PURE__ */ Schema.Struct({
|
|
170
|
+
kind: Schema.Literal("refs.private"),
|
|
171
|
+
repo: RepoName,
|
|
172
|
+
patterns: Schema.Array(RefName)
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* `GET <base>/me`: who the caller is, asked with the caller alone before Git shows them their own
|
|
176
|
+
* IDs. A host refuses it to a credential it no longer honours, such as a token whose person has
|
|
177
|
+
* left the org it's over, so a refused token learns nothing at `/me` either.
|
|
178
|
+
*/
|
|
179
|
+
const MeOperation = /* @__PURE__ */ Schema.Struct({ kind: Schema.Literal("me") });
|
|
180
|
+
/** A repo's work, or one job of it: `name` and `key` its `JobRef`'s, each left out to mean any. */
|
|
181
|
+
const WorkOperation = /* @__PURE__ */ Schema.Struct({
|
|
182
|
+
kind: Schema.Literals([
|
|
183
|
+
"work.list",
|
|
184
|
+
"work.retry",
|
|
185
|
+
"work.discard"
|
|
186
|
+
]),
|
|
187
|
+
repo: RepoName,
|
|
188
|
+
name: Schema.optionalKey(JobRef.fields.name),
|
|
189
|
+
key: Schema.optionalKey(JobRef.fields.key)
|
|
190
|
+
});
|
|
191
|
+
const Operation = /* @__PURE__ */ Schema.Union([
|
|
192
|
+
RepoOperation,
|
|
193
|
+
PushOperation,
|
|
194
|
+
FilesAllowOperation,
|
|
195
|
+
BypassOperation,
|
|
196
|
+
RepoListOperation,
|
|
197
|
+
ForkOperation,
|
|
198
|
+
TokenOperation,
|
|
199
|
+
QueueAddOperation,
|
|
200
|
+
QueueTargetOperation,
|
|
201
|
+
QueueEntryOperation,
|
|
202
|
+
QueueCandidateOperation,
|
|
203
|
+
QueueReleaseOperation,
|
|
204
|
+
TopicOperation,
|
|
205
|
+
WorkOperation,
|
|
206
|
+
RefsPrivateOperation,
|
|
207
|
+
MeOperation
|
|
208
|
+
]);
|
|
209
|
+
export { BypassOperation, FilesAllowOperation, ForkOperation, MeOperation, Operation, PushOperation, QueueAddOperation, QueueCandidateOperation, QueueEntryOperation, QueueReleaseOperation, QueueTargetOperation, RefsPrivateOperation, RepoListOperation, RepoOperation, TokenCreateOperation, TokenOperation, TokenParties, TokenRevokeOperation, TopicOperation, WorkOperation };
|
|
@@ -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"]>;
|
|
@@ -361,7 +362,7 @@ export declare const LanesInput: Schema.Struct<{
|
|
|
361
362
|
readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
362
363
|
}>;
|
|
363
364
|
readonly signal: Schema.declare<AbortSignal, AbortSignal>;
|
|
364
|
-
readonly changes: Schema.declare<() => Promise<readonly TreeChange[]>,
|
|
365
|
+
readonly changes: Schema.declare<() => Promise<readonly TreeChange[]>, () => Promise<readonly TreeChange[]>>;
|
|
365
366
|
}>;
|
|
366
367
|
export type LanesInput = typeof LanesInput.Type;
|
|
367
368
|
/**
|
|
@@ -399,7 +400,7 @@ export interface ReportOptions {
|
|
|
399
400
|
/**
|
|
400
401
|
* The host's queue. Each function is pure but `join` and `lanes`, whose I/O gets a signal, aborted
|
|
401
402
|
* after 30 seconds. A throw in `merge` or `lanes` fails the entry `host-error`; one in `bisect` or
|
|
402
|
-
* a schedule function takes the default. Either
|
|
403
|
+
* a schedule function takes the default. Either is logged at `Error`, as `queue.merge` and the rest.
|
|
403
404
|
*/
|
|
404
405
|
export interface MergeQueueOptions {
|
|
405
406
|
/**
|
|
@@ -419,7 +420,7 @@ export interface MergeQueueOptions {
|
|
|
419
420
|
* It's asked by each add that finds no entry for its key. Adds of one key that race may each ask
|
|
420
421
|
* it, and only the add whose write lands keeps its answer, so it must be safe to ask twice for
|
|
421
422
|
* one key: a read, with no side effect counted per call. A losing add whose `lanes` throws
|
|
422
|
-
* answers the error,
|
|
423
|
+
* answers the error, logged as `queue.lanes`'s; its redelivery answers the repeat, with
|
|
423
424
|
* the stored entry and the winner's lanes (Q524).
|
|
424
425
|
* Within a lane, candidates stack and merge in order; across lanes, they check and merge apart,
|
|
425
426
|
* and an entry in several waits on each. With candidates open in its lanes, an entry stacks only
|
package/dist/contracts/queue.mjs
CHANGED
|
@@ -2,12 +2,11 @@ import { Actor, ActorId } from "./actors.mjs";
|
|
|
2
2
|
import { CommitMessage } from "./commits.mjs";
|
|
3
3
|
import { Commit } from "./engine.mjs";
|
|
4
4
|
import { Oid, RefName, RepoName } from "./ids.mjs";
|
|
5
|
-
import { AbortSignalValue } from "./opaque.mjs";
|
|
6
|
-
import {
|
|
5
|
+
import { AbortSignalValue, FunctionValue } from "./opaque.mjs";
|
|
6
|
+
import { Verdict, decisionAnswer } from "./result.mjs";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Schema from "effect/Schema";
|
|
9
9
|
import { jsonBytes } from "@ref0/infra";
|
|
10
|
-
import * as Predicate from "effect/Predicate";
|
|
11
10
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
12
11
|
import * as Context from "effect/Context";
|
|
13
12
|
// src/contracts/queue.ts
|
|
@@ -49,7 +48,8 @@ const CandidateState = /* @__PURE__ */ Schema.Literals([
|
|
|
49
48
|
* `conflict`: it didn't merge onto the target; `reported`: a report blamed it; `host-error`: the
|
|
50
49
|
* host's `merge` or `lanes` threw; `interaction`: it passed alone and failed together twice;
|
|
51
50
|
* `refused`: a push rule, a hook group or `authorize` refused its publication; `tooManyCommits`: it
|
|
52
|
-
* 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.
|
|
53
53
|
*/
|
|
54
54
|
const EntryFailureReason = /* @__PURE__ */ Schema.Literals([
|
|
55
55
|
"conflict",
|
|
@@ -57,7 +57,8 @@ const EntryFailureReason = /* @__PURE__ */ Schema.Literals([
|
|
|
57
57
|
"host-error",
|
|
58
58
|
"interaction",
|
|
59
59
|
"refused",
|
|
60
|
-
"tooManyCommits"
|
|
60
|
+
"tooManyCommits",
|
|
61
|
+
"tooLarge"
|
|
61
62
|
]);
|
|
62
63
|
/** `passed`: a bisect group's pass, which judges its entries and merges none (Q489). */
|
|
63
64
|
const CandidateCloseReason = /* @__PURE__ */ Schema.Literals([
|
|
@@ -157,20 +158,8 @@ const MergePlan = /* @__PURE__ */ Schema.Struct({
|
|
|
157
158
|
...CommitMessage.fields,
|
|
158
159
|
method: MergeMethod
|
|
159
160
|
}).annotate({ identifier: "MergePlan" });
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
kind: Schema.Literal("accept"),
|
|
163
|
-
value: Schema.optional(Schema.Undefined)
|
|
164
|
-
});
|
|
165
|
-
const JoinRejected = /* @__PURE__ */ Schema.Struct({
|
|
166
|
-
kind: Schema.Literal("reject"),
|
|
167
|
-
code: Schema.optional(JoinErrorCode),
|
|
168
|
-
message: Schema.String,
|
|
169
|
-
hint: Schema.optional(Schema.String),
|
|
170
|
-
context: Schema.optional(ErrorContext)
|
|
171
|
-
});
|
|
172
|
-
/** What the host's `join` answers: `accept()` or `reject(...)`, matching `DecisionAnswer`. */
|
|
173
|
-
const JoinAnswer = /* @__PURE__ */ Schema.Union([JoinAccepted, JoinRejected]).annotate({ identifier: "JoinAnswer" });
|
|
161
|
+
/** What the host's `join` answers: `accept()` or `reject(...)`, read as `DecisionAnswer`. */
|
|
162
|
+
const JoinAnswer = /* @__PURE__ */ decisionAnswer(Schema.Undefined).annotate({ identifier: "JoinAnswer" });
|
|
174
163
|
/** A lane's name: well-formed UTF-8, 1 to `queueLaneBytesMost` bytes counted as UTF-8 JSON, quotes aside. */
|
|
175
164
|
const LaneName = /* @__PURE__ */ Schema.String.check(Schema.makeFilter((lane) => {
|
|
176
165
|
if (loneSurrogate.test(lane)) return "lanes named a lane UTF-8 can't hold";
|
|
@@ -201,7 +190,7 @@ const JoinInput = /* @__PURE__ */ Schema.Struct({
|
|
|
201
190
|
entry: EntryFields,
|
|
202
191
|
signal: AbortSignalValue
|
|
203
192
|
});
|
|
204
|
-
({ ...JoinInput.fields }),
|
|
193
|
+
({ ...JoinInput.fields }), FunctionValue();
|
|
205
194
|
/** One bisect group: at least one entry, none named twice. */
|
|
206
195
|
const EntryGroup = /* @__PURE__ */ Schema.Array(EntryId).check(Schema.isMinLength(1), Schema.makeFilter((group) => new Set(group).size === group.length || "a bisect group names no entry twice"));
|
|
207
196
|
/**
|