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
35 changes: 26 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@libpg-query/parser": "^17.6.3",
"@opentelemetry/api": "^1.9.0",
"@pgsql/types": "^17.6.2",
"@query-doctor/core": "^0.12.0",
"@query-doctor/core": "^0.13.0",
"async-sema": "^3.1.1",
"capnweb": "^0.7.0",
"dedent": "^1.7.1",
Expand Down
9 changes: 6 additions & 3 deletions src/remote/api-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { newWebSocketRpcSession, RpcTarget } from "capnweb";
import type { RpcStub } from "capnweb";
import type { ConnectionMode, UnauthenticatedServerApi, ClientApi, IndexDefinition, ServerApi } from "@query-doctor/core";
import type { ConnectionMode, UnauthenticatedServerApi, ClientApi, IndexDefinition, LiveQueryOptimization, ServerApi } from "@query-doctor/core";
import type { ExportedStats } from "@query-doctor/core";
import { PgIdentifier, Statistics } from "@query-doctor/core";
import { log } from "../log.ts";
Expand Down Expand Up @@ -183,7 +183,10 @@ export class ApiClient extends RpcTarget implements ClientApi {
);
}

async runQuery(_query: string): Promise<void> {
log.warn("runQuery is not implemented", ApiClient.name);
async runQuery(_query: string): Promise<LiveQueryOptimization> {
// Part of the ClientApi RPC surface (core 0.13.0) but never invoked on the
// CI client — throw rather than return a fabricated optimization, so a stray
// call surfaces loudly instead of silently yielding a bogus result.
throw new Error("runQuery is not implemented on the CI ApiClient");
}
}
24 changes: 24 additions & 0 deletions src/reporters/site-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,30 @@ describe("compareRuns", () => {
expect(result.regressed).toHaveLength(1);
expect(result.testOriginExcluded).toHaveLength(0);
});

// Real SQLCommenter `file` tags carry a `:line:col` suffix
// (`…repository.spec.ts:509:10`). Before core stripped that suffix, the
// `$`-anchored `.spec.ts` pattern never matched, so a test read-back leaked
// into newQueries and phantom-blocked unrelated PRs run after run — the
// server dropped it as test-origin while the analyzer did not (Site #3606).
test("excludes a .spec.ts query whose file tag carries a :line:col suffix", async () => {
const withSuffix: CiQueryPayload = {
...makeQuery("hash-new", 200),
tags: [
{
key: "file",
value:
"/home/runner/work/Site/Site/apps/api/src/projects/project-queries.repository.spec.ts:509:10",
},
],
};
const previousRun = makePreviousRun([]);

const result = await compareRuns([withSuffix], previousRun, 10);

expect(result.newQueries).toHaveLength(0);
expect(result.testOriginExcluded.map((q) => q.hash)).toEqual(["hash-new"]);
});
});

describe("changed-query detection via shape (#3367)", () => {
Expand Down
Loading