@whaaaley/crush 0.3.0-next.10 → 0.3.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -14
- package/SKILL.md +4 -19
- package/dist/crush.tables.d.ts +12 -124
- package/dist/crush.tables.js +7 -22
- package/dist/instrument/instrument.operations.js +1 -1
- package/dist/judge/counters.js +1 -1
- package/dist/judge/edges/api.d.ts +2 -2
- package/dist/judge/edges/api.js +2 -2
- package/dist/judge/edges/hints.reporter.js +2 -2
- package/dist/judge/edges/judge.edges.d.ts +1 -2
- package/dist/judge/edges/judge.edges.js +1 -2
- package/dist/judge/edges/plugin.d.ts +7 -10
- package/dist/judge/edges/plugin.js +34 -55
- package/dist/judge/edges/vitest.d.ts +0 -3
- package/dist/judge/edges/vitest.js +1 -4
- package/dist/judge/hints.d.ts +1 -1
- package/dist/judge/hints.js +0 -3
- package/dist/judge/judge.schema.d.ts +0 -1
- package/dist/judge/judge.schema.js +0 -2
- package/dist/judge/provided.d.ts +2 -10
- package/dist/judge/provided.js +1 -1
- package/dist/judge/refusals.d.ts +2 -2
- package/dist/judge/refusals.js +2 -2
- package/dist/judge/report.test.js +10 -12
- package/dist/judge/runner.js +5 -66
- package/dist/judge/task-meta.d.ts +0 -6
- package/dist/questions/questions.operations.d.ts +2 -5
- package/dist/questions/questions.operations.js +8 -24
- package/dist/questions/questions.schema.d.ts +1 -3
- package/dist/questions/questions.schema.js +2 -2
- package/dist/record/edges/findings.db.d.ts +16 -0
- package/dist/record/edges/findings.db.js +25 -0
- package/dist/record/edges/parts.db.d.ts +1 -1
- package/dist/record/edges/parts.db.js +3 -15
- package/dist/record/edges/record.db.d.ts +1 -1
- package/dist/record/edges/record.db.js +1 -1
- package/dist/record/parts.operations.d.ts +2 -3
- package/dist/record/parts.operations.js +1 -2
- package/migrations/main/20261206102548_drop_explore/migration.sql +17 -0
- package/migrations/main/20261206102548_drop_explore/snapshot.json +3550 -0
- package/package.json +1 -3
- package/references/consumer-setup.md +0 -1
- package/dist/explore/edges/explore.d.ts +0 -53
- package/dist/explore/edges/explore.db.d.ts +0 -27
- package/dist/explore/edges/explore.db.js +0 -57
- package/dist/explore/edges/explore.js +0 -217
- package/dist/explore/edges/random.d.ts +0 -2
- package/dist/explore/edges/random.js +0 -32
- package/dist/explore/explore.operations.d.ts +0 -30
- package/dist/explore/explore.operations.js +0 -117
- package/dist/explore/limits.operations.d.ts +0 -14
- package/dist/explore/limits.operations.js +0 -20
- package/dist/explore/targets.operations.d.ts +0 -36
- package/dist/explore/targets.operations.js +0 -32
- package/dist/explore/utils/draws.d.ts +0 -6
- package/dist/explore/utils/draws.js +0 -2
- package/dist/explore/utils/edits.d.ts +0 -15
- package/dist/explore/utils/edits.js +0 -151
- package/dist/explore/utils/guide.d.ts +0 -23
- package/dist/explore/utils/guide.js +0 -35
- package/dist/explore/utils/keep.d.ts +0 -10
- package/dist/explore/utils/keep.js +0 -61
- package/dist/explore/utils/pools.d.ts +0 -17
- package/dist/explore/utils/pools.js +0 -121
- package/dist/explore/utils/reads.d.ts +0 -19
- package/dist/explore/utils/reads.js +0 -118
- package/dist/explore/utils/twin.d.ts +0 -21
- package/dist/explore/utils/twin.js +0 -55
- package/dist/judge/explore.test.d.ts +0 -1
- package/dist/judge/explore.test.js +0 -101
|
@@ -58,12 +58,7 @@ const wordings = {
|
|
|
58
58
|
};
|
|
59
59
|
},
|
|
60
60
|
untested: ({ file, code }) => ({ ask: `No test reads the pattern ${quote(code)} in ${quote(file)}. Test it?`, answers: ['yes: add a test that reads it', 'no: drop its `export`'] }),
|
|
61
|
-
//
|
|
62
|
-
explore: ({ function: name, code, replacement: input }) => ({
|
|
63
|
-
ask: `Explore called ${ownerOf(name)} with ${quote(input)} and it failed ${quote(code)}, which no test covers. Is that input one a caller can send?`,
|
|
64
|
-
answers: ['yes: fix the code, with a test that fails before the fix, then run explore again', 'no: refuse the input where it enters with a parse or guard, or justify it'],
|
|
65
|
-
}),
|
|
66
|
-
// Another plugin's finding is worded as explore's, and findingQuestionsOf names the plugin in place of explore.
|
|
61
|
+
// A finding names the input that failed and what it failed, a throw site or a property, since a varied seed made it; findingQuestionsOf names the plugin that found it.
|
|
67
62
|
finding: ({ function: name, code, replacement: input }) => ({
|
|
68
63
|
ask: `A plugin called ${ownerOf(name)} with ${quote(input)} and it failed ${quote(code)}, which no test covers. Is that input one a caller can send?`,
|
|
69
64
|
answers: ['yes: fix the code, with a test that fails before the fix, then run the plugin again', 'no: refuse the input where it enters with a parse or guard, or justify it'],
|
|
@@ -279,27 +274,16 @@ export const unusedQuestionsOf = (nodes) => {
|
|
|
279
274
|
});
|
|
280
275
|
return { all: asks.flatMap(({ all }) => all), open: asks.flatMap(({ open }) => open) };
|
|
281
276
|
};
|
|
282
|
-
// One question per finding's site, open until
|
|
277
|
+
// One question per finding's site, open until its plugin no longer finds it or a justification answers it; a site two targets found is asked once, of the first, naming the plugin that found it.
|
|
283
278
|
// Its id names the site alone, never the function that found it, so refreshing which target found a shared site keeps the id an answer names.
|
|
284
|
-
export const
|
|
279
|
+
export const findingQuestionsOf = (all) => {
|
|
285
280
|
const seen = new Set();
|
|
286
281
|
const findings = all.filter(({ key }) => !seen.has(key) && Boolean(seen.add(key)));
|
|
287
|
-
const inputs = findings.map((finding) => ({ kind, file: finding.file, function: finding.function, code: finding.key, replacement: finding.input.slice(0, 1024) }));
|
|
282
|
+
const inputs = findings.map((finding) => ({ kind: 'finding', file: finding.file, function: finding.function, code: finding.key, replacement: finding.input.slice(0, 1024) }));
|
|
288
283
|
const ids = questionsOf(inputs.map((input) => ({ ...input, function: '' })));
|
|
289
284
|
return questionsOf(inputs).map((question, index) => {
|
|
290
285
|
const finding = itemAt(findings, index);
|
|
291
|
-
return Object.assign(question, { id: itemAt(ids, index).id, sites: [finding.key], file: finding.file, line: finding.line });
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
// Another plugin's findings, asked as explore's are under their own kind, each naming the plugin that found it.
|
|
295
|
-
export const findingQuestionsOf = (all) => {
|
|
296
|
-
const pluginOf = new Map();
|
|
297
|
-
for (const { key, plugin } of all)
|
|
298
|
-
if (!pluginOf.has(key))
|
|
299
|
-
pluginOf.set(key, plugin);
|
|
300
|
-
return exploreQuestionsOf(all, 'finding').map((question) => {
|
|
301
|
-
const [site] = question.sites;
|
|
302
|
-
return Object.assign(question, { ask: question.ask.replace(/^A plugin/, pluginOf.get(site ?? '') ?? 'A plugin') });
|
|
286
|
+
return Object.assign(question, { id: itemAt(ids, index).id, ask: question.ask.replace(/^A plugin/, finding.plugin), sites: [finding.key], file: finding.file, line: finding.line });
|
|
303
287
|
});
|
|
304
288
|
};
|
|
305
289
|
export const pathQuestionsOf = (findings) => {
|
|
@@ -311,9 +295,9 @@ export const pathQuestionsOf = (findings) => {
|
|
|
311
295
|
return Object.assign(question, { file, line, sites: [siteKey], answers });
|
|
312
296
|
});
|
|
313
297
|
};
|
|
314
|
-
// Which tests catch each
|
|
315
|
-
// Only an export
|
|
316
|
-
export const
|
|
298
|
+
// Which tests catch each finding's key: a throw finding by a test whose call threw from its site, as a regression test for it does, and a property finding by a test that calls the property.
|
|
299
|
+
// Only an export a plugin found failing as a property counts as one, so a test calling a helper of its own file answers nothing.
|
|
300
|
+
export const findingCaughtOf = ({ calls, properties }) => {
|
|
317
301
|
const caught = new Map();
|
|
318
302
|
const note = (key, test) => {
|
|
319
303
|
caught.set(key, (caught.get(key) ?? new Set()).add(test));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const questionKinds: readonly ['crush', 'reach', 'call', 'side', 'tell', 'matter', 'behavior', 'test', 'unused', 'unexport', 'untested', 'testonly', 'steps', 'answers', '
|
|
2
|
+
export declare const questionKinds: readonly ['crush', 'reach', 'call', 'side', 'tell', 'matter', 'behavior', 'test', 'unused', 'unexport', 'untested', 'testonly', 'steps', 'answers', 'finding', 'same-result', 'no-split'];
|
|
3
3
|
export declare const questionIdPattern: RegExp;
|
|
4
4
|
export declare const encodedQuestionIdLength: number;
|
|
5
5
|
export declare const questionId: z.ZodString;
|
|
@@ -9,7 +9,6 @@ export declare const questionInput: z.ZodObject<{
|
|
|
9
9
|
behavior: "behavior";
|
|
10
10
|
call: "call";
|
|
11
11
|
crush: "crush";
|
|
12
|
-
explore: "explore";
|
|
13
12
|
finding: "finding";
|
|
14
13
|
matter: "matter";
|
|
15
14
|
"no-split": "no-split";
|
|
@@ -36,7 +35,6 @@ declare const questionOutput: z.ZodObject<{
|
|
|
36
35
|
behavior: "behavior";
|
|
37
36
|
call: "call";
|
|
38
37
|
crush: "crush";
|
|
39
|
-
explore: "explore";
|
|
40
38
|
finding: "finding";
|
|
41
39
|
matter: "matter";
|
|
42
40
|
"no-split": "no-split";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export const questionKinds = ['crush', 'reach', 'call', 'side', 'tell', 'matter', 'behavior', 'test', 'unused', 'unexport', 'untested', 'testonly', 'steps', 'answers', '
|
|
2
|
+
export const questionKinds = ['crush', 'reach', 'call', 'side', 'tell', 'matter', 'behavior', 'test', 'unused', 'unexport', 'untested', 'testonly', 'steps', 'answers', 'finding', 'same-result', 'no-split'];
|
|
3
3
|
// Matches a question id with pipes and percent signs escaped inside its fields.
|
|
4
|
-
export const questionIdPattern = /^(crush|reach|call|side|tell|matter|behavior|test|unused|unexport|untested|testonly|steps|answers|
|
|
4
|
+
export const questionIdPattern = /^(crush|reach|call|side|tell|matter|behavior|test|unused|unexport|untested|testonly|steps|answers|finding|same-result|no-split)\|(?:[^|%]|%25|%7C)+\|(?:[^|%]|%25|%7C)*\|\d+\|(?:[^|%]|%25|%7C)+$/;
|
|
5
5
|
const questionIdLength = 2048;
|
|
6
6
|
export const encodedQuestionIdLength = questionIdLength * 3;
|
|
7
7
|
// A question id names its kind, file, function and code, never a line, so edits around the code leave it as it was.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { pluginFindings } from '../../crush.tables.ts';
|
|
2
|
+
import { type Record } from './record.db.ts';
|
|
3
|
+
export type Finding = Omit<typeof pluginFindings.$inferInsert, 'findingKey' | 'plugin'> & {
|
|
4
|
+
key: string;
|
|
5
|
+
};
|
|
6
|
+
type StoredFinding = Finding & {
|
|
7
|
+
plugin: string;
|
|
8
|
+
};
|
|
9
|
+
type SetFindingsInput = {
|
|
10
|
+
plugin: string;
|
|
11
|
+
targets: readonly string[];
|
|
12
|
+
findings: Finding[];
|
|
13
|
+
};
|
|
14
|
+
export declare const setFindings: (db: Record, { plugin, targets, findings }: SetFindingsInput) => void;
|
|
15
|
+
export declare const getFindings: (db: Record) => StoredFinding[];
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { and, asc, eq, inArray } from 'drizzle-orm';
|
|
2
|
+
import { pluginFindings } from '../../crush.tables.js';
|
|
3
|
+
import { chunksOf } from './record.db.js';
|
|
4
|
+
// Replaces one plugin's findings for the targets it ran with what it found, leaving every other plugin's and target's as they were, so a site two targets reach keeps the evidence of each.
|
|
5
|
+
export const setFindings = (db, { plugin, targets, findings }) => {
|
|
6
|
+
db.transaction((tx) => {
|
|
7
|
+
const targetChunks = chunksOf(targets.map((target) => ({ target }))).map((chunk) => chunk.map(({ target }) => target));
|
|
8
|
+
for (const chunk of targetChunks) {
|
|
9
|
+
const ran = and(eq(pluginFindings.plugin, plugin), inArray(pluginFindings.target, chunk));
|
|
10
|
+
tx.delete(pluginFindings).where(ran).run();
|
|
11
|
+
}
|
|
12
|
+
for (const chunk of chunksOf(findings)) {
|
|
13
|
+
const rows = chunk.map(({ key, ...finding }) => Object.assign(finding, { findingKey: key, plugin }));
|
|
14
|
+
tx.insert(pluginFindings).values(rows).run();
|
|
15
|
+
}
|
|
16
|
+
}, { behavior: 'immediate' });
|
|
17
|
+
};
|
|
18
|
+
export const getFindings = (db) => {
|
|
19
|
+
return db
|
|
20
|
+
.select()
|
|
21
|
+
.from(pluginFindings)
|
|
22
|
+
.orderBy(asc(pluginFindings.findingKey), asc(pluginFindings.target))
|
|
23
|
+
.all()
|
|
24
|
+
.map(({ findingKey, ...finding }) => Object.assign(finding, { key: findingKey }));
|
|
25
|
+
};
|
|
@@ -17,7 +17,7 @@ export type CapturedPart = {
|
|
|
17
17
|
clearVerification: boolean;
|
|
18
18
|
clearFailure?: boolean;
|
|
19
19
|
};
|
|
20
|
-
export declare const setJudged: (db: Record, { file, hash, reused, tests, justifications, failure,
|
|
20
|
+
export declare const setJudged: (db: Record, { file, hash, reused, tests, justifications, failure, hits: taken, entered, verdicts: judged, reads, rerunFailing, passes, outside, changed, assignees, sequence }: Judged, captured?: CapturedPart) => void;
|
|
21
21
|
export declare const clearJudged: (db: Record, path: string) => void;
|
|
22
22
|
export declare const clearFileFailure: (db: Record, path: string, ranTests: boolean) => void;
|
|
23
23
|
export declare const setFileFailure: (db: Record, path: string, failure: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { and, asc, desc, eq, inArray, isNull, notInArray, sql, sum } from 'drizzle-orm';
|
|
3
|
-
import { entries, hits, judgedState, partAssignees, readSequences, sidePasses, sites, testFileChanged, testFileOutside,
|
|
3
|
+
import { entries, hits, judgedState, partAssignees, readSequences, sidePasses, sites, testFileChanged, testFileOutside, testFileReads, testFiles, testRuns, verdicts, verifiedFiles } from '../../crush.tables.js';
|
|
4
4
|
import { byPath, hitTextOf, partFrom, partTextOf } from '../parts.operations.js';
|
|
5
5
|
import { entryAt, itemAt } from '../../utils/lookup.js';
|
|
6
6
|
import { prepareExportCalls, writeExportCalls } from './calls.db.js';
|
|
@@ -67,10 +67,9 @@ const partOf = (db, testFile) => {
|
|
|
67
67
|
reads: db.select({ path: testFileReads.path, hash: testFileReads.hash }).from(testFileReads).where(eq(testFileReads.testFile, testFile)).all(),
|
|
68
68
|
outside: db.select({ path: testFileOutside.path }).from(testFileOutside).where(eq(testFileOutside.testFile, testFile)).all(),
|
|
69
69
|
changed: db.select({ path: testFileChanged.path }).from(testFileChanged).where(eq(testFileChanged.testFile, testFile)).all(),
|
|
70
|
-
properties: db.select({ name: testFileProperties.name }).from(testFileProperties).where(eq(testFileProperties.testFile, testFile)).all(),
|
|
71
70
|
});
|
|
72
71
|
};
|
|
73
|
-
export const setJudged = (db, { file, hash, reused, tests, justifications, failure,
|
|
72
|
+
export const setJudged = (db, { file, hash, reused, tests, justifications, failure, hits: taken, entered, verdicts: judged, reads, rerunFailing, passes, outside, changed, assignees, sequence }, captured) => {
|
|
74
73
|
const calls = captured && prepareExportCalls(captured.calls);
|
|
75
74
|
const isRerunFailing = new Set(rerunFailing);
|
|
76
75
|
const runs = tests.map(({ key, name, passed, isSteady, answers, ...test }) => ({
|
|
@@ -129,7 +128,7 @@ export const setJudged = (db, { file, hash, reused, tests, justifications, failu
|
|
|
129
128
|
.where(and(eq(readSequences.testFile, file), notInArray(readSequences.generation, kept)))
|
|
130
129
|
.run();
|
|
131
130
|
};
|
|
132
|
-
if (before?.hash === hash && partOf(tx, testFile) === partFrom({ runs, taken, entered, reads, passes, outside, changed,
|
|
131
|
+
if (before?.hash === hash && partOf(tx, testFile) === partFrom({ runs, taken, entered, reads, passes, outside, changed, siteOf })) {
|
|
133
132
|
// Every test key is already this file's, so the upsert only moves each test's timing.
|
|
134
133
|
for (const chunk of chunksOf(testRows)) {
|
|
135
134
|
tx.insert(testRuns)
|
|
@@ -150,10 +149,6 @@ export const setJudged = (db, { file, hash, reused, tests, justifications, failu
|
|
|
150
149
|
tx.delete(testFileOutside).where(eq(testFileOutside.testFile, testFile)).run();
|
|
151
150
|
for (const chunk of chunksOf(outside.map((path) => ({ testFile, path }))))
|
|
152
151
|
tx.insert(testFileOutside).values(chunk).run();
|
|
153
|
-
tx.delete(testFileProperties).where(eq(testFileProperties.testFile, testFile)).run();
|
|
154
|
-
// Two tests may declare one property, which the file holds once.
|
|
155
|
-
for (const chunk of chunksOf([...new Set(properties)].map((name) => ({ testFile, name }))))
|
|
156
|
-
tx.insert(testFileProperties).values(chunk).run();
|
|
157
152
|
tx.delete(testFileChanged).where(eq(testFileChanged.testFile, testFile)).run();
|
|
158
153
|
for (const chunk of chunksOf(changed.map((path) => ({ testFile, path }))))
|
|
159
154
|
tx.insert(testFileChanged).values(chunk).run();
|
|
@@ -271,12 +266,6 @@ const partsIn = (db, { withHits, path: only }) => {
|
|
|
271
266
|
.where(fileId === null ? undefined : eq(testFileOutside.testFile, fileId))
|
|
272
267
|
.orderBy(asc(testFileOutside.path))
|
|
273
268
|
.all(), ({ testFile }) => testFile);
|
|
274
|
-
const declared = Map.groupBy(tx
|
|
275
|
-
.select()
|
|
276
|
-
.from(testFileProperties)
|
|
277
|
-
.where(fileId === null ? undefined : eq(testFileProperties.testFile, fileId))
|
|
278
|
-
.orderBy(asc(testFileProperties.name))
|
|
279
|
-
.all(), ({ testFile }) => testFile);
|
|
280
269
|
const changedDuring = Map.groupBy(tx
|
|
281
270
|
.select()
|
|
282
271
|
.from(testFileChanged)
|
|
@@ -365,7 +354,6 @@ const partsIn = (db, { withHits, path: only }) => {
|
|
|
365
354
|
passes: (counted.get(id) ?? []).map(({ site, side, passes: count }) => ({ siteKey: entryAt(keyOf, site, 'a passed site'), side, passes: count })),
|
|
366
355
|
outside: (loadedOutside.get(id) ?? []).map(({ path: loaded }) => loaded),
|
|
367
356
|
changed: (changedDuring.get(id) ?? []).map(({ path: source }) => source),
|
|
368
|
-
properties: (declared.get(id) ?? []).map(({ name }) => name),
|
|
369
357
|
assignees: (judgedUnder.get(id) ?? []).map(({ source, assignee }) => ({ source, assignee })),
|
|
370
358
|
}));
|
|
371
359
|
return byPath(parts);
|
|
@@ -2,7 +2,7 @@ import { DatabaseSync } from 'node:sqlite';
|
|
|
2
2
|
import { type NodeSQLiteDatabase } from 'drizzle-orm/node-sqlite';
|
|
3
3
|
import { CrushError } from '../../utils/errors.ts';
|
|
4
4
|
import { type Safe } from '../../utils/safe.ts';
|
|
5
|
-
export declare const recordVersion = "
|
|
5
|
+
export declare const recordVersion = "59";
|
|
6
6
|
export declare const memoryPath = ":memory:";
|
|
7
7
|
export type Record = NodeSQLiteDatabase & {
|
|
8
8
|
$client: DatabaseSync;
|
|
@@ -60,7 +60,7 @@ import { safe } from '../../utils/safe.js';
|
|
|
60
60
|
import { ensureRecordFolder, recordFileExists, removeRecordFile } from './record.fs.js';
|
|
61
61
|
import { unreadableRecordOf } from '../../judge/refusals.js';
|
|
62
62
|
// The record's shape; a record of any other version is deleted and rebuilt, since every row can be recorded again.
|
|
63
|
-
export const recordVersion = '
|
|
63
|
+
export const recordVersion = '59';
|
|
64
64
|
// How long a connection waits on the record while another holds its write lock, as every test file's worker writes its own part at once.
|
|
65
65
|
const busyMs = 30_000;
|
|
66
66
|
const migrationsFolder = join(import.meta.dirname, '../../../migrations/main');
|
|
@@ -10,11 +10,10 @@ type PartRows = {
|
|
|
10
10
|
reads: object[];
|
|
11
11
|
outside: object[];
|
|
12
12
|
changed: object[];
|
|
13
|
-
properties: object[];
|
|
14
13
|
};
|
|
15
14
|
export declare const partTextOf: ({ taken, ...rows }: PartRows) => string;
|
|
16
15
|
export declare const hitTextOf: (site: number, side: Judged['hits'][number]['side'], testKey: string | undefined) => string;
|
|
17
|
-
type PartFromInput = Pick<Judged, 'entered' | 'reads' | 'passes' | 'outside' | 'changed'
|
|
16
|
+
type PartFromInput = Pick<Judged, 'entered' | 'reads' | 'passes' | 'outside' | 'changed'> & {
|
|
18
17
|
runs: {
|
|
19
18
|
testKey: string;
|
|
20
19
|
ns: number;
|
|
@@ -22,5 +21,5 @@ type PartFromInput = Pick<Judged, 'entered' | 'reads' | 'passes' | 'outside' | '
|
|
|
22
21
|
taken: Judged['hits'];
|
|
23
22
|
siteOf: ReadonlyMap<string, number>;
|
|
24
23
|
};
|
|
25
|
-
export declare const partFrom: ({ runs, taken, entered, reads, passes, outside, changed,
|
|
24
|
+
export declare const partFrom: ({ runs, taken, entered, reads, passes, outside, changed, siteOf }: PartFromInput) => string;
|
|
26
25
|
export {};
|
|
@@ -10,7 +10,7 @@ export const partTextOf = ({ taken, ...rows }) => JSON.stringify([taken.toSorted
|
|
|
10
10
|
// Hits have a fixed shape. Comparing tuples avoids sorting three property names for every hit in both copies of a part.
|
|
11
11
|
export const hitTextOf = (site, side, testKey) => JSON.stringify([site, side, testKey]);
|
|
12
12
|
// The part a run is about to write without its verdicts, which `setJudged` writes apart, leaving out a row for a site no plan names and a hit by a test this file did not run.
|
|
13
|
-
export const partFrom = ({ runs, taken, entered, reads, passes, outside, changed,
|
|
13
|
+
export const partFrom = ({ runs, taken, entered, reads, passes, outside, changed, siteOf }) => {
|
|
14
14
|
const keys = new Set(runs.map(({ testKey }) => testKey));
|
|
15
15
|
return partTextOf({
|
|
16
16
|
runs: runs.map(({ ns: _ns, ...run }) => run),
|
|
@@ -26,6 +26,5 @@ export const partFrom = ({ runs, taken, entered, reads, passes, outside, changed
|
|
|
26
26
|
reads: reads.map(({ path, hash }) => ({ path, hash })),
|
|
27
27
|
outside: outside.map((path) => ({ path })),
|
|
28
28
|
changed: changed.map((path) => ({ path })),
|
|
29
|
-
properties: [...new Set(properties)].map((name) => ({ name })),
|
|
30
29
|
});
|
|
31
30
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
CREATE TABLE `plugin_findings` (
|
|
2
|
+
`finding_key` text NOT NULL,
|
|
3
|
+
`kind` text NOT NULL,
|
|
4
|
+
`file` text NOT NULL,
|
|
5
|
+
`line` integer NOT NULL,
|
|
6
|
+
`function` text NOT NULL,
|
|
7
|
+
`input` text NOT NULL,
|
|
8
|
+
`target` text NOT NULL,
|
|
9
|
+
`source_hash` text NOT NULL,
|
|
10
|
+
`plugin` text NOT NULL,
|
|
11
|
+
CONSTRAINT `plugin_findings_pk` PRIMARY KEY(`plugin`, `target`, `finding_key`),
|
|
12
|
+
CONSTRAINT "plugin_findings_kind_check" CHECK("kind" in ('throw', 'property'))
|
|
13
|
+
);
|
|
14
|
+
--> statement-breakpoint
|
|
15
|
+
DROP TABLE `explore_findings`;--> statement-breakpoint
|
|
16
|
+
DROP TABLE `explore_runs`;--> statement-breakpoint
|
|
17
|
+
DROP TABLE `test_file_properties`;
|