test: consolidate redundant assertions into boundary workflows

Remove getter, enum, cloned-projection, cache-identity, and obsolete profile assertions along with the shadow JSON Schema engine and dead test-only APIs. Retain producer, filesystem, SDK, lifecycle, integrity, and malformed-format coverage.

Document the priority of real end-to-end workflows, boundary integration, and producer goldens.
This commit is contained in:
morluto
2026-10-09 20:26:46 +08:00
parent 2f02eff988
commit b71a591a60
35 changed files with 199 additions and 2192 deletions
-36
View File
@@ -1,36 +0,0 @@
import { describe, expect, it } from "vitest";
import { compareCodePoints, uniqueSorted } from "./canonicalOrdering.js";
const REPLACEMENT = "\uFFFD";
const GRINNING = "\u{1F600}";
describe("compareCodePoints", () => {
it("orders by Unicode code point, not UTF-16 code unit", () => {
// U+FFFD < U+1F600, but the astral character's lead surrogate 0xD83D is
// numerically below U+FFFD, so a code-unit comparison inverts this pair.
expect(compareCodePoints(REPLACEMENT, GRINNING)).toBeLessThan(0);
expect(compareCodePoints(GRINNING, REPLACEMENT)).toBeGreaterThan(0);
});
it("keeps a prefix before its own extension", () => {
expect(compareCodePoints("ab", "abc")).toBe(-1);
expect(compareCodePoints("abc", "ab")).toBe(1);
});
it("orders astral characters by code point against the BMP tail", () => {
const ordered = ["\uFFFD", "\uFFFF", "\u{1F600}"];
for (const [index, left] of ordered.entries())
for (const right of ordered.slice(index + 1))
expect(compareCodePoints(left, right)).toBeLessThan(0);
});
});
describe("uniqueSorted", () => {
it("deduplicates and orders astral values by code point", () => {
expect(uniqueSorted([GRINNING, REPLACEMENT, GRINNING])).toEqual([
REPLACEMENT,
GRINNING,
]);
});
});
-30
View File
@@ -1,30 +0,0 @@
import { describe, expect, it } from "vitest";
import { absenceClaimable } from "./comparisonSemantics.js";
describe("shared comparison semantics", () => {
it("permits absence claims only for complete, non-truncated inventories", () => {
expect(
absenceClaimable({
status: "complete",
truncated: false,
omitted_count: 0,
}),
).toBe(true);
expect(
absenceClaimable({
status: "complete",
truncated: true,
omitted_count: 2,
}),
).toBe(false);
expect(
absenceClaimable({
status: "complete",
truncated: false,
omitted_count: 1,
}),
).toBe(false);
expect(absenceClaimable({ status: "partial" })).toBe(false);
});
});
@@ -1,85 +0,0 @@
import { describe, expect, it } from "vitest";
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCapture.fixture.js";
import {
processCaptureSchema,
type UnverifiedProcessCapture,
} from "./processCapture.js";
import { projectProcessObservation } from "./processObservation.js";
const emptyCapture = processCaptureSchema.parse(EMPTY_PROCESS_CAPTURE_EXAMPLE);
const capture: UnverifiedProcessCapture = {
...emptyCapture,
frames: [{ sequence: 0, at_ms: 1, data: "Ready" }],
rendered_frames: [
{
sequence: 0,
at_ms: 2,
columns: 80,
rows: 24,
cursor_x: 0,
cursor_y: 0,
active_buffer: "normal",
lines: ["Ready"],
serialized_state: "Ready",
},
],
interaction_events: [
{
sequence: 0,
scheduled_at_ms: 2,
dispatched_at_ms: 3,
type: "signal",
data: "SIGINT",
outcome: "dispatched",
},
],
process_samples: [
{
at_ms: 4,
pid: 2,
parent_pid: 1,
command: "worker",
process_group_id: 1,
session_id: 1,
},
],
};
describe("process observation vocabulary", () => {
it("projects capture collections without timestamp sorting", () => {
const locations = [
{ collection: "frames", index: 0, capture_order: 4 },
{ collection: "rendered_frames", index: 0, capture_order: 3 },
{ collection: "interaction_events", index: 0, capture_order: 2 },
{ collection: "lifecycle", index: 0, capture_order: 8 },
{ collection: "lifecycle", index: 1, capture_order: 9 },
{ collection: "process_samples", index: 0, capture_order: 1 },
{ collection: "filesystem_checkpoints", index: 0, capture_order: 0 },
] as const;
const observations = locations.map((location) =>
projectProcessObservation(capture, location),
);
expect(observations.map((value) => value?.source)).toEqual([
"terminal_raw",
"terminal_rendered",
"interaction",
"lifecycle",
"lifecycle",
"process",
"filesystem",
]);
expect(observations.map((value) => value?.capture_order)).toEqual(
locations.map(({ capture_order }) => capture_order),
);
expect(observations[5]).toMatchObject({
event_id: "obs.process_samples.0",
source_sequence: 0,
captured_at_ms: 4,
subject_id: "process:2",
});
expect(observations[3]?.captured_at_ms).toBeNull();
expect(observations[4]?.captured_at_ms).toBeNull();
});
});
@@ -1,37 +0,0 @@
import { describe, expect, it } from "vitest";
import { classifyReferenceSourcePath } from "./referenceSourceClassification.js";
describe("reference source manifest filenames", () => {
it.each(["CMakeLists.txt", "cmakelists.txt", "CMAKELISTS.TXT"])(
"recognizes %s with the existing case-insensitive policy",
(path) => {
expect(classifyReferenceSourcePath(path)).toEqual([
"documentation",
"manifest",
]);
},
);
it("preserves secondary classifications for a nested CMake manifest", () => {
expect(classifyReferenceSourcePath("src/CMakeLists.txt")).toEqual([
"documentation",
"manifest",
"source",
]);
});
it.each(["CMakeLists.txt.backup", "CMakeList.txt", "notes.txt"])(
"does not classify the near-match %s as a manifest",
(path) => {
expect(classifyReferenceSourcePath(path)).not.toContain("manifest");
},
);
it.each(["package.json", "PACKAGE.JSON", "Cargo.toml"])(
"preserves case-insensitive recognition of %s",
(path) => {
expect(classifyReferenceSourcePath(path)).toContain("manifest");
},
);
});
@@ -1,51 +0,0 @@
import { describe, expect, it } from "vitest";
import { detectReferenceSourceLanguage } from "./referenceSourceClassification.js";
describe("reference source Dockerfile language detection", () => {
it.each([
["DockerfileGuide.ts", "TypeScript"],
["nested/dockerfileHelper.py", "Python"],
["docs/dockerfiles.md", "Markdown"],
["DOCKERFILE_HELPER.JS", "JavaScript"],
["Dockerfile-Guide.tsx", "TSX"],
["DockerfileGuide.d.ts", "TypeScript"],
["DockerfileGuide.d.mts", "TypeScript"],
["DockerfileGuide.d.cts", "TypeScript"],
["dockerfiles", null],
["dockerfileHelper.unknown", null],
])(
"uses the extension for unrelated prefix filename %s",
(path, language) => {
expect(detectReferenceSourceLanguage(path)).toBe(language);
},
);
it.each([
"Dockerfile",
"dockerfile",
"DOCKERFILE",
"nested/DoCkErFiLe",
"Dockerfile.dev",
"Dockerfile.dev.ts",
"nested/dockerfile.dev.ts",
"DOCKERFILE.DEV.TS",
"Dockerfile.",
])("preserves exact and dotted Dockerfile recognition for %s", (path) => {
expect(detectReferenceSourceLanguage(path)).toBe("Dockerfile");
});
it.each([
["ordinary.ts", "TypeScript"],
["ordinary.TS", "TypeScript"],
["ordinary.d.mts", "TypeScript"],
["Dockerfile/main.js", "JavaScript"],
["README.md", "Markdown"],
["package.json", "JSON"],
["Containerfile", null],
[".dockerfile", null],
["unknown", null],
])("preserves other filename handling for %s", (path, language) => {
expect(detectReferenceSourceLanguage(path)).toBe(language);
});
});
@@ -1,60 +0,0 @@
import { describe, expect, it } from "vitest";
import {
classifyReferenceSourcePath,
detectReferenceSourceLanguage,
} from "./referenceSourceClassification.js";
describe("reference source test filenames", () => {
it.each([
["main_test.go", ["source", "test"], "Go"],
["main_test.py", ["source", "test"], "Python"],
["parser_spec.rs", ["source", "test"], "Rust"],
["widget_spec.cpp", ["source", "test"], "C++"],
["Widget_TeSt.TS", ["source", "test"], "TypeScript"],
["Widget_SpEc.PY", ["source", "test"], "Python"],
["widget.v2_test.py", ["source", "test"], "Python"],
[".widget_spec.js", ["source", "test"], "JavaScript"],
["widget_test.fixture", ["test"], null],
["settings_spec.json", ["config", "test"], "JSON"],
["notes_test.md", ["documentation", "test"], "Markdown"],
["widget_test.map", ["generated", "test"], null],
["dist/widget_spec.js", ["generated", "source", "test"], "JavaScript"],
["vendor/widget_test.go", ["source", "test", "vendor"], "Go"],
])("recognizes the final basename suffix in %s", (path, tags, language) => {
expect(classifyReferenceSourcePath(path)).toEqual(tags);
expect(detectReferenceSourceLanguage(path)).toBe(language);
});
it.each([
["test_main.py", ["source", "test"]],
["SPEC_main.rs", ["source", "test"]],
["main.test.js", ["source", "test"]],
["main.SPEC.ts", ["source", "test"]],
["main_test", ["test"]],
["main_SPEC", ["test"]],
["main.py_test", ["test"]],
["main.rs_spec", ["test"]],
["tests/main.go", ["source", "test"]],
])("preserves existing test classification for %s", (path, tags) => {
expect(classifyReferenceSourcePath(path)).toEqual(tags);
});
it.each([
["main.go", ["source"]],
["main.py", ["source"]],
["main_test_helper.go", ["source"]],
["main_tests.go", ["source"]],
["main_testing.py", ["source"]],
["main_tester.py", ["source"]],
["main_spec_helper.rs", ["source"]],
["main_specs.rs", ["source"]],
["main_specimen.rs", ["source"]],
["main_test.py.bak", ["unknown"]],
["main_spec.ts.bak", ["unknown"]],
["main_test_helpers", ["unknown"]],
["main_spec_helpers", ["unknown"]],
])("does not infer a test from a near-name in %s", (path, tags) => {
expect(classifyReferenceSourcePath(path)).toEqual(tags);
});
});
-1
View File
@@ -10,7 +10,6 @@ import {
import type { WebMcpDiscovery } from "./webMcpDiscovery.js";
export {
captureSnapshotSchema,
compareWebCapturesInputSchema,
webCaptureDiffSchema,
} from "./webCaptureDiffSchemas.js";