@ref0/git 0.8.0 → 0.10.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.
Files changed (102) hide show
  1. package/dist/contracts/calls-spent.d.mts +2 -12
  2. package/dist/contracts/calls-spent.mjs +4 -5
  3. package/dist/contracts/commits.d.mts +14 -2
  4. package/dist/contracts/commits.mjs +22 -3
  5. package/dist/contracts/events.d.mts +70 -4
  6. package/dist/contracts/events.mjs +27 -3
  7. package/dist/contracts/git.d.mts +13 -3
  8. package/dist/contracts/objects.d.mts +18 -0
  9. package/dist/contracts/queue.d.mts +3 -2
  10. package/dist/contracts/queue.mjs +4 -2
  11. package/dist/contracts/refs.mjs +3 -1
  12. package/dist/core/ancestry.mjs +5 -4
  13. package/dist/core/events/seen.mjs +5 -4
  14. package/dist/core/index-job.mjs +23 -1
  15. package/dist/core/index-lost.d.mts +11 -0
  16. package/dist/core/index-lost.mjs +55 -0
  17. package/dist/core/job-view.mjs +20 -0
  18. package/dist/core/objects/commit-writes.mjs +1 -1
  19. package/dist/core/objects/commits.mjs +10 -9
  20. package/dist/core/objects/merges.mjs +1 -1
  21. package/dist/core/objects/reading.mjs +28 -13
  22. package/dist/core/objects/trees.mjs +1 -1
  23. package/dist/core/parts.d.mts +7 -0
  24. package/dist/core/publish.mjs +9 -5
  25. package/dist/core/purge.mjs +16 -3
  26. package/dist/core/push.mjs +27 -11
  27. package/dist/core/ref-view.mjs +1 -25
  28. package/dist/core/repack.mjs +36 -14
  29. package/dist/core/view.d.mts +10 -1
  30. package/dist/core/view.mjs +15 -6
  31. package/dist/core/work.mjs +47 -4
  32. package/dist/effect.d.mts +2 -3
  33. package/dist/effect.mjs +2 -3
  34. package/dist/engine/commits.mjs +4 -3
  35. package/dist/engine/merge-bases.mjs +5 -3
  36. package/dist/engine/merge.mjs +4 -3
  37. package/dist/engine/parts.d.mts +1 -0
  38. package/dist/engine/parts.mjs +1 -1
  39. package/dist/engine/walk.mjs +62 -20
  40. package/dist/http/core-parts.mjs +17 -8
  41. package/dist/index.d.mts +4 -4
  42. package/dist/index.mjs +3 -3
  43. package/dist/lfs/objects.mjs +7 -4
  44. package/dist/lfs/upkeep.mjs +6 -5
  45. package/dist/lfs/upload-most.mjs +8 -2
  46. package/dist/protocol/bytes/streams.mjs +84 -2
  47. package/dist/protocol/diff/read.d.mts +1 -0
  48. package/dist/protocol/diff/read.mjs +5 -2
  49. package/dist/protocol/objects/commit.d.mts +7 -0
  50. package/dist/protocol/objects/commit.mjs +5 -1
  51. package/dist/queue/advance.mjs +39 -10
  52. package/dist/queue/host.d.mts +4 -0
  53. package/dist/queue/layer.mjs +4 -2
  54. package/dist/queue/limits.mjs +18 -2
  55. package/dist/queue/rows.mjs +2 -1
  56. package/dist/queue/trim.mjs +2 -2
  57. package/dist/rest/commits.d.mts +202 -198
  58. package/dist/rest/forks.d.mts +99 -99
  59. package/dist/rest/refs.d.mts +144 -144
  60. package/dist/rest/repos.d.mts +48 -48
  61. package/dist/rest/topics.d.mts +112 -112
  62. package/dist/rest/trees.d.mts +58 -58
  63. package/dist/rest/wire.d.mts +19 -1
  64. package/dist/rest/work.d.mts +39 -39
  65. package/dist/server/joined.d.mts +11 -5
  66. package/dist/server/joined.mjs +3 -2
  67. package/dist/server/registry.mjs +11 -5
  68. package/dist/server/server.mjs +16 -4
  69. package/dist/storage/index-bitmaps.mjs +16 -10
  70. package/dist/storage/index-build.mjs +61 -13
  71. package/dist/storage/index-graph.d.mts +1 -0
  72. package/dist/storage/index-graph.mjs +29 -5
  73. package/dist/storage/index-layers.d.mts +1 -0
  74. package/dist/storage/index-layers.mjs +5 -2
  75. package/dist/storage/index-reach.mjs +7 -5
  76. package/dist/storage/index-remap.mjs +5 -5
  77. package/dist/storage/index-visible.mjs +16 -5
  78. package/dist/storage/links.mjs +3 -3
  79. package/dist/storage/pack-order.d.mts +1 -0
  80. package/dist/storage/pack-order.mjs +18 -1
  81. package/dist/storage/prune-walk.mjs +5 -2
  82. package/dist/storage/prune.mjs +107 -37
  83. package/dist/storage/receive-bounds.mjs +3 -2
  84. package/dist/storage/visible.mjs +3 -2
  85. package/dist/storage/walk.d.mts +1 -0
  86. package/dist/storage/walk.mjs +9 -5
  87. package/dist/storage/wants.mjs +17 -11
  88. package/dist/store/call-count.d.mts +8 -0
  89. package/dist/store/call-count.mjs +15 -7
  90. package/dist/store/errors.d.mts +7 -1
  91. package/dist/store/errors.mjs +7 -1
  92. package/dist/store/job-try.mjs +3 -1
  93. package/dist/store/records.mjs +17 -2
  94. package/dist/store/repo-record.mjs +9 -2
  95. package/dist/store/scopes.mjs +10 -2
  96. package/dist/sync/bound.d.mts +1 -1
  97. package/dist/sync/import.mjs +1 -1
  98. package/dist/sync/layer.mjs +4 -7
  99. package/dist/sync/mirror.mjs +1 -1
  100. package/dist/topics/advance.mjs +4 -4
  101. package/dist/topics/layer.mjs +1 -1
  102. package/package.json +3 -3
@@ -1,14 +1,4 @@
1
- import { GitError } from "./result.mjs";
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. The
134
- * drop-in's import reads it too, outside Git, where `answerSpent` isn't exported: a spent
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);
@@ -11,7 +11,7 @@ import * as Schema from "effect/Schema";
11
11
  import { Listing } from "@ref0/infra";
12
12
  import * as Context from "effect/Context";
13
13
  declare namespace commits_d_exports {
14
- export { CommitCalls, CommitCreate, CommitCreateFields, CommitCreateInput, CommitDiff, CommitDiffInput, CommitMessage, CommitPick, CommitPickInput, CommitRevert, CommitRevertInput, Commits, CommitsMergeBase, CommitsMergeBaseInput, Compare, CompareInput, CompareRange, ComparisonFile, ComparisonFileFields, LineCounts, Log, LogInput, RefPublication, Revision, compare, create, diff, get, list, mergeBase, pick, revert };
14
+ export { CommitCalls, CommitCreate, CommitCreateFields, CommitCreateInput, CommitDiff, CommitDiffInput, CommitMessage, CommitPick, CommitPickInput, CommitRevert, CommitRevertInput, Commits, CommitsMergeBase, CommitsMergeBaseInput, Compare, CompareInput, CompareRange, ComparisonFile, ComparisonFileFields, LineCounts, Log, LogInput, RefPublication, Revision, compare, create, diff, get, list, logEmailsMost, mergeBase, pick, revert };
15
15
  }
16
16
  /**
17
17
  * A revision, as a call names a commit: a full object ID, a full ref name, `HEAD` for the
@@ -21,10 +21,22 @@ declare namespace commits_d_exports {
21
21
  */
22
22
  export declare const Revision: Schema.String;
23
23
  export type Revision = typeof Revision.Type;
24
- /** `git log <ref> [-- <path>]`: newest first; with `path`, only the commits that changed it. */
24
+ /** The most addresses a log's `authors` or `committers` names. */
25
+ export declare const logEmailsMost = 100;
26
+ /**
27
+ * `git log <ref> [-- <path>]`: newest first; with `path`, only the commits that changed it.
28
+ * `authors` and `committers` keep the commits whose author's or committer's email is one they
29
+ * name, compared without case. `since` and `until` keep the commits committed at or after and at
30
+ * or before them, as `git log --since` and `--until` do, and as with `--since` the walk follows no
31
+ * commit committed before `since`, so it stops along each line at the first older one.
32
+ */
25
33
  export declare const Log: Schema.Struct<{
26
34
  readonly ref: Schema.String;
27
35
  readonly path: Schema.optionalKey<Schema.String>;
36
+ readonly authors: Schema.optionalKey<Schema.$Array<Schema.String>>;
37
+ readonly committers: Schema.optionalKey<Schema.$Array<Schema.String>>;
38
+ readonly since: Schema.optionalKey<Schema.Number>;
39
+ readonly until: Schema.optionalKey<Schema.Number>;
28
40
  }>;
29
41
  export type Log = typeof Log.Type;
30
42
  export interface LogInput extends ReadPage, Log {}
@@ -1,6 +1,7 @@
1
1
  import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
2
  import { Commit, DiffListing, Listing, Page, Signature, TreeChangeFields } from "./engine.mjs";
3
3
  import { Oid, RefName } from "./ids.mjs";
4
+ import { Moment } from "./repos.mjs";
4
5
  import * as Effect from "effect/Effect";
5
6
  import * as Schema from "effect/Schema";
6
7
  import * as Context from "effect/Context";
@@ -26,6 +27,7 @@ var commits_exports = /* @__PURE__ */ __exportAll({
26
27
  diff: () => diff,
27
28
  get: () => get,
28
29
  list: () => list,
30
+ logEmailsMost: () => 100,
29
31
  mergeBase: () => mergeBase,
30
32
  pick: () => pick,
31
33
  revert: () => revert
@@ -37,10 +39,27 @@ var commits_exports = /* @__PURE__ */ __exportAll({
37
39
  * commit.
38
40
  */
39
41
  const Revision = Schema.String;
40
- /** `git log <ref> [-- <path>]`: newest first; with `path`, only the commits that changed it. */
42
+ /** The most addresses a log's `authors` or `committers` names. */
43
+ const logEmailsMost = 100;
44
+ /**
45
+ * A log's `authors` or `committers`: at least one address, since a query sends an empty list as
46
+ * none, and at most `logEmailsMost`.
47
+ */
48
+ const LogEmails = /* @__PURE__ */ Schema.Array(Schema.String).check(Schema.isMinLength(1, { message: "named no address: leave the field out instead" }), Schema.isMaxLength(100, { message: `named more than 100 addresses` }));
49
+ /**
50
+ * `git log <ref> [-- <path>]`: newest first; with `path`, only the commits that changed it.
51
+ * `authors` and `committers` keep the commits whose author's or committer's email is one they
52
+ * name, compared without case. `since` and `until` keep the commits committed at or after and at
53
+ * or before them, as `git log --since` and `--until` do, and as with `--since` the walk follows no
54
+ * commit committed before `since`, so it stops along each line at the first older one.
55
+ */
41
56
  const Log = /* @__PURE__ */ Schema.Struct({
42
57
  ref: Revision,
43
- path: Schema.optionalKey(Schema.String)
58
+ path: Schema.optionalKey(Schema.String),
59
+ authors: Schema.optionalKey(LogEmails),
60
+ committers: Schema.optionalKey(LogEmails),
61
+ since: Schema.optionalKey(Moment),
62
+ until: Schema.optionalKey(Moment)
44
63
  });
45
64
  const CommitsMergeBase = /* @__PURE__ */ Schema.Struct({ commits: Schema.Array(Revision) });
46
65
  /** `git diff <base> <head>`, as `diff-tree -r -M` lists it: renames unless `renames` is false. */
@@ -144,4 +163,4 @@ const compare = (repo, input, by) => Effect.flatMap(Effect.service(Commits), (ca
144
163
  const create = (repo, input, by) => Effect.flatMap(Effect.service(Commits), (calls) => calls.create(repo, input, by));
145
164
  const revert = (repo, input, by) => Effect.flatMap(Effect.service(Commits), (calls) => calls.revert(repo, input, by));
146
165
  const pick = (repo, input, by) => Effect.flatMap(Effect.service(Commits), (calls) => calls.pick(repo, input, by));
147
- export { CommitCreate, CommitDiff, CommitMessage, CommitPick, CommitRevert, Commits, CommitsMergeBase, Compare, CompareRange, ComparisonFile, ComparisonFileFields, LineCounts, Log, RefPublication, Revision, commits_exports, compare, create, diff, get, list, mergeBase, pick, revert };
166
+ export { CommitCreate, CommitDiff, CommitMessage, CommitPick, CommitRevert, Commits, CommitsMergeBase, Compare, CompareRange, ComparisonFile, ComparisonFileFields, LineCounts, Log, RefPublication, Revision, commits_exports, compare, create, diff, get, list, logEmailsMost, mergeBase, pick, revert };
@@ -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
- /** `repo.work.failed`: a job's last try failed, or a round of index builds was refused. */
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
- /** `repo.work.failed`: a job's last try failed, or a round of index builds was refused. */
271
- const RepoWorkFailed = /* @__PURE__ */ Schema.Union([RepoJobFailed, RepoIndexRefused]);
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 };
@@ -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, JobDefinition, Key, Moment, Read, Records, Row, WatchedRow } from "@ref0/infra";
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
- /** A job named `<registration name>.<job>`: infra's `JobDefinition`, as `JobQueue.register` takes. */
191
- readonly addJob: (definition: JobDefinition) => Effect.Effect<void>;
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"]>;
@@ -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([
@@ -58,6 +58,8 @@ const Ref = /* @__PURE__ */ Schema.Struct({
58
58
  name: RefName,
59
59
  oid: Oid
60
60
  }).annotate({ identifier: "Ref" });
61
+ /** The most names one `refs.sees` call takes: a page of 50 pulls, each with its two refs. */
62
+ const maxSeenRefs = 100;
61
63
  const RefsSees = /* @__PURE__ */ Schema.Struct({
62
64
  /** Full ref names, `maxSeenRefs` at most, which needn't exist. */
63
65
  refs: Schema.Array(RefName).annotate({ description: "Full ref names, 100 at most, which needn't exist" }) });
@@ -114,4 +116,4 @@ const sees = (repo, input, by) => Effect.flatMap(Effect.service(Refs), (refs) =>
114
116
  const list = (repo, input, by) => Effect.flatMap(Effect.service(Refs), (refs) => refs.list(repo, input, by));
115
117
  const count = (repo, input, by) => Effect.flatMap(Effect.service(Refs), (refs) => refs.count(repo, input, by));
116
118
  const update = (repo, input, by) => Effect.flatMap(Effect.service(Refs), (refs) => refs.update(repo, input, by));
117
- export { Ref, RefApplied, RefCount, RefCountFields, RefEdit, RefList, RefOutcome, RefProtection, RefSource, RefUpdate, RefUpdateKind, Refs, RefsProtections, RefsSees, RefsUpdate, count, get, list, protection, protections, refs_exports, sees, update };
119
+ export { Ref, RefApplied, RefCount, RefCountFields, RefEdit, RefList, RefOutcome, RefProtection, RefSource, RefUpdate, RefUpdateKind, Refs, RefsProtections, RefsSees, RefsUpdate, count, get, list, maxSeenRefs, protection, protections, refs_exports, sees, update };
@@ -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);
@@ -1,5 +1,5 @@
1
1
  import { shownEvent } from "../../store/outbox.mjs";
2
- import { seesJob } from "../ref-view.mjs";
2
+ import { seesJob } from "../job-view.mjs";
3
3
  // src/core/events/seen.ts
4
4
  /** Which of `RefPush`'s counts `ref` is in: a branch's, a tag's, or neither. */
5
5
  const countOf = (ref) => {
@@ -37,7 +37,8 @@ const pushCounts = (access, moved) => {
37
37
  };
38
38
  };
39
39
  /**
40
- * Whether a caller who isn't whole sees `event`: every ref it names, a job's by `seesJob`. A queue
40
+ * Whether a caller who isn't whole sees `event`: every ref it names, a job's by `seesJob`, and
41
+ * nothing of the repo's size, so no `repo.maintained` and no index round's refusal. A queue
41
42
  * event that names only an entry or a candidate is never seen, since only the event that added
42
43
  * the entry names its refs, and a candidate's ref is the queue's own (Q749). A topic's events are
43
44
  * in its own scope, never a repo's, and a caller sees none here.
@@ -48,11 +49,11 @@ const seesEvent = (refView, event) => {
48
49
  case "repo.deleted":
49
50
  case "repo.renamed":
50
51
  case "repo.visibility.changed":
51
- case "repo.maintained":
52
52
  case "token.created":
53
53
  case "token.revoked": return true;
54
54
  case "ref.updated": return refView.sees(event.ref);
55
- case "repo.work.failed": return event.refused !== void 0 || seesJob(refView, event);
55
+ case "repo.maintained": return refView.whole;
56
+ case "repo.work.failed": return "name" in event ? seesJob(refView, event) : refView.whole;
56
57
  case "queue.entry.added": return refView.sees(event.target) && refView.sees(event.source);
57
58
  case "queue.hold.created":
58
59
  case "queue.hold.released": return "target" in event && refView.sees(event.target);
@@ -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: [...appended.jobs, ...repack]
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 };
@@ -0,0 +1,20 @@
1
+ import { advanceName } from "../store/queue-jobs.mjs";
2
+ import { mirrorJobName } from "../store/records.mjs";
3
+ // src/core/job-view.ts
4
+ /**
5
+ * The job kinds in a repo's scope that a caller who doesn't see every ref may see, each keyed by
6
+ * the ref it's of: a mirror's ref, and an advance's target. Such a caller sees one only when it
7
+ * sees the ref. Deny by default: every other kind, and any kind added later that isn't here, is
8
+ * seen only by a caller who sees every ref (#2195). A candidate's build and timeout name its ref
9
+ * under `refs/queue/` (Q749), a trim its target or the ID it trimmed up to, and a job over the
10
+ * whole repo, its upkeep's, its index builds', its listing's or its import's, may say in its
11
+ * failure or progress how big the repo is, which a hidden push moves. A delivery's job,
12
+ * `git.deliver.<name>`, a hidden push alone saves.
13
+ */
14
+ const refKeyed = /* @__PURE__ */ new Set([mirrorJobName, advanceName]);
15
+ /**
16
+ * Whether a caller with `refView` sees `job`: `list`, `retry` and `discard` answer one it doesn't
17
+ * as a missing one, and the event stream leaves out its `repo.work.failed`.
18
+ */
19
+ const seesJob = (refView, job) => refView.whole || refKeyed.has(job.name) && refView.sees(job.key);
20
+ export { seesJob };
@@ -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
  });