mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-25 18:52:39 +00:00
* fix(server): prevent Git watcher fanout stalls Repository metadata events were refreshing every observed worktree, multiplying Git process submissions and starving workspace create and archive requests behind observation work. Route metadata to the workspaces that depend on it, preserve conservative shared-ref refreshes, and admit interactive lifecycle operations ahead of queued background reads. * fix(server): preserve Git metadata dependencies
48 lines
2.1 KiB
TypeScript
48 lines
2.1 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
import {
|
|
classifyGitMetadataPath,
|
|
GIT_METADATA_EVENT_RULES,
|
|
getPrunedGitMetadataPaths,
|
|
} from "./git-metadata-event-rules.js";
|
|
|
|
describe("Git metadata event rules", () => {
|
|
test("has unique rule names", () => {
|
|
const names = GIT_METADATA_EVENT_RULES.map((rule) => rule.id);
|
|
expect(new Set(names).size).toBe(names.length);
|
|
});
|
|
|
|
test("derives watcher pruning from the same inventory", () => {
|
|
expect(getPrunedGitMetadataPaths("common")).toEqual(["hooks", "logs", "objects"]);
|
|
expect(getPrunedGitMetadataPaths("worktree")).toEqual([]);
|
|
});
|
|
|
|
test.each([
|
|
["worktree", "index", { kind: "owner", refreshBase: false }],
|
|
["worktree", "HEAD", { kind: "owner", refreshBase: true }],
|
|
["worktree", "config.worktree", { kind: "owner", refreshBase: true }],
|
|
["worktree", "paseo/worktree.json", { kind: "owner", refreshBase: true }],
|
|
["worktree", "COMMIT_EDITMSG", { kind: "ignore" }],
|
|
["worktree", "ORIG_HEAD", { kind: "ignore" }],
|
|
["common", "index", { kind: "owner", refreshBase: false }],
|
|
["common", "HEAD", { kind: "owner", refreshBase: true }],
|
|
["common", "refs/heads/feature", { kind: "ref", namespace: "local", ref: "feature" }],
|
|
[
|
|
"common",
|
|
"refs/remotes/origin/main",
|
|
{ kind: "ref", namespace: "remote", ref: "origin/main" },
|
|
],
|
|
["common", "packed-refs", { kind: "all", refreshBase: true }],
|
|
["common", "reftable/tables.list", { kind: "all", refreshBase: true }],
|
|
["common", "config", { kind: "all", refreshBase: true }],
|
|
["common", "worktrees/new/index", { kind: "ignore" }],
|
|
["common", "hooks/pre-commit", { kind: "ignore" }],
|
|
["common", "logs/refs/heads/main", { kind: "ignore" }],
|
|
["common", "objects/ab/cdef", { kind: "ignore" }],
|
|
["common", "refs/tags/v1", { kind: "ignore" }],
|
|
["common", "FETCH_HEAD", { kind: "ignore" }],
|
|
["common", "packed-refs.lock", { kind: "ignore" }],
|
|
] as const)("classifies %s metadata path %s", (scope, path, expected) => {
|
|
expect(classifyGitMetadataPath(scope, path)).toEqual(expected);
|
|
});
|
|
});
|