mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-28 20:22:45 +00:00
* perf(app): optimize wrapped measurements and checkpoint native layout experiment Compute full grapheme geometry only for final wrap fragments. Preserve shaped-text search behavior while bounding additive wrap probes. Keep the Android background layout experiment isolated from the normal diff renderer; native renderer integration and iOS bindings remain unfinished. * perf(server): reduce cold diff generation work Keep active diff reads owned across invalidation and wait for the initial watcher inventory before cold generation. Batch patch and blob reads while preserving per-file size isolation, bounded output, and daemon responsiveness. Avoid constructing fallback tokens when full-file highlighting already covers both sides. * test(server): exercise oversized highlighted diff rejection The single-line fixture now bypasses highlighting under the long-line guard, so it no longer reaches the structured payload limit. Use short dense lines to keep testing oversized rejection and continued socket usability. * fix(server): queue fresh diffs for forced reads A forced request following a repository mutation must not reuse an older active build. Invalidate that result and coalesce waiting callers onto one subsequent build. Give the cache a named object input and completed-value type. * test(server): share deferred diff loader setup * test(server): name completed diff cache setup * refactor(server): use aliases for new diff imports * fix(server): keep shipped diff imports resolvable by Node The TypeScript build preserves path aliases without a runtime resolver. Restore relative imports for shipped code and declarations, and correct the server import guideline that prompted the regression.
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
import { execFileSync } from "node:child_process";
|
|
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { afterEach, beforeEach, expect, test } from "vitest";
|
|
import { readGitFileContents } from "@server/utils/git-file-contents.js";
|
|
import { runGitCommand, runGitCommandBytes } from "@server/utils/run-git-command.js";
|
|
|
|
let cwd: string;
|
|
beforeEach(() => {
|
|
cwd = mkdtempSync(join(tmpdir(), "git-contents-"));
|
|
execFileSync("git", ["init", "-q"], { cwd });
|
|
});
|
|
afterEach(() => rmSync(cwd, { recursive: true, force: true }));
|
|
|
|
test("batch byte framing survives Unicode, invalid UTF-8, and missing objects", async () => {
|
|
const text = Buffer.concat([Buffer.from("中文👩💻\n"), Buffer.from([0xff]), Buffer.from("\n")]);
|
|
const { stdout: oid } = await runGitCommand(["hash-object", "-w", "--stdin"], {
|
|
cwd,
|
|
input: text,
|
|
});
|
|
const ref = oid.trim();
|
|
const empty = execFileSync("git", ["hash-object", "-w", "--stdin"], { cwd, input: "" })
|
|
.toString()
|
|
.trim();
|
|
const contents = await readGitFileContents(cwd, [ref, "HEAD:missing", empty, ref]);
|
|
expect(contents).toEqual(
|
|
new Map([
|
|
[ref, text.toString("utf8")],
|
|
["HEAD:missing", null],
|
|
[empty, ""],
|
|
]),
|
|
);
|
|
const raw = await runGitCommandBytes(["cat-file", "blob", ref], { cwd });
|
|
expect(raw.stdout.equals(text)).toBe(true);
|
|
});
|
|
|
|
test("oversized output stays bounded and requests the existing per-file path", async () => {
|
|
writeFileSync(join(cwd, "big"), Buffer.alloc(20 * 1024 * 1024, 97));
|
|
const oid = execFileSync("git", ["hash-object", "-w", "big"], { cwd }).toString().trim();
|
|
expect(await readGitFileContents(cwd, [oid])).toBeNull();
|
|
const limited = await runGitCommandBytes(["cat-file", "--batch"], {
|
|
cwd,
|
|
input: oid + "\n",
|
|
maxOutputBytes: 100,
|
|
});
|
|
expect(limited.truncated).toBe(true);
|
|
expect(limited.stdout.length).toBe(100);
|
|
});
|
|
|
|
test("newline paths do not become extra batch requests", async () => {
|
|
expect(await readGitFileContents(cwd, ["HEAD:with\nnewline"])).toBeNull();
|
|
});
|