mirror of
https://github.com/morluto/rea.git
synced 2026-11-19 13:12:26 +00:00
Inspect local Maven/Gradle metadata as Evidence with bounded report/XML admission, preserved caller choices and owned cleanup. Refs #8828; broader comparison and resolution work remains outside this change. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning) Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
31 lines
1.4 KiB
TypeScript
31 lines
1.4 KiB
TypeScript
import { writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { createMavenGradleMetadataService } from "../../../src/composition/mavenGradleMetadata.js";
|
|
import { mavenPomFixture } from "../../../src/java/MavenGradleMetadata.fixture.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
describe("Maven POM and Gradle module metadata stable filesystem boundary", () => {
|
|
it("returns typed resource and cancellation failures", async () => {
|
|
const root = await createTestTempDirectory("rea-maven-gradle-budget-");
|
|
const path = join(root, "pom.xml");
|
|
await writeFile(path, mavenPomFixture);
|
|
const service = createMavenGradleMetadataService();
|
|
try {
|
|
const tooSmall = await service.inspect({ path, max_file_bytes: 16 });
|
|
if (tooSmall.ok) throw new Error("Expected resource budget failure");
|
|
expect(tooSmall.error._tag).toBe("AnalysisResourceConstraintError");
|
|
const cancelled = await service.inspect(
|
|
{ path },
|
|
{ signal: AbortSignal.abort() },
|
|
);
|
|
if (cancelled.ok) throw new Error("Expected cancellation");
|
|
expect(cancelled.error._tag).toBe("AnalysisCancelledError");
|
|
const control = await service.inspect({ path });
|
|
if (!control.ok) throw control.error;
|
|
} finally {
|
|
await service.close();
|
|
}
|
|
});
|
|
});
|