@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
package/README.md
CHANGED
|
@@ -44,8 +44,6 @@ Run each from the root of the project crush is set up in, waiting for one to fin
|
|
|
44
44
|
- `vp run judge:redundant` judges as `vp run judge` does, then reruns the other tests of each catch to find a second catcher, which is what shows a test redundant and asks whether it can go.
|
|
45
45
|
- `vp run questions` lists the open questions.
|
|
46
46
|
- `vp run questions:related <paths>` lists only the questions of the sources those paths reach.
|
|
47
|
-
- `vp run explore` searches a property for inputs that break it, seeded from the record. Explore is experimental in 0.1: its findings can change between releases, and it may move to a plugin of its own.
|
|
48
|
-
- `vp run explore:related <paths>` searches only the exports those paths reach.
|
|
49
47
|
- `vp run stresses` prints how many tests each mutator and the crushes drive.
|
|
50
48
|
|
|
51
49
|
A question no test can answer takes an inline literal `meta: { justifies: [{ id, basis, reason }] }` on the function's `describe` in its test file:
|
|
@@ -107,7 +105,7 @@ Simpler code is the fourth answer: had both sides of a question behaved the same
|
|
|
107
105
|
|
|
108
106
|
### What each command prints last
|
|
109
107
|
|
|
110
|
-
Record, judge
|
|
108
|
+
Record, judge and questions end with a blank line, then a `hint:` line, a `skill:` line, one or more `don't:` lines and a `next:` line, which names one command to run as printed.
|
|
111
109
|
Stresses prints none, since its output is the work.
|
|
112
110
|
A related run names the related task, as `vp run judge:related <paths>` after `vp run record:related <paths>`.
|
|
113
111
|
|
|
@@ -117,7 +115,6 @@ A related run names the related task, as `vp run judge:related <paths>` after `v
|
|
|
117
115
|
| record, passed | `vp run judge` |
|
|
118
116
|
| judge, a test failed | fixing each failure, then `vp run judge` again |
|
|
119
117
|
| judge, passed | `vp run questions` |
|
|
120
|
-
| explore | `vp run questions` |
|
|
121
118
|
| questions, some open | answering the first open question, in its file, then `vp run record:related <file>`, `vp run judge:related <file>` and `vp run questions` |
|
|
122
119
|
| questions, open, no file | answering them from the top, then `vp run record`, `vp run judge` and `vp run questions` |
|
|
123
120
|
| questions, none open, failed | fixing each failure printed, then `vp run questions` again |
|
|
@@ -125,16 +122,12 @@ A related run names the related task, as `vp run judge:related <paths>` after `v
|
|
|
125
122
|
|
|
126
123
|
The questions hint names asking the user, with the question's id and both readings, when the code's intent is unknown, and a `don't:` line says not to stop at such a question but to note it for the user and take the next.
|
|
127
124
|
|
|
128
|
-
###
|
|
125
|
+
### Plugins
|
|
129
126
|
|
|
130
127
|
Judging checks whether your tests notice a change to your code: a mutant no test catches, or a branch no test needs, becomes a question.
|
|
131
128
|
It can't find a bug the code and its tests agree on, as an input no test passes that the code gets wrong.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
- **Exports:** it calls each export with generated inputs, and a throw from a place no test covers becomes a question.
|
|
135
|
-
- **Properties:** it calls a property, and each input it fails becomes a question. A property is an exported function in a test file that returns `'passed'`, `'discarded'` or `'failed'` for an input, a throw counting as failed, such as "decoding what was encoded gives back the input". A Vitest test names it in `meta: { explores }`.
|
|
136
|
-
|
|
137
|
-
Properties pay off mostly for parsers, encoders and state machines, so judging alone is enough for most code.
|
|
129
|
+
A plugin such as crush-fuzz looks for those through `@whaaaley/crush/api`, and each finding it saves becomes a question that names the plugin.
|
|
130
|
+
A plugin declares `@whaaaley/crush` as a peer on the crush minor it was built against, so a crush minor that changes the API refuses the install.
|
|
138
131
|
|
|
139
132
|
## Why
|
|
140
133
|
|
|
@@ -170,14 +163,13 @@ crush can judge some code wrong, or not at all, in these cases:
|
|
|
170
163
|
- **Module state between reruns:** a mutant's rerun can leave module state a later test reads, so a later site can read survived where a fresh load would catch it.
|
|
171
164
|
- **Tests that leak globals:** a project's test files share one process per run with no isolation between files, so a test that sets a global and never restores it, as hono's `global.fetch` mock does, can change later files' verdicts.
|
|
172
165
|
- **Unsteady tests:** a test whose work differs between runs with nothing forced, as one deciding with `Math.random`, gives verdicts that can differ between judges; crush marks it unsteady and asks about its steps.
|
|
173
|
-
- **Generators:** an exported generator expression is captured by its arguments alone, since its body runs as the caller iterates, so
|
|
166
|
+
- **Generators:** an exported generator expression is captured by its arguments alone, since its body runs as the caller iterates, so a plugin can seed from its calls but the path checks never see them; an exported generator declaration isn't captured at all.
|
|
174
167
|
- **Captured async exports:** reading an async export's result attaches a handler, so in crush's baseline a rejection the test leaves unhandled isn't reported; the project's own `vp test` still reports it.
|
|
175
|
-
- **Explore is experimental:** its search, its findings and how it reports them may change, and nothing should gate on its output yet.
|
|
176
168
|
- **ES modules only:** every file but a `.cjs` one is read as an ES module, as ESLint does, and CommonJS isn't supported.
|
|
177
169
|
|
|
178
170
|
## Project structure
|
|
179
171
|
|
|
180
|
-
- `src/`: The engine, one folder per stage: `decisions/`, `crushes/`, `mutators/`, `graph/`, `collapse/`, `capture/`, `instrument/`, `record/`, `judge/`, `questions/`, `justify/`, `forks/`, `stresses
|
|
172
|
+
- `src/`: The engine, one folder per stage: `decisions/`, `crushes/`, `mutators/`, `graph/`, `collapse/`, `capture/`, `instrument/`, `record/`, `judge/`, `questions/`, `justify/`, `forks/`, `stresses/` and `parity/`, with shared helpers in `utils/`.
|
|
181
173
|
- `docs/` and `references/`: The docs this README links and the consumer setup `SKILL.md` points to.
|
|
182
174
|
- `scripts/`: The CI scripts the workflows run, and `check`, the format, lint and test gate.
|
|
183
175
|
- `tools.config.json`: The settings crush's own tools read, such as the reviewer saga runs.
|
package/SKILL.md
CHANGED
|
@@ -162,26 +162,11 @@ A related run keeps untouched results. Delete `.crush/record.db` when the check
|
|
|
162
162
|
Finish the record loop with passing report tests and no open questions, invalid answers, invalid justifications, failing baselines, or tests failing their rerun
|
|
163
163
|
The project report checks those items together, while coverage and mutation figures alone miss failures
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
Reproduce a plugin's finding with a regression test before recording again
|
|
166
|
+
The finding supplies an input that breaks the code, and the regression test keeps that input checked on later runs
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
Set `explore: { maxTotalTime, runs }` in `exploreProject` to bound Explore by seconds or target calls
|
|
172
|
-
The defaults are `0` seconds and `-1` runs, leaving both limits open. When both are set, the first one reached ends the run
|
|
173
|
-
|
|
174
|
-
In crush's own checkout set `explore.maxTotalTime` or `explore.runs` in the settings of its `vite.config.ts` before `vp run explore` or `vp run explore:related`
|
|
175
|
-
Those tasks read the limits from the config, as a consumer's `exploreProject` settings set them
|
|
176
|
-
|
|
177
|
-
Stop an unbounded run with Ctrl-C and read saved findings with `vp run questions`
|
|
178
|
-
Explore saves each finding as it is found, so Questions can show those already found when the run stops
|
|
179
|
-
|
|
180
|
-
Reproduce an explore finding with a regression test before recording again
|
|
181
|
-
The finding supplies an input that breaks the property, and the regression test keeps that input checked on later runs
|
|
182
|
-
|
|
183
|
-
Remove an explore finding's id from `meta.answers` once the finding closes
|
|
184
|
-
Crush refuses a closed explore id because only open explore findings enter answer validation
|
|
168
|
+
Remove a finding's id from `meta.answers` once the finding closes
|
|
169
|
+
Crush refuses a closed finding id because only open findings enter answer validation
|
|
185
170
|
|
|
186
171
|
Keep the worktree's `.crush/record.db` between runs
|
|
187
172
|
Related runs reuse its evidence, and `vp run record` automatically rebuilds it when the version in `src/record/edges/record.db.ts` changes
|
package/dist/crush.tables.d.ts
CHANGED
|
@@ -2292,46 +2292,6 @@ export declare const testFileOutside: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
2292
2292
|
dialect: 'sqlite';
|
|
2293
2293
|
isAlias: false;
|
|
2294
2294
|
}>;
|
|
2295
|
-
export declare const testFileProperties: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2296
|
-
name: "test_file_properties";
|
|
2297
|
-
schema: undefined;
|
|
2298
|
-
columns: {
|
|
2299
|
-
testFile: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2300
|
-
name: string;
|
|
2301
|
-
tableName: "test_file_properties";
|
|
2302
|
-
dataType: "number int53";
|
|
2303
|
-
data: number;
|
|
2304
|
-
driverParam: number;
|
|
2305
|
-
notNull: true;
|
|
2306
|
-
hasDefault: false;
|
|
2307
|
-
isPrimaryKey: false;
|
|
2308
|
-
isAutoincrement: false;
|
|
2309
|
-
hasRuntimeDefault: false;
|
|
2310
|
-
enumValues: undefined;
|
|
2311
|
-
baseColumn: never;
|
|
2312
|
-
identity: undefined;
|
|
2313
|
-
generated: undefined;
|
|
2314
|
-
}, {}>;
|
|
2315
|
-
name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
2316
|
-
name: string;
|
|
2317
|
-
tableName: "test_file_properties";
|
|
2318
|
-
dataType: "string";
|
|
2319
|
-
data: string;
|
|
2320
|
-
driverParam: string;
|
|
2321
|
-
notNull: true;
|
|
2322
|
-
hasDefault: false;
|
|
2323
|
-
isPrimaryKey: false;
|
|
2324
|
-
isAutoincrement: false;
|
|
2325
|
-
hasRuntimeDefault: false;
|
|
2326
|
-
enumValues: [string, ...string[]];
|
|
2327
|
-
baseColumn: never;
|
|
2328
|
-
identity: undefined;
|
|
2329
|
-
generated: undefined;
|
|
2330
|
-
}, {}>;
|
|
2331
|
-
};
|
|
2332
|
-
dialect: 'sqlite';
|
|
2333
|
-
isAlias: false;
|
|
2334
|
-
}>;
|
|
2335
2295
|
export declare const testFileChanged: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2336
2296
|
name: "test_file_changed";
|
|
2337
2297
|
schema: undefined;
|
|
@@ -3085,85 +3045,13 @@ export declare const reachEdges: import("drizzle-orm/sqlite-core").SQLiteTableWi
|
|
|
3085
3045
|
isAlias: false;
|
|
3086
3046
|
}>;
|
|
3087
3047
|
export declare const findingKinds: readonly ['throw', 'property'];
|
|
3088
|
-
export declare const
|
|
3089
|
-
name: "
|
|
3090
|
-
schema: undefined;
|
|
3091
|
-
columns: {
|
|
3092
|
-
targetKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3093
|
-
name: string;
|
|
3094
|
-
tableName: "explore_runs";
|
|
3095
|
-
dataType: "string";
|
|
3096
|
-
data: string;
|
|
3097
|
-
driverParam: string;
|
|
3098
|
-
notNull: true;
|
|
3099
|
-
hasDefault: false;
|
|
3100
|
-
isPrimaryKey: true;
|
|
3101
|
-
isAutoincrement: false;
|
|
3102
|
-
hasRuntimeDefault: false;
|
|
3103
|
-
enumValues: [string, ...string[]];
|
|
3104
|
-
baseColumn: never;
|
|
3105
|
-
identity: undefined;
|
|
3106
|
-
generated: undefined;
|
|
3107
|
-
}, {}>;
|
|
3108
|
-
ms: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3109
|
-
name: string;
|
|
3110
|
-
tableName: "explore_runs";
|
|
3111
|
-
dataType: "number int53";
|
|
3112
|
-
data: number;
|
|
3113
|
-
driverParam: number;
|
|
3114
|
-
notNull: true;
|
|
3115
|
-
hasDefault: false;
|
|
3116
|
-
isPrimaryKey: false;
|
|
3117
|
-
isAutoincrement: false;
|
|
3118
|
-
hasRuntimeDefault: false;
|
|
3119
|
-
enumValues: undefined;
|
|
3120
|
-
baseColumn: never;
|
|
3121
|
-
identity: undefined;
|
|
3122
|
-
generated: undefined;
|
|
3123
|
-
}, {}>;
|
|
3124
|
-
exploredAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3125
|
-
name: string;
|
|
3126
|
-
tableName: "explore_runs";
|
|
3127
|
-
dataType: "object date";
|
|
3128
|
-
data: Date;
|
|
3129
|
-
driverParam: number;
|
|
3130
|
-
notNull: true;
|
|
3131
|
-
hasDefault: false;
|
|
3132
|
-
isPrimaryKey: false;
|
|
3133
|
-
isAutoincrement: false;
|
|
3134
|
-
hasRuntimeDefault: false;
|
|
3135
|
-
enumValues: undefined;
|
|
3136
|
-
baseColumn: never;
|
|
3137
|
-
identity: undefined;
|
|
3138
|
-
generated: undefined;
|
|
3139
|
-
}, {}>;
|
|
3140
|
-
stopped: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3141
|
-
name: string;
|
|
3142
|
-
tableName: "explore_runs";
|
|
3143
|
-
dataType: "string";
|
|
3144
|
-
data: string;
|
|
3145
|
-
driverParam: string;
|
|
3146
|
-
notNull: false;
|
|
3147
|
-
hasDefault: false;
|
|
3148
|
-
isPrimaryKey: false;
|
|
3149
|
-
isAutoincrement: false;
|
|
3150
|
-
hasRuntimeDefault: false;
|
|
3151
|
-
enumValues: [string, ...string[]];
|
|
3152
|
-
baseColumn: never;
|
|
3153
|
-
identity: undefined;
|
|
3154
|
-
generated: undefined;
|
|
3155
|
-
}, {}>;
|
|
3156
|
-
};
|
|
3157
|
-
dialect: 'sqlite';
|
|
3158
|
-
isAlias: false;
|
|
3159
|
-
}>;
|
|
3160
|
-
export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
3161
|
-
name: "explore_findings";
|
|
3048
|
+
export declare const pluginFindings: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
3049
|
+
name: "plugin_findings";
|
|
3162
3050
|
schema: undefined;
|
|
3163
3051
|
columns: {
|
|
3164
3052
|
findingKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3165
3053
|
name: string;
|
|
3166
|
-
tableName: "
|
|
3054
|
+
tableName: "plugin_findings";
|
|
3167
3055
|
dataType: "string";
|
|
3168
3056
|
data: string;
|
|
3169
3057
|
driverParam: string;
|
|
@@ -3179,7 +3067,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3179
3067
|
}, {}>;
|
|
3180
3068
|
kind: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3181
3069
|
name: string;
|
|
3182
|
-
tableName: "
|
|
3070
|
+
tableName: "plugin_findings";
|
|
3183
3071
|
dataType: "string enum";
|
|
3184
3072
|
data: "property" | "throw";
|
|
3185
3073
|
driverParam: string;
|
|
@@ -3195,7 +3083,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3195
3083
|
}, {}>;
|
|
3196
3084
|
file: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3197
3085
|
name: string;
|
|
3198
|
-
tableName: "
|
|
3086
|
+
tableName: "plugin_findings";
|
|
3199
3087
|
dataType: "string";
|
|
3200
3088
|
data: string;
|
|
3201
3089
|
driverParam: string;
|
|
@@ -3211,7 +3099,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3211
3099
|
}, {}>;
|
|
3212
3100
|
line: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3213
3101
|
name: string;
|
|
3214
|
-
tableName: "
|
|
3102
|
+
tableName: "plugin_findings";
|
|
3215
3103
|
dataType: "number int53";
|
|
3216
3104
|
data: number;
|
|
3217
3105
|
driverParam: number;
|
|
@@ -3227,7 +3115,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3227
3115
|
}, {}>;
|
|
3228
3116
|
function: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3229
3117
|
name: string;
|
|
3230
|
-
tableName: "
|
|
3118
|
+
tableName: "plugin_findings";
|
|
3231
3119
|
dataType: "string";
|
|
3232
3120
|
data: string;
|
|
3233
3121
|
driverParam: string;
|
|
@@ -3243,7 +3131,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3243
3131
|
}, {}>;
|
|
3244
3132
|
input: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3245
3133
|
name: string;
|
|
3246
|
-
tableName: "
|
|
3134
|
+
tableName: "plugin_findings";
|
|
3247
3135
|
dataType: "string";
|
|
3248
3136
|
data: string;
|
|
3249
3137
|
driverParam: string;
|
|
@@ -3259,7 +3147,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3259
3147
|
}, {}>;
|
|
3260
3148
|
target: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3261
3149
|
name: string;
|
|
3262
|
-
tableName: "
|
|
3150
|
+
tableName: "plugin_findings";
|
|
3263
3151
|
dataType: "string";
|
|
3264
3152
|
data: string;
|
|
3265
3153
|
driverParam: string;
|
|
@@ -3275,7 +3163,7 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3275
3163
|
}, {}>;
|
|
3276
3164
|
sourceHash: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3277
3165
|
name: string;
|
|
3278
|
-
tableName: "
|
|
3166
|
+
tableName: "plugin_findings";
|
|
3279
3167
|
dataType: "string";
|
|
3280
3168
|
data: string;
|
|
3281
3169
|
driverParam: string;
|
|
@@ -3291,12 +3179,12 @@ export declare const exploreFindings: import("drizzle-orm/sqlite-core").SQLiteTa
|
|
|
3291
3179
|
}, {}>;
|
|
3292
3180
|
plugin: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
3293
3181
|
name: string;
|
|
3294
|
-
tableName: "
|
|
3182
|
+
tableName: "plugin_findings";
|
|
3295
3183
|
dataType: "string";
|
|
3296
3184
|
data: string;
|
|
3297
3185
|
driverParam: string;
|
|
3298
3186
|
notNull: true;
|
|
3299
|
-
hasDefault:
|
|
3187
|
+
hasDefault: false;
|
|
3300
3188
|
isPrimaryKey: false;
|
|
3301
3189
|
isAutoincrement: false;
|
|
3302
3190
|
hasRuntimeDefault: false;
|
package/dist/crush.tables.js
CHANGED
|
@@ -287,13 +287,6 @@ export const testFileOutside = sqliteTable('test_file_outside', {
|
|
|
287
287
|
}, (table) => [
|
|
288
288
|
primaryKey({ columns: [table.testFile, table.path] }),
|
|
289
289
|
]);
|
|
290
|
-
// Each property a test file's tests declare for explore, by the export name its `meta.explores` gives, which a clean record reads to credit an answer to it.
|
|
291
|
-
export const testFileProperties = sqliteTable('test_file_properties', {
|
|
292
|
-
testFile: integer().notNull().references(() => testFiles.id, { onDelete: 'cascade' }),
|
|
293
|
-
name: text().notNull(),
|
|
294
|
-
}, (table) => [
|
|
295
|
-
primaryKey({ columns: [table.testFile, table.name] }),
|
|
296
|
-
]);
|
|
297
290
|
// Each source a test file's run loaded that changed during it, whose stale plan left the file's sites unjudged.
|
|
298
291
|
export const testFileChanged = sqliteTable('test_file_changed', {
|
|
299
292
|
testFile: integer().notNull().references(() => testFiles.id, { onDelete: 'cascade' }),
|
|
@@ -395,30 +388,22 @@ export const reachEdges = sqliteTable('reach_edges', {
|
|
|
395
388
|
index('reach_edges_to_key_idx').on(table.toKey),
|
|
396
389
|
]);
|
|
397
390
|
export const findingKinds = ['throw', 'property'];
|
|
398
|
-
//
|
|
399
|
-
export const
|
|
400
|
-
targetKey: text().primaryKey(),
|
|
401
|
-
ms: integer().notNull(),
|
|
402
|
-
exploredAt: integer({ mode: 'timestamp_ms' }).notNull(),
|
|
403
|
-
// Why the target's search stopped short, as a call past its tick limit, null for a search that ran its course.
|
|
404
|
-
stopped: text(),
|
|
405
|
-
});
|
|
406
|
-
// Each finding: a throw site no test covered, or a property a varied input failed, with the input that showed it and where to ask.
|
|
407
|
-
export const exploreFindings = sqliteTable('explore_findings', {
|
|
391
|
+
// Each finding a plugin saved: a throw site no test covered, or a property a varied input failed, with the input that showed it and where to ask.
|
|
392
|
+
export const pluginFindings = sqliteTable('plugin_findings', {
|
|
408
393
|
findingKey: text().notNull(),
|
|
409
394
|
kind: text({ enum: findingKinds }).notNull(),
|
|
410
395
|
file: text().notNull(),
|
|
411
396
|
line: integer().notNull(),
|
|
412
397
|
function: text().notNull(),
|
|
413
398
|
input: text().notNull(),
|
|
414
|
-
// The export or property whose
|
|
399
|
+
// The export or property whose search found it, whose next search replaces it; two targets reaching one site each keep their own row.
|
|
415
400
|
target: text().notNull(),
|
|
416
|
-
// The hash of the file the finding asks at when
|
|
401
|
+
// The hash of the file the finding asks at when it was found, so an edit to that file drops the finding until a search finds it again.
|
|
417
402
|
sourceHash: text().notNull(),
|
|
418
|
-
// The plugin that saved it, which its question names
|
|
419
|
-
plugin: text().notNull()
|
|
403
|
+
// The plugin that saved it, which its question names and whose rerun alone replaces it.
|
|
404
|
+
plugin: text().notNull(),
|
|
420
405
|
}, (table) => [
|
|
421
|
-
enumConstraint('
|
|
406
|
+
enumConstraint('plugin_findings_kind_check', table.kind, findingKinds),
|
|
422
407
|
primaryKey({ columns: [table.plugin, table.target, table.findingKey] }),
|
|
423
408
|
]);
|
|
424
409
|
// Each call a test file's baseline made to an exported function, up to the counters' limit per test and export, in the order the calls began: the test that made it, the kept call it ran inside and how many it ran under, its arguments, how it ended and with what, and where a throw came from.
|
|
@@ -516,7 +516,7 @@ export const unitsOf = (source, parsed, paths, unitBase, edits = []) => {
|
|
|
516
516
|
};
|
|
517
517
|
// A test file's code with every function marking itself entered and the file marking itself loaded, through counters imported under names of crush's own, since a test of the counters imports their usual names itself.
|
|
518
518
|
// A function nested in another closes its mark first where both end at once.
|
|
519
|
-
// An exported function's capture wrap holds its entry mark, so it opens before and closes after every mark inside it, which keeps the calls a test makes to
|
|
519
|
+
// An exported function's capture wrap holds its entry mark, so it opens before and closes after every mark inside it, which keeps the calls a test makes to an export of its own file.
|
|
520
520
|
const markedTestOf = (path, source, parsed, entries, counters, justificationMarks) => {
|
|
521
521
|
const capturedMarks = capturedOf(path, parsed, { value: '__crushCaptured', body: '__crushCapturedBody', isExact: true }).flatMap(({ open, close, opening, closing }) => [
|
|
522
522
|
{ at: open, order: -1, text: opening },
|
package/dist/judge/counters.js
CHANGED
|
@@ -430,7 +430,7 @@ export const countersOf = (state) => {
|
|
|
430
430
|
settle(kept.live, 'returned', snapshotOf(result), '');
|
|
431
431
|
return result;
|
|
432
432
|
};
|
|
433
|
-
// Keeps a generator's call by its arguments alone: its body runs as the caller iterates, after the call returns, so no side it takes is its own and its path is cut, which keeps it out of the path checks while
|
|
433
|
+
// Keeps a generator's call by its arguments alone: its body runs as the caller iterates, after the call returns, so no side it takes is its own and its path is cut, which keeps it out of the path checks while a plugin still seeds from it.
|
|
434
434
|
// The generator is called as it is, so its body, its `finally` and its `arguments` stay as they were.
|
|
435
435
|
const __g = (key, args, run) => {
|
|
436
436
|
const kept = state.isCapturing ? begun(key, args) : null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ExportCallOutput } from '../../capture/capture.schema.ts';
|
|
2
|
-
import { type Finding } from '../../
|
|
2
|
+
import { type Finding } from '../../record/edges/findings.db.ts';
|
|
3
3
|
import type { ReachEdgeOutput, ReachNodeOutput } from '../../graph/symbols/symbols.schema.ts';
|
|
4
4
|
import type { CrushError } from '../../utils/errors.ts';
|
|
5
5
|
import { type Safe } from '../../utils/safe.ts';
|
|
6
6
|
export { countedOn, countersOf, limitedRun, state as counters, stateOf, stepLimitOf } from '../counters.ts';
|
|
7
|
-
export {
|
|
7
|
+
export { rootProvideKey } from './vitest.ts';
|
|
8
8
|
export { testFilePattern } from './plugin.ts';
|
|
9
9
|
export { throwLocationOf, uncloned } from '../../capture/capture.operations.ts';
|
|
10
10
|
export { hashOf, unitFieldsOf, unitKeyOf } from '../../record/record.operations.ts';
|
package/dist/judge/edges/api.js
CHANGED
|
@@ -51,7 +51,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
51
51
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
52
|
});
|
|
53
53
|
import { encodedOf, snapshotOf } from '../../capture/capture.operations.js';
|
|
54
|
-
import { setFindings } from '../../
|
|
54
|
+
import { setFindings } from '../../record/edges/findings.db.js';
|
|
55
55
|
import { getExportCalls } from '../../record/edges/calls.db.js';
|
|
56
56
|
import { getPlanCodes } from '../../record/edges/plan.db.js';
|
|
57
57
|
import { getReachEdges, getReachNodes } from '../../record/edges/reach.db.js';
|
|
@@ -60,7 +60,7 @@ import { safe } from '../../utils/safe.js';
|
|
|
60
60
|
import { recordPathOf } from './vitest.js';
|
|
61
61
|
// What another plugin reads and writes of a project's record, as a fuzzer outside crush needs: the captured calls to seed from, the counters to run a call on, and the findings `vp run questions` asks about.
|
|
62
62
|
export { countedOn, countersOf, limitedRun, state as counters, stateOf, stepLimitOf } from '../counters.js';
|
|
63
|
-
export {
|
|
63
|
+
export { rootProvideKey } from './vitest.js';
|
|
64
64
|
export { testFilePattern } from './plugin.js';
|
|
65
65
|
export { throwLocationOf, uncloned } from '../../capture/capture.operations.js';
|
|
66
66
|
export { hashOf, unitFieldsOf, unitKeyOf } from '../../record/record.operations.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relative } from 'node:path';
|
|
2
2
|
import { hintLinesOf } from '../hints.js';
|
|
3
|
-
const commands = new Set(['record', 'judge', 'questions'
|
|
3
|
+
const commands = new Set(['record', 'judge', 'questions']);
|
|
4
4
|
const isHintCommand = (name) => commands.has(name);
|
|
5
5
|
// The hint lines for the crush command this run is, or none for a run of another project.
|
|
6
6
|
export const runHintsOf = ({ ctx, modules, reason }) => {
|
|
@@ -14,7 +14,7 @@ export const runHintsOf = ({ ctx, modules, reason }) => {
|
|
|
14
14
|
const [firstFile = null] = metas.flatMap(({ crushOpenIn }) => (crushOpenIn ? [crushOpenIn] : []));
|
|
15
15
|
return hintLinesOf({ command: project.name, isPassed: reason === 'passed', related, open, firstFile });
|
|
16
16
|
};
|
|
17
|
-
// Ends a
|
|
17
|
+
// Ends a record, judge or questions run with the hint, skill and next-step lines, after Vitest's own report.
|
|
18
18
|
export default class HintsReporter {
|
|
19
19
|
ctx;
|
|
20
20
|
onInit(ctx) {
|
|
@@ -8,7 +8,7 @@ import { type MeasureWrite } from '../../record/edges/record.db.ts';
|
|
|
8
8
|
import type { CrushError } from '../../utils/errors.ts';
|
|
9
9
|
import type { Safe } from '../../utils/safe.ts';
|
|
10
10
|
import type { Candidate, Hold, Judged, Verified } from '../judge.schema.ts';
|
|
11
|
-
import { getFindings } from '../../
|
|
11
|
+
import { getFindings } from '../../record/edges/findings.db.ts';
|
|
12
12
|
export type JudgeEdges = {
|
|
13
13
|
getPlan: (input?: {
|
|
14
14
|
withRewrites?: boolean;
|
|
@@ -43,7 +43,6 @@ export type JudgeEdges = {
|
|
|
43
43
|
getReachEdges: () => ReachEdgeOutput[];
|
|
44
44
|
getExportCalls: () => ExportCallOutput[];
|
|
45
45
|
getFindings: () => ReturnType<typeof getFindings>;
|
|
46
|
-
getSeeds: () => Map<string, unknown[][]>;
|
|
47
46
|
marked: (name: string, work: () => Promise<Error | null>) => Promise<Error | null>;
|
|
48
47
|
settled: () => Promise<Error | null>;
|
|
49
48
|
[Symbol.dispose]: () => void;
|
|
@@ -10,7 +10,7 @@ import { getSiteVerdicts, setSiteVerdicts } from '../../record/edges/site-verdic
|
|
|
10
10
|
import { getReachEdges, getReachNodes } from '../../record/edges/reach.db.js';
|
|
11
11
|
import { openCurrentRecord, openReadOnlyRecord, writeDirectly } from '../../record/edges/record.db.js';
|
|
12
12
|
import { clearVerified, getCheckedCandidatesNullable, getVerified, setVerified } from '../../record/edges/verified.db.js';
|
|
13
|
-
import { getFindings
|
|
13
|
+
import { getFindings } from '../../record/edges/findings.db.js';
|
|
14
14
|
const judgeEdgesOf = (record, write = writeDirectly) => ({
|
|
15
15
|
getPlan: (input) => getPlan(record, input),
|
|
16
16
|
getJudged: (input) => getJudged(record, input),
|
|
@@ -41,7 +41,6 @@ const judgeEdgesOf = (record, write = writeDirectly) => ({
|
|
|
41
41
|
getReachEdges: () => getReachEdges(record),
|
|
42
42
|
getExportCalls: () => getExportCalls(record),
|
|
43
43
|
getFindings: () => getFindings(record),
|
|
44
|
-
getSeeds: () => getSeeds(record),
|
|
45
44
|
marked: (name, work) => marked(record, name, work, undefined, write),
|
|
46
45
|
settled: () => settled(record),
|
|
47
46
|
[Symbol.dispose]: () => record[Symbol.dispose](),
|
|
@@ -3,7 +3,6 @@ import { type MutationSettings, mutationSettingsInput } from '../../instrument/i
|
|
|
3
3
|
import type { RemovableTests } from '../judge.schema.ts';
|
|
4
4
|
import { type ForkPlugin } from '../../forks/forks.schema.ts';
|
|
5
5
|
import { phaseProvideKey } from './vitest.ts';
|
|
6
|
-
import { type ExploreLimits } from '../../explore/limits.operations.ts';
|
|
7
6
|
import type { ProvidedContext } from 'vite-plus/test';
|
|
8
7
|
export declare const nativePattern: RegExp;
|
|
9
8
|
export declare const ungatedPattern: RegExp;
|
|
@@ -66,9 +65,6 @@ type VitestContext = {
|
|
|
66
65
|
};
|
|
67
66
|
defineCacheKeyGenerator?: (generate: () => string) => void;
|
|
68
67
|
};
|
|
69
|
-
type ResolvedConfig = {
|
|
70
|
-
mode: string;
|
|
71
|
-
};
|
|
72
68
|
type Transformed = {
|
|
73
69
|
code: string;
|
|
74
70
|
map: null;
|
|
@@ -85,7 +81,6 @@ type CrushPlugin = {
|
|
|
85
81
|
};
|
|
86
82
|
};
|
|
87
83
|
};
|
|
88
|
-
configResolved: (config: ResolvedConfig) => void;
|
|
89
84
|
watchChange: () => void;
|
|
90
85
|
configureVitest: (context: VitestContext) => Promise<void>;
|
|
91
86
|
transform: (source: string, id: string) => Promise<Transformed>;
|
|
@@ -98,6 +93,10 @@ type CrushProject = {
|
|
|
98
93
|
};
|
|
99
94
|
};
|
|
100
95
|
type DiscoverTests = (project: VitestContext['project']) => Promise<string[]>;
|
|
96
|
+
type PluginRun = {
|
|
97
|
+
name: string;
|
|
98
|
+
coordinator: string;
|
|
99
|
+
};
|
|
101
100
|
type CrushPluginInput = {
|
|
102
101
|
root: string;
|
|
103
102
|
entries: string[];
|
|
@@ -105,10 +104,10 @@ type CrushPluginInput = {
|
|
|
105
104
|
plugins: readonly ForkPlugin[];
|
|
106
105
|
steps: boolean;
|
|
107
106
|
mutation: MutationSettings;
|
|
108
|
-
|
|
107
|
+
plugin: PluginRun | null;
|
|
109
108
|
discoverTests: DiscoverTests;
|
|
110
109
|
};
|
|
111
|
-
export declare const crushPlugin: ({ root, entries, jsx, plugins, steps, mutation,
|
|
110
|
+
export declare const crushPlugin: ({ root, entries, jsx, plugins, steps, mutation, plugin, discoverTests }: CrushPluginInput) => CrushPlugin;
|
|
112
111
|
type Mutation = z.input<typeof mutationSettingsInput>;
|
|
113
112
|
type CrushProjectsInput = {
|
|
114
113
|
root: string;
|
|
@@ -122,7 +121,6 @@ type CrushProjectsInput = {
|
|
|
122
121
|
redundant?: boolean;
|
|
123
122
|
forks?: ForkPlugin[];
|
|
124
123
|
mutation?: Mutation;
|
|
125
|
-
explore?: ExploreLimits;
|
|
126
124
|
};
|
|
127
125
|
export declare const questionsProject: ({ root, include, exclude, removableTests, steps }: CrushProjectsInput) => CrushProject;
|
|
128
126
|
export declare const stressesProject: ({ root }: CrushProjectsInput) => CrushProject;
|
|
@@ -133,6 +131,5 @@ type PluginProjectInput = CrushProjectsInput & {
|
|
|
133
131
|
coordinator: string;
|
|
134
132
|
metaKey: string;
|
|
135
133
|
};
|
|
136
|
-
export declare const pluginProject: ({ name, coordinator, metaKey,
|
|
137
|
-
export declare const exploreProject: ({ root, include, exclude, entries, jsx, removableTests, steps, forks, mutation: written, explore }: CrushProjectsInput) => CrushProject;
|
|
134
|
+
export declare const pluginProject: ({ name, coordinator, metaKey, root, include, exclude, entries, jsx, removableTests, steps, forks, mutation: written }: PluginProjectInput) => CrushProject;
|
|
138
135
|
export {};
|