Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 22 additions & 40 deletions src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import { __testing as appTesting, AppContext } from "./app.js";
import { defaultConfig } from "./config.js";
import { ClawpatchError } from "./errors.js";
import type { ReviewOutput } from "./types.js";
import type { PartitionedReviewOutput, Provider } from "./provider-types.js";

// eslint-disable-next-line no-underscore-dangle
const { isRetryableReviewError, reviewFlagSubset, reviewRetries, runProviderReviewWithRetry } =
appTesting;

Expand All @@ -22,8 +21,12 @@ const QUIET_CONTEXT: AppContext = {
},
};

function emptyReview(): ReviewOutput {
return { findings: [], inspected: { files: [], symbols: [], notes: ["ok"] } };
function emptyReview(): PartitionedReviewOutput {
return {
findings: [],
inspected: { files: [], symbols: [], notes: ["ok"] },
droppedFindings: [],
};
}

it("forwards the registry-verifier opt-out into CI review flags", () => {
Expand Down Expand Up @@ -113,14 +116,7 @@ describe("reviewRetries", () => {
});
});

function fakeProvider(reviewImpl: (...args: unknown[]) => Promise<ReviewOutput>): {
name: string;
check: () => Promise<string>;
map: () => Promise<never>;
review: (...args: unknown[]) => Promise<ReviewOutput>;
fix: () => Promise<never>;
revalidate: () => Promise<never>;
} {
function fakeProvider(reviewImpl: Provider["review"]): Provider {
return {
name: "fake",
async check(): Promise<string> {
Expand Down Expand Up @@ -149,12 +145,10 @@ describe("runProviderReviewWithRetry", () => {
const review = vi.fn().mockResolvedValue(emptyReview());
const provider = fakeProvider(review);
const result = await runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand All @@ -172,12 +166,10 @@ describe("runProviderReviewWithRetry", () => {
.mockResolvedValueOnce(emptyReview());
const provider = fakeProvider(review);
const result = await runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand All @@ -196,12 +188,10 @@ describe("runProviderReviewWithRetry", () => {
const acquire = vi.fn().mockResolvedValue(undefined);
const provider = fakeProvider(review);
await runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand All @@ -219,12 +209,10 @@ describe("runProviderReviewWithRetry", () => {
const provider = fakeProvider(review);
await expect(
runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand All @@ -241,12 +229,10 @@ describe("runProviderReviewWithRetry", () => {
const provider = fakeProvider(review);
await expect(
runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand All @@ -263,12 +249,10 @@ describe("runProviderReviewWithRetry", () => {
const provider = fakeProvider(review);
await expect(
runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand All @@ -285,12 +269,10 @@ describe("runProviderReviewWithRetry", () => {
const provider = fakeProvider(review);
await expect(
runProviderReviewWithRetry({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
provider: provider as any,
provider,
root: "/tmp",
prompt: "hi",
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: {} as any,
options: { model: null, reasoningEffort: null, skipGitRepoCheck: false },
context: QUIET_CONTEXT,
featureId: "feat_x",
index: 0,
Expand Down
2 changes: 0 additions & 2 deletions src/command-support.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { AppContext } from "./app-context.js";
import { loadConfig, parseReasoningEffort } from "./config.js";
import { nowIso } from "./fs.js";
import type { RunRecord } from "./types.js";
Expand Down Expand Up @@ -45,7 +44,6 @@ export function providerOptions(config: ReturnType<typeof applyProviderFlags>) {
export function newRun(
id: string,
command: string,
context: AppContext,
root: string,
headSha: string | null,
): RunRecord {
Expand Down
Loading