Lines 13–20 at 180 (were 13–18 at 179)
1313import { EngineProject, SqliteLog } from "./engine-project.ts"; 1414import { artifactsOf, type Env } from "./env.ts"; 1515import { GitDiskIntake } from "./git-disk-intake.ts"; 16+import { GitFileContents } from "./git-file-contents.ts"; 17+import { GitIntakeLimitError } from "./git-intake-limit.ts"; 1618import { GitIntakeTrees } from "./git-intake-trees.ts"; 1719import { pushedSince, remoteHead } from "./ingest.ts"; Lines 67–73 at 180 (were 65–70 at 179)
6567const GIT_PACK_MAX_BYTES = 128 * 1024 * 1024; 6668const GIT_OBJECT_MAX_BYTES = 64 * 1024 * 1024; 6769const GIT_DECODED_MAX_BYTES = 256 * 1024 * 1024; 70+const GIT_LIMIT_POLICY = `expanded-v2:${GIT_PACK_MAX_BYTES}:${GIT_OBJECT_MAX_BYTES}:${GIT_DECODED_MAX_BYTES}`; 7073 * The load guard (platform issue 46): an estimate of a loaded project's memory from its log entries, lines and claim Lines 130–136 at 180 (were 127–132 at 179)
127130 this.blobs = new BlobStore(ctx.storage); 128131 if (env.ABSO_DISK_FIRST === "on") { 129132 GitDiskIntake.recover(ctx.storage); 133+ GitFileContents.recover(ctx.storage); 130134 GitIntakeTrees.recover(ctx.storage); Lines 545–566 at 180 (were 541–546 at 179)
541545 const seen = await this.ctx.storage.get<string>("git:head"); 542546 const pushed = await this.ctx.storage.get<PushResult>("pushed"); 543547 const head = await remoteHead(artifacts, name); 548+ const refusal = this.diskRuntime() 549+ ? await this.ctx.storage.get<{ head: string; policy: string; kind: GitIntakeLimitError["kind"]; error: string }>( 557+ head !== pushed?.commit && 558+ refusal.head === head && 559+ refusal.policy === GIT_LIMIT_POLICY 561+ throw new GitIntakeLimitError(refusal.kind, refusal.error); 562+ await this.ctx.storage.delete("git:size-refusal"); 544564 if (!head || head === seen || head === pushed?.commit) return null; 545565 const sharedBlobs = this.useProject((p) => p.shared().blobs ?? {}); 546566 using trees = this.diskRuntime() ? new GitIntakeTrees(this.ctx.storage) : undefined; Lines 580–598 at 180 (were 560–566 at 179)
560580 retainFileChunks: (files, path, chunks, oid) => trees.retainChunks(files, path, chunks, oid), 563− );
583+ ).catch(async (error: unknown) => { 584+ if (trees && error instanceof GitIntakeLimitError) { 587+ policy: GIT_LIMIT_POLICY, 589+ error: error.message, 590+ at: new Date().toISOString(), 592+ await this.ctx.storage.put({ "git:size-refusal": refusal, "git:error": refusal }); 564596 if (!found || found.commits.length === 0) { 565597 if (found) await this.ctx.storage.put("git:head", found.head); Lines 651–675 at 180 (were 619–632 at 179)
619651 if (!artifacts) return; 620652 const name = await this.ctx.storage.get<string>("name"); 621653 if (!name || !this.useProject((p) => p.exists())) return; 654+ let intakeFailed = false; 622655 await this.gitSync().then( 623− () => this.ctx.storage.delete("git:error"),
624− (e) =>
625− this.ctx.storage.put("git:error", {
657+ await this.ctx.storage.delete("git:error"); 658+ await this.ctx.storage.delete("git:retry-attempts"); 661+ intakeFailed = true; 662+ const attempts = ((await this.ctx.storage.get<number>("git:retry-attempts")) ?? 0) + 1; 663+ await this.ctx.storage.put("git:retry-attempts", attempts); 664+ await this.ctx.storage.put("git:error", { 626665 at: new Date().toISOString(), 627666 error: e instanceof Error ? e.message : String(e), 628− }),
668+ await this.soon(Date.now() + (attempts === 1 ? 1 : attempts === 2 ? 5 : 15) * 60_000); 671+ // Never export over a remote head whose changes could not be taken in. 672+ if (intakeFailed) return; 630673 const shared = pushSnapshot( 631674 this.useProject((p) => p.sharedPushMetadata()), 632675 (version, path) => this.useProject((current) => current.fileTextAt(version, path)), Lines 684–703 at 180 (were 641–647 at 179)
642685 let result: PushResult; 644− result = await pushShared(artifacts, name, shared, (sha) => this.blobs.read(sha));
687+ result = await pushShared( 691+ (sha) => this.blobs.read(sha), 692+ this.env.ABSO_DISK_FIRST === "on" 694+ storage: this.ctx.storage, 695+ maxPackBytes: GIT_PACK_MAX_BYTES, 696+ maxObjectBytes: GIT_OBJECT_MAX_BYTES, 697+ maxDecodedBytes: GIT_DECODED_MAX_BYTES, 646702 // Kept for /out, and tried again with a backoff of our own (a thrown alarm is retried only six times). 647703 const was = await this.ctx.storage.get<{ attempts?: number }>("pushError");