@whaaaley/crush 0.0.0-stage → 0.2.7
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/LICENSE +32 -0
- package/README.md +185 -2
- package/SKILL.md +187 -0
- package/THIRD_PARTY_NOTICES.md +277 -0
- package/dist/capture/capture.operations.d.ts +23 -0
- package/dist/capture/capture.operations.js +231 -0
- package/dist/capture/capture.schema.d.ts +73 -0
- package/dist/capture/capture.schema.js +28 -0
- package/dist/collapse/collapse.operations.d.ts +2 -0
- package/dist/collapse/collapse.operations.js +82 -0
- package/dist/collapse/collapse.schema.d.ts +40 -0
- package/dist/collapse/collapse.schema.js +35 -0
- package/dist/crush.tables.d.ts +3583 -0
- package/dist/crush.tables.js +456 -0
- package/dist/crushes/callback.crush.d.ts +2 -0
- package/dist/crushes/callback.crush.js +19 -0
- package/dist/crushes/crush.d.ts +36 -0
- package/dist/crushes/crush.js +12 -0
- package/dist/crushes/crush.names.d.ts +1 -0
- package/dist/crushes/crush.names.js +2 -0
- package/dist/crushes/crushes.d.ts +2 -0
- package/dist/crushes/crushes.js +9 -0
- package/dist/crushes/default-value.crush.d.ts +2 -0
- package/dist/crushes/default-value.crush.js +29 -0
- package/dist/crushes/drop-operand.crush.d.ts +2 -0
- package/dist/crushes/drop-operand.crush.js +37 -0
- package/dist/crushes/fold.d.ts +64 -0
- package/dist/crushes/fold.js +366 -0
- package/dist/crushes/force-fork.crush.d.ts +2 -0
- package/dist/crushes/force-fork.crush.js +79 -0
- package/dist/crushes/loop-once.crush.d.ts +2 -0
- package/dist/crushes/loop-once.crush.js +71 -0
- package/dist/crushes/optional-chain.crush.d.ts +2 -0
- package/dist/crushes/optional-chain.crush.js +30 -0
- package/dist/crushes/switch-case.crush.d.ts +2 -0
- package/dist/crushes/switch-case.crush.js +19 -0
- package/dist/decisions/decide.d.ts +61 -0
- package/dist/decisions/decide.js +161 -0
- package/dist/decisions/decisions.d.ts +24 -0
- package/dist/decisions/decisions.js +62 -0
- package/dist/decisions/forks.decision.d.ts +4 -0
- package/dist/decisions/forks.decision.js +32 -0
- package/dist/decisions/kinds.d.ts +101 -0
- package/dist/decisions/kinds.js +38 -0
- package/dist/decisions/loops.decision.d.ts +4 -0
- package/dist/decisions/loops.decision.js +39 -0
- package/dist/decisions/shorts.decision.d.ts +3 -0
- package/dist/decisions/shorts.decision.js +66 -0
- package/dist/decisions/switches.decision.d.ts +3 -0
- package/dist/decisions/switches.decision.js +20 -0
- package/dist/decisions/throws.decision.d.ts +3 -0
- package/dist/decisions/throws.decision.js +35 -0
- package/dist/decisions/values.decision.d.ts +3 -0
- package/dist/decisions/values.decision.js +67 -0
- package/dist/explore/edges/explore.d.ts +60 -0
- package/dist/explore/edges/explore.db.d.ts +22 -0
- package/dist/explore/edges/explore.db.js +55 -0
- package/dist/explore/edges/explore.js +305 -0
- package/dist/explore/edges/random.d.ts +2 -0
- package/dist/explore/edges/random.js +32 -0
- package/dist/explore/explore.operations.d.ts +30 -0
- package/dist/explore/explore.operations.js +117 -0
- package/dist/explore/limits.operations.d.ts +14 -0
- package/dist/explore/limits.operations.js +20 -0
- package/dist/explore/targets.operations.d.ts +36 -0
- package/dist/explore/targets.operations.js +32 -0
- package/dist/explore/utils/draws.d.ts +6 -0
- package/dist/explore/utils/draws.js +2 -0
- package/dist/explore/utils/edits.d.ts +15 -0
- package/dist/explore/utils/edits.js +151 -0
- package/dist/explore/utils/guide.d.ts +23 -0
- package/dist/explore/utils/guide.js +35 -0
- package/dist/explore/utils/keep.d.ts +10 -0
- package/dist/explore/utils/keep.js +61 -0
- package/dist/explore/utils/pools.d.ts +17 -0
- package/dist/explore/utils/pools.js +121 -0
- package/dist/explore/utils/reads.d.ts +19 -0
- package/dist/explore/utils/reads.js +118 -0
- package/dist/explore/utils/twin.d.ts +21 -0
- package/dist/explore/utils/twin.js +55 -0
- package/dist/forks/forks.operations.d.ts +32 -0
- package/dist/forks/forks.operations.js +134 -0
- package/dist/forks/forks.schema.d.ts +20 -0
- package/dist/forks/forks.schema.js +14 -0
- package/dist/graph/cfg/cfg.d.ts +28 -0
- package/dist/graph/cfg/cfg.js +31 -0
- package/dist/graph/cfg/code-paths/analyzer.d.ts +27 -0
- package/dist/graph/cfg/code-paths/analyzer.js +358 -0
- package/dist/graph/cfg/code-paths/segments.d.ts +44 -0
- package/dist/graph/cfg/code-paths/segments.js +105 -0
- package/dist/graph/cfg/code-paths/state.d.ts +121 -0
- package/dist/graph/cfg/code-paths/state.js +611 -0
- package/dist/graph/cfg/entries.d.ts +13 -0
- package/dist/graph/cfg/entries.js +120 -0
- package/dist/graph/cfg/functions.d.ts +6 -0
- package/dist/graph/cfg/functions.js +47 -0
- package/dist/graph/cfg/paths.d.ts +27 -0
- package/dist/graph/cfg/paths.js +91 -0
- package/dist/graph/cfg/scopes/scopes.d.ts +40 -0
- package/dist/graph/cfg/scopes/scopes.js +375 -0
- package/dist/graph/symbols/file.d.ts +90 -0
- package/dist/graph/symbols/file.js +427 -0
- package/dist/graph/symbols/keys.d.ts +13 -0
- package/dist/graph/symbols/keys.js +22 -0
- package/dist/graph/symbols/resolve.operations.d.ts +4 -0
- package/dist/graph/symbols/resolve.operations.js +33 -0
- package/dist/graph/symbols/symbols.d.ts +12 -0
- package/dist/graph/symbols/symbols.js +155 -0
- package/dist/graph/symbols/symbols.schema.d.ts +32 -0
- package/dist/graph/symbols/symbols.schema.js +19 -0
- package/dist/graph/unused/tests.d.ts +7 -0
- package/dist/graph/unused/tests.js +95 -0
- package/dist/graph/unused/unused.d.ts +53 -0
- package/dist/graph/unused/unused.js +319 -0
- package/dist/graph/walk/walk.d.ts +7 -0
- package/dist/graph/walk/walk.js +39 -0
- package/dist/instrument/instrument.operations.d.ts +72 -0
- package/dist/instrument/instrument.operations.js +786 -0
- package/dist/instrument/instrument.schema.d.ts +257 -0
- package/dist/instrument/instrument.schema.js +100 -0
- package/dist/judge/counters.d.ts +86 -0
- package/dist/judge/counters.js +402 -0
- package/dist/judge/edges/api.d.ts +14 -0
- package/dist/judge/edges/api.js +80 -0
- package/dist/judge/edges/completion.reporter.d.ts +9 -0
- package/dist/judge/edges/completion.reporter.js +51 -0
- package/dist/judge/edges/hints.reporter.d.ts +13 -0
- package/dist/judge/edges/hints.reporter.js +29 -0
- package/dist/judge/edges/judge.edges.d.ts +52 -0
- package/dist/judge/edges/judge.edges.js +59 -0
- package/dist/judge/edges/judge.fs.d.ts +8 -0
- package/dist/judge/edges/judge.fs.js +45 -0
- package/dist/judge/edges/merge.d.ts +11 -0
- package/dist/judge/edges/merge.js +60 -0
- package/dist/judge/edges/plugin.d.ts +132 -0
- package/dist/judge/edges/plugin.js +441 -0
- package/dist/judge/edges/reach.d.ts +68 -0
- package/dist/judge/edges/reach.js +132 -0
- package/dist/judge/edges/speed.d.ts +32 -0
- package/dist/judge/edges/speed.js +34 -0
- package/dist/judge/edges/strays.d.ts +1 -0
- package/dist/judge/edges/strays.js +14 -0
- package/dist/judge/edges/vitest.d.ts +20 -0
- package/dist/judge/edges/vitest.js +36 -0
- package/dist/judge/edges/vitest.schema.d.ts +14 -0
- package/dist/judge/edges/vitest.schema.js +16 -0
- package/dist/judge/explore.test.d.ts +1 -0
- package/dist/judge/explore.test.js +101 -0
- package/dist/judge/hints.d.ts +11 -0
- package/dist/judge/hints.js +44 -0
- package/dist/judge/judge.operations.d.ts +218 -0
- package/dist/judge/judge.operations.js +464 -0
- package/dist/judge/judge.schema.d.ts +135 -0
- package/dist/judge/judge.schema.js +129 -0
- package/dist/judge/judge.shard-1.test.d.ts +1 -0
- package/dist/judge/judge.shard-1.test.js +3 -0
- package/dist/judge/judge.shard-2.test.d.ts +1 -0
- package/dist/judge/judge.shard-2.test.js +3 -0
- package/dist/judge/judge.test.d.ts +1 -0
- package/dist/judge/judge.test.js +3 -0
- package/dist/judge/refusals.d.ts +14 -0
- package/dist/judge/refusals.js +10 -0
- package/dist/judge/report.test.d.ts +1 -0
- package/dist/judge/report.test.js +432 -0
- package/dist/judge/runner.d.ts +3 -0
- package/dist/judge/runner.js +1602 -0
- package/dist/judge/stresses.test.d.ts +1 -0
- package/dist/judge/stresses.test.js +12 -0
- package/dist/judge/task-meta.d.ts +14 -0
- package/dist/judge/task-meta.js +1 -0
- package/dist/justify/edges/load.d.ts +7 -0
- package/dist/justify/edges/load.js +40 -0
- package/dist/justify/edges/refresh.fs.d.ts +8 -0
- package/dist/justify/edges/refresh.fs.js +15 -0
- package/dist/justify/justify.operations.d.ts +46 -0
- package/dist/justify/justify.operations.js +80 -0
- package/dist/justify/justify.schema.d.ts +21 -0
- package/dist/justify/justify.schema.js +11 -0
- package/dist/mutators/arithmetic-operator.mutator.d.ts +2 -0
- package/dist/mutators/arithmetic-operator.mutator.js +22 -0
- package/dist/mutators/array-declaration.mutator.d.ts +2 -0
- package/dist/mutators/array-declaration.mutator.js +12 -0
- package/dist/mutators/arrow-function.mutator.d.ts +2 -0
- package/dist/mutators/arrow-function.mutator.js +10 -0
- package/dist/mutators/assignment-operator.mutator.d.ts +2 -0
- package/dist/mutators/assignment-operator.mutator.js +29 -0
- package/dist/mutators/await-expression.mutator.d.ts +2 -0
- package/dist/mutators/await-expression.mutator.js +7 -0
- package/dist/mutators/bitwise-operator.mutator.d.ts +2 -0
- package/dist/mutators/bitwise-operator.mutator.js +19 -0
- package/dist/mutators/block-statement.mutator.d.ts +2 -0
- package/dist/mutators/block-statement.mutator.js +30 -0
- package/dist/mutators/boolean-literal.mutator.d.ts +2 -0
- package/dist/mutators/boolean-literal.mutator.js +5 -0
- package/dist/mutators/coercion.mutator.d.ts +2 -0
- package/dist/mutators/coercion.mutator.js +28 -0
- package/dist/mutators/conditional-expression.mutator.d.ts +2 -0
- package/dist/mutators/conditional-expression.mutator.js +36 -0
- package/dist/mutators/disposal.mutator.d.ts +2 -0
- package/dist/mutators/disposal.mutator.js +13 -0
- package/dist/mutators/empty-destructuring.mutator.d.ts +2 -0
- package/dist/mutators/empty-destructuring.mutator.js +35 -0
- package/dist/mutators/empty-return.mutator.d.ts +2 -0
- package/dist/mutators/empty-return.mutator.js +35 -0
- package/dist/mutators/equality-operator.mutator.d.ts +2 -0
- package/dist/mutators/equality-operator.mutator.js +16 -0
- package/dist/mutators/loop-exit.mutator.d.ts +2 -0
- package/dist/mutators/loop-exit.mutator.js +5 -0
- package/dist/mutators/method-expression.mutator.d.ts +2 -0
- package/dist/mutators/method-expression.mutator.js +59 -0
- package/dist/mutators/missing-lookup.mutator.d.ts +2 -0
- package/dist/mutators/missing-lookup.mutator.js +25 -0
- package/dist/mutators/mutator.d.ts +40 -0
- package/dist/mutators/mutator.js +49 -0
- package/dist/mutators/mutator.names.d.ts +3 -0
- package/dist/mutators/mutator.names.js +43 -0
- package/dist/mutators/mutators.d.ts +8 -0
- package/dist/mutators/mutators.js +84 -0
- package/dist/mutators/nested-condition.mutator.d.ts +2 -0
- package/dist/mutators/nested-condition.mutator.js +16 -0
- package/dist/mutators/number-literal.mutator.d.ts +3 -0
- package/dist/mutators/number-literal.mutator.js +13 -0
- package/dist/mutators/object-literal.mutator.d.ts +2 -0
- package/dist/mutators/object-literal.mutator.js +6 -0
- package/dist/mutators/odd-number.mutator.d.ts +2 -0
- package/dist/mutators/odd-number.mutator.js +15 -0
- package/dist/mutators/operand-deletion.mutator.d.ts +2 -0
- package/dist/mutators/operand-deletion.mutator.js +9 -0
- package/dist/mutators/outcome.mutator.d.ts +3 -0
- package/dist/mutators/outcome.mutator.js +45 -0
- package/dist/mutators/plain-assignment.mutator.d.ts +2 -0
- package/dist/mutators/plain-assignment.mutator.js +7 -0
- package/dist/mutators/power-operator.mutator.d.ts +2 -0
- package/dist/mutators/power-operator.mutator.js +13 -0
- package/dist/mutators/private-brand.mutator.d.ts +2 -0
- package/dist/mutators/private-brand.mutator.js +7 -0
- package/dist/mutators/regex.mutator.d.ts +2 -0
- package/dist/mutators/regex.mutator.js +29 -0
- package/dist/mutators/short-iteration.mutator.d.ts +2 -0
- package/dist/mutators/short-iteration.mutator.js +8 -0
- package/dist/mutators/string-literal.mutator.d.ts +3 -0
- package/dist/mutators/string-literal.mutator.js +149 -0
- package/dist/mutators/switch-default.mutator.d.ts +2 -0
- package/dist/mutators/switch-default.mutator.js +13 -0
- package/dist/mutators/sync-iteration.mutator.d.ts +3 -0
- package/dist/mutators/sync-iteration.mutator.js +9 -0
- package/dist/mutators/thrown-call.mutator.d.ts +2 -0
- package/dist/mutators/thrown-call.mutator.js +7 -0
- package/dist/mutators/unary-operator.mutator.d.ts +2 -0
- package/dist/mutators/unary-operator.mutator.js +18 -0
- package/dist/mutators/unbound-call.mutator.d.ts +2 -0
- package/dist/mutators/unbound-call.mutator.js +14 -0
- package/dist/mutators/update-operator.mutator.d.ts +2 -0
- package/dist/mutators/update-operator.mutator.js +15 -0
- package/dist/mutators/yield-value.mutator.d.ts +2 -0
- package/dist/mutators/yield-value.mutator.js +7 -0
- package/dist/parity/compare.d.ts +27 -0
- package/dist/parity/compare.js +26 -0
- package/dist/parity/corpus.parity.d.ts +1 -0
- package/dist/parity/corpus.parity.js +97 -0
- package/dist/parity/edges/corpus.fs.d.ts +3 -0
- package/dist/parity/edges/corpus.fs.js +30 -0
- package/dist/parity/edges/ports.d.ts +2 -0
- package/dist/parity/edges/ports.js +21 -0
- package/dist/parity/edges/vitest.d.ts +2 -0
- package/dist/parity/edges/vitest.js +3 -0
- package/dist/parity/parity.operations.d.ts +33 -0
- package/dist/parity/parity.operations.js +60 -0
- package/dist/parity/parity.schema.d.ts +5 -0
- package/dist/parity/parity.schema.js +6 -0
- package/dist/parity/stryker/compare.d.ts +14 -0
- package/dist/parity/stryker/compare.js +52 -0
- package/dist/parity/stryker/edges/ports.d.ts +12 -0
- package/dist/parity/stryker/edges/ports.js +28 -0
- package/dist/parity/stryker/equivalence.d.ts +1 -0
- package/dist/parity/stryker/equivalence.js +42 -0
- package/dist/parity/stryker/intended.d.ts +29 -0
- package/dist/parity/stryker/intended.js +152 -0
- package/dist/parity/stryker/normalize.d.ts +27 -0
- package/dist/parity/stryker/normalize.js +181 -0
- package/dist/parity/stryker/rules.d.ts +6 -0
- package/dist/parity/stryker/rules.js +116 -0
- package/dist/parity/stryker/sides.d.ts +46 -0
- package/dist/parity/stryker/sides.js +199 -0
- package/dist/parity/stryker/stryker.parity.d.ts +1 -0
- package/dist/parity/stryker/stryker.parity.js +147 -0
- package/dist/parity/stryker/stryker.schema.d.ts +6 -0
- package/dist/parity/stryker/stryker.schema.js +7 -0
- package/dist/parity/views.d.ts +21 -0
- package/dist/parity/views.js +119 -0
- package/dist/questions/questions.operations.d.ts +110 -0
- package/dist/questions/questions.operations.js +446 -0
- package/dist/questions/questions.schema.d.ts +57 -0
- package/dist/questions/questions.schema.js +28 -0
- package/dist/record/edges/calls.db.d.ts +10 -0
- package/dist/record/edges/calls.db.js +91 -0
- package/dist/record/edges/hits.db.d.ts +3 -0
- package/dist/record/edges/hits.db.js +5 -0
- package/dist/record/edges/holds.db.d.ts +4 -0
- package/dist/record/edges/holds.db.js +31 -0
- package/dist/record/edges/judged-state.db.d.ts +5 -0
- package/dist/record/edges/judged-state.db.js +25 -0
- package/dist/record/edges/markers.db.d.ts +11 -0
- package/dist/record/edges/markers.db.js +55 -0
- package/dist/record/edges/merge.db.d.ts +7 -0
- package/dist/record/edges/merge.db.js +46 -0
- package/dist/record/edges/parts.db.d.ts +42 -0
- package/dist/record/edges/parts.db.js +389 -0
- package/dist/record/edges/parts.edges.d.ts +2 -0
- package/dist/record/edges/parts.edges.js +7 -0
- package/dist/record/edges/parts.fs.d.ts +1 -0
- package/dist/record/edges/parts.fs.js +11 -0
- package/dist/record/edges/parts.writer.d.ts +1 -0
- package/dist/record/edges/parts.writer.js +85 -0
- package/dist/record/edges/passes.db.d.ts +19 -0
- package/dist/record/edges/passes.db.js +31 -0
- package/dist/record/edges/plan.db.d.ts +21 -0
- package/dist/record/edges/plan.db.js +174 -0
- package/dist/record/edges/reach.db.d.ts +6 -0
- package/dist/record/edges/reach.db.js +62 -0
- package/dist/record/edges/record.db.d.ts +22 -0
- package/dist/record/edges/record.db.js +176 -0
- package/dist/record/edges/record.fs.d.ts +3 -0
- package/dist/record/edges/record.fs.js +7 -0
- package/dist/record/edges/site-verdicts.db.d.ts +11 -0
- package/dist/record/edges/site-verdicts.db.js +66 -0
- package/dist/record/edges/verified.db.d.ts +7 -0
- package/dist/record/edges/verified.db.js +71 -0
- package/dist/record/parts.operations.d.ts +26 -0
- package/dist/record/parts.operations.js +31 -0
- package/dist/record/path-checks.operations.d.ts +15 -0
- package/dist/record/path-checks.operations.js +84 -0
- package/dist/record/record.operations.d.ts +36 -0
- package/dist/record/record.operations.js +11 -0
- package/dist/stresses/edges/stresses.record.d.ts +4 -0
- package/dist/stresses/edges/stresses.record.js +37 -0
- package/dist/stresses/stresses.operations.d.ts +28 -0
- package/dist/stresses/stresses.operations.js +22 -0
- package/dist/utils/ast.d.ts +55 -0
- package/dist/utils/ast.js +181 -0
- package/dist/utils/errors.d.ts +8 -0
- package/dist/utils/errors.js +12 -0
- package/dist/utils/faults.d.ts +6 -0
- package/dist/utils/faults.js +10 -0
- package/dist/utils/lookup.d.ts +4 -0
- package/dist/utils/lookup.js +27 -0
- package/dist/utils/order.d.ts +2 -0
- package/dist/utils/order.js +17 -0
- package/dist/utils/retry.d.ts +14 -0
- package/dist/utils/retry.js +15 -0
- package/dist/utils/safe.d.ts +11 -0
- package/dist/utils/safe.js +31 -0
- package/migrations/main/20261129123324_initial/migration.sql +418 -0
- package/migrations/main/20261129123324_initial/snapshot.json +3641 -0
- package/package.json +89 -4
- package/references/consumer-setup.md +92 -0
- package/src/graph/cfg/code-paths/LICENSE +21 -0
- package/src/graph/cfg/scopes/LICENSE +24 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getExportCalls } from '../../record/edges/calls.db.js';
|
|
2
|
+
import { marked, settled } from '../../record/edges/markers.db.js';
|
|
3
|
+
import { getCandidates, getMergeBasis, setCandidates } from '../../record/edges/merge.db.js';
|
|
4
|
+
import { getHolds, setHolds } from '../../record/edges/holds.db.js';
|
|
5
|
+
import { clearRecordedState, getRecordedStateNullable, setJudgedState } from '../../record/edges/judged-state.db.js';
|
|
6
|
+
import { clearFileFailure, setFileFailure, clearJudged, getJudged, getNextGeneration, getPartIsAllReusedNullable, getPartStampNullable, setJudged } from '../../record/edges/parts.db.js';
|
|
7
|
+
import { passEnded, setPassEnded } from '../../record/edges/passes.db.js';
|
|
8
|
+
import { getPlan } from '../../record/edges/plan.db.js';
|
|
9
|
+
import { getSiteVerdicts, setSiteVerdicts } from '../../record/edges/site-verdicts.db.js';
|
|
10
|
+
import { getReachEdges, getReachNodes } from '../../record/edges/reach.db.js';
|
|
11
|
+
import { openCurrentRecord, openReadOnlyRecord, writeDirectly } from '../../record/edges/record.db.js';
|
|
12
|
+
import { clearVerified, getCheckedCandidatesNullable, getVerified, setVerified } from '../../record/edges/verified.db.js';
|
|
13
|
+
import { getFindings, getSeeds } from '../../explore/edges/explore.db.js';
|
|
14
|
+
const judgeEdgesOf = (record, write = writeDirectly) => ({
|
|
15
|
+
getPlan: (input) => getPlan(record, input),
|
|
16
|
+
getJudged: (input) => getJudged(record, input),
|
|
17
|
+
getPartStampNullable: (path) => getPartStampNullable(record, path),
|
|
18
|
+
getPartIsAllReusedNullable: (path) => getPartIsAllReusedNullable(record, path),
|
|
19
|
+
getNextGeneration: (path) => getNextGeneration(record, path),
|
|
20
|
+
getSiteVerdicts: (keys) => getSiteVerdicts(record, keys),
|
|
21
|
+
setSiteVerdicts: (verdicts) => write(() => setSiteVerdicts(record, verdicts)),
|
|
22
|
+
getRecordedStateNullable: () => getRecordedStateNullable(record),
|
|
23
|
+
setJudgedState: (hash) => write(() => setJudgedState(record, hash)),
|
|
24
|
+
clearRecordedState: () => write(() => clearRecordedState(record)),
|
|
25
|
+
setPassEnded: (input) => write(() => setPassEnded(record, input)),
|
|
26
|
+
passEnded: (input) => passEnded(record, input),
|
|
27
|
+
setJudged: (judged, captured) => write(() => setJudged(record, judged, captured)),
|
|
28
|
+
clearJudged: (path) => write(() => clearJudged(record, path)),
|
|
29
|
+
clearFileFailure: (path, ranTests) => write(() => clearFileFailure(record, path, ranTests)),
|
|
30
|
+
setFileFailure: (path, failure) => write(() => setFileFailure(record, path, failure)),
|
|
31
|
+
getVerified: () => getVerified(record),
|
|
32
|
+
getCheckedCandidatesNullable: (path) => getCheckedCandidatesNullable(record, path),
|
|
33
|
+
setVerified: (verified) => write(() => setVerified(record, verified)),
|
|
34
|
+
clearVerified: (path) => write(() => clearVerified(record, path)),
|
|
35
|
+
getCandidates: () => getCandidates(record),
|
|
36
|
+
setCandidates: (list, basis) => write(() => setCandidates(record, list, basis)),
|
|
37
|
+
getMergeBasis: () => getMergeBasis(record),
|
|
38
|
+
getHolds: () => getHolds(record),
|
|
39
|
+
setHolds: (held) => write(() => setHolds(record, held)),
|
|
40
|
+
getReachNodes: () => getReachNodes(record),
|
|
41
|
+
getReachEdges: () => getReachEdges(record),
|
|
42
|
+
getExportCalls: () => getExportCalls(record),
|
|
43
|
+
getFindings: () => getFindings(record),
|
|
44
|
+
getSeeds: () => getSeeds(record),
|
|
45
|
+
marked: (name, work) => marked(record, name, work, undefined, write),
|
|
46
|
+
settled: () => settled(record),
|
|
47
|
+
[Symbol.dispose]: () => record[Symbol.dispose](),
|
|
48
|
+
});
|
|
49
|
+
export const readJudgeEdges = (path) => {
|
|
50
|
+
const { data: record, error } = openReadOnlyRecord(path);
|
|
51
|
+
return error ? { data: null, error } : { data: judgeEdgesOf(record), error: null };
|
|
52
|
+
};
|
|
53
|
+
// The edges over a record another process already opened, as a test file's worker reaches it, refusing one of another version or none at all.
|
|
54
|
+
export const openCurrentJudgeEdges = (path, write) => {
|
|
55
|
+
const { data: record, error } = openCurrentRecord(path);
|
|
56
|
+
if (error)
|
|
57
|
+
return { data: null, error };
|
|
58
|
+
return { data: judgeEdgesOf(record, write), error: null };
|
|
59
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const hasRefusal: (root: string) => boolean;
|
|
2
|
+
export declare const markRefusal: (root: string) => void;
|
|
3
|
+
export declare const clearRefusal: (root: string) => void;
|
|
4
|
+
export declare const readJudgeSource: (root: string, path: string) => string;
|
|
5
|
+
export declare const readJudgeSourceNullable: (root: string, path: string) => string | null;
|
|
6
|
+
export declare const readJudgeSources: (root: string, paths: Iterable<string>) => Promise<Map<string, string>>;
|
|
7
|
+
export declare const pathsIn: (root: string, folder: string, isKept: (path: string) => boolean, skipsName?: (name: string) => boolean) => string[];
|
|
8
|
+
export declare const resolveEntryPaths: (root: string, entries: string[]) => string[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { existsSync, globSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { join, relative } from 'node:path';
|
|
4
|
+
import { crushFolderOf, refusedMarkerOf } from './vitest.js';
|
|
5
|
+
const refusalPath = (root) => refusedMarkerOf(crushFolderOf(root));
|
|
6
|
+
export const hasRefusal = (root) => existsSync(refusalPath(root));
|
|
7
|
+
export const markRefusal = (root) => writeFileSync(refusalPath(root), '');
|
|
8
|
+
export const clearRefusal = (root) => rmSync(refusalPath(root), { force: true });
|
|
9
|
+
export const readJudgeSource = (root, path) => readFileSync(join(root, path), 'utf8');
|
|
10
|
+
export const readJudgeSourceNullable = (root, path) => {
|
|
11
|
+
const file = join(root, path);
|
|
12
|
+
return statSync(file, { throwIfNoEntry: false })?.isFile() ? readFileSync(file, 'utf8') : null;
|
|
13
|
+
};
|
|
14
|
+
// Keep descriptor use bounded even when a project contains thousands of files.
|
|
15
|
+
const sourceReadBatchSize = 32;
|
|
16
|
+
export const readJudgeSources = async (root, paths) => {
|
|
17
|
+
const unique = [...new Set(paths)];
|
|
18
|
+
const sources = new Map();
|
|
19
|
+
for (let at = 0; at < unique.length; at += sourceReadBatchSize) {
|
|
20
|
+
const batch = unique.slice(at, at + sourceReadBatchSize);
|
|
21
|
+
// oxlint-disable-next-line no-await-in-loop -- the next batch must wait to keep descriptor use bounded
|
|
22
|
+
const texts = await Promise.all(batch.map(async (path) => [path, await readFile(join(root, path), 'utf8')]));
|
|
23
|
+
for (const [path, text] of texts)
|
|
24
|
+
sources.set(path, text);
|
|
25
|
+
}
|
|
26
|
+
return sources;
|
|
27
|
+
};
|
|
28
|
+
// The project's own folders crush never reads for sources: its dependencies, its working files and every hidden folder.
|
|
29
|
+
const isSkipped = (name) => name === 'node_modules' || name.startsWith('.');
|
|
30
|
+
// Every project file under a folder that a test keeps, by its path from the root, in path order.
|
|
31
|
+
// A folder below the root holding its own `.git`, a submodule or a nested repository, is another project its own repo tests, so its files are left out.
|
|
32
|
+
export const pathsIn = (root, folder, isKept, skipsName) => {
|
|
33
|
+
return readdirSync(folder)
|
|
34
|
+
.toSorted()
|
|
35
|
+
.flatMap((name) => {
|
|
36
|
+
if (isSkipped(name) || skipsName?.(name))
|
|
37
|
+
return [];
|
|
38
|
+
const path = join(folder, name);
|
|
39
|
+
if (statSync(path).isDirectory())
|
|
40
|
+
return existsSync(join(path, '.git')) ? [] : pathsIn(root, path, isKept, skipsName);
|
|
41
|
+
const at = relative(root, path);
|
|
42
|
+
return isKept(at) ? [at] : [];
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export const resolveEntryPaths = (root, entries) => globSync(entries, { cwd: root });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CrushError } from '../../utils/errors.ts';
|
|
2
|
+
import type { Safe } from '../../utils/safe.ts';
|
|
3
|
+
import type { JudgeEdges } from './judge.edges.ts';
|
|
4
|
+
type Merge = {
|
|
5
|
+
candidates: number;
|
|
6
|
+
held: number;
|
|
7
|
+
justified: number;
|
|
8
|
+
saveHolds: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const mergeJudged: (edges: JudgeEdges, root: string) => Safe<Merge, CrushError>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { collapsedOf } from '../../collapse/collapse.operations.js';
|
|
4
|
+
import { readJustifications } from '../../justify/edges/load.js';
|
|
5
|
+
import { justifiedOf } from '../../justify/justify.operations.js';
|
|
6
|
+
import { siteQuestionsOf } from '../../questions/questions.operations.js';
|
|
7
|
+
import { hashOf } from '../../record/record.operations.js';
|
|
8
|
+
import { failed } from '../../utils/errors.js';
|
|
9
|
+
import { candidatesHashOf, candidatesOf, functionsOf, heldAfter, holdBasisOf, judgedSitesOf, mergedOf, verdictBasesOf } from '../judge.operations.js';
|
|
10
|
+
import { crushFolderOf, refusedMarkerOf } from './vitest.js';
|
|
11
|
+
// The crushes collapse may apply together, which the joint check then forces in each test file.
|
|
12
|
+
export const mergeJudged = (edges, root) => {
|
|
13
|
+
if (existsSync(refusedMarkerOf(crushFolderOf(root))))
|
|
14
|
+
return failed('the judge phase was refused, so this run has no parts to merge');
|
|
15
|
+
const plan = edges.getPlan();
|
|
16
|
+
const runs = edges.getJudged({ withHits: false });
|
|
17
|
+
const merged = mergedOf(runs.map(({ verdicts }) => verdicts));
|
|
18
|
+
const statusOf = new Map([...merged].map(([key, { status }]) => [key, status]));
|
|
19
|
+
// A hold an edit lifted is lifted here, before verify, so its crush is a candidate again unless a wider crush takes its point, and the report holds it back again if a test still fails with it.
|
|
20
|
+
// A lifted hold's old evidence is stale: the crush is judged against the tests that exist now.
|
|
21
|
+
const basis = holdBasisOf({ sources: plan.files, tests: runs });
|
|
22
|
+
const held = new Set(heldAfter(edges.getHolds(), [], statusOf, () => basis).map(({ key }) => key));
|
|
23
|
+
const crushes = plan.files.flatMap(({ crushes: each }) => each.map(({ key, point, forced, start, edits }) => ({ key, point, forced, start, edits: edits.map(({ start: from, end }) => ({ start: from, end })) })));
|
|
24
|
+
// A justified crush stays in the code, so collapse never applies it and verify never forces it.
|
|
25
|
+
const { all } = siteQuestionsOf(judgedSitesOf(plan.files, merged), held, new Set(), functionsOf(plan.files, runs));
|
|
26
|
+
const { data: entries, error: justifyError } = readJustifications(runs);
|
|
27
|
+
if (justifyError)
|
|
28
|
+
return { data: null, error: justifyError };
|
|
29
|
+
const { accepted } = justifiedOf({ entries, questions: all, sourceHashes: new Map(plan.files.map(({ path, hash }) => [path, hash])), bases: verdictBasesOf(runs) });
|
|
30
|
+
const acceptedIds = new Set(accepted.map(({ id }) => id));
|
|
31
|
+
const justified = new Set(all.filter(({ id, kind }) => kind === 'crush' && acceptedIds.has(id)).flatMap(({ sites }) => sites));
|
|
32
|
+
const candidates = candidatesOf(crushes, statusOf, held.union(justified));
|
|
33
|
+
// The report rests its holds on the basis this phase chose candidates under, since a source edited mid-run changes the plan between them.
|
|
34
|
+
edges.setCandidates(candidates, basis);
|
|
35
|
+
const saveHolds = () => {
|
|
36
|
+
const candidateHash = candidatesHashOf(candidates);
|
|
37
|
+
const drops = edges
|
|
38
|
+
.getVerified()
|
|
39
|
+
.filter(({ candidates: checked }) => checked === candidateHash)
|
|
40
|
+
.flatMap(({ dropped }) => dropped);
|
|
41
|
+
const dropped = new Set(drops.map(({ key }) => key));
|
|
42
|
+
const falling = new Set(candidates.filter(({ key }) => !dropped.has(key)).map(({ key }) => key));
|
|
43
|
+
const clashes = plan.files.flatMap(({ path, hash, crushes }) => {
|
|
44
|
+
const fallen = crushes.filter(({ key }) => falling.has(key));
|
|
45
|
+
const file = join(root, path);
|
|
46
|
+
if (!fallen.length || !existsSync(file))
|
|
47
|
+
return [];
|
|
48
|
+
const source = readFileSync(file, 'utf8');
|
|
49
|
+
if (hashOf(source) !== hash)
|
|
50
|
+
return [];
|
|
51
|
+
const collapse = collapsedOf({ path, source, fallen: fallen.map(({ edits, dedents }) => ({ edits, dedents })) });
|
|
52
|
+
return [...collapse.clashed, ...collapse.broken].flatMap((index) => {
|
|
53
|
+
const key = fallen[index]?.key;
|
|
54
|
+
return key ? [{ key, tests: [] }] : [];
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
edges.setHolds(heldAfter(edges.getHolds(), [...drops, ...clashes], statusOf, () => basis));
|
|
58
|
+
};
|
|
59
|
+
return { data: { candidates: candidates.length, held: held.size, justified: justified.size, saveHolds }, error: null };
|
|
60
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type MutationSettings, mutationSettingsInput } from '../../instrument/instrument.schema.ts';
|
|
3
|
+
import type { RemovableTests } from '../judge.schema.ts';
|
|
4
|
+
import { type ForkPlugin } from '../../forks/forks.schema.ts';
|
|
5
|
+
import { phaseProvideKey } from './vitest.ts';
|
|
6
|
+
import { type ExploreLimits } from '../../explore/limits.operations.ts';
|
|
7
|
+
import type { ProvidedContext } from 'vite-plus/test';
|
|
8
|
+
export declare const nativePattern: RegExp;
|
|
9
|
+
export declare const ungatedPattern: RegExp;
|
|
10
|
+
export declare const testFilePattern: RegExp;
|
|
11
|
+
export declare const sourcePattern: RegExp;
|
|
12
|
+
export declare const configFilePattern: RegExp;
|
|
13
|
+
export declare const leavesUninstrumented: (path: string) => boolean;
|
|
14
|
+
export declare const markedOutside: (source: string, path: string, counters: string) => string;
|
|
15
|
+
export declare const sourcesIn: (root: string, folder: string, jsx: boolean) => string[];
|
|
16
|
+
type Planned = {
|
|
17
|
+
byPath: Map<string, {
|
|
18
|
+
code: string;
|
|
19
|
+
plan: {
|
|
20
|
+
hash: string;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
hash: string;
|
|
24
|
+
cached: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const planKeyOf: (byPath: Planned['byPath']) => string;
|
|
27
|
+
export declare const relativeImportPattern: RegExp;
|
|
28
|
+
export declare const toolSourcesIn: (folder: string) => string[];
|
|
29
|
+
export declare const toolHashIn: (folder: string) => string;
|
|
30
|
+
export declare const toolHashOf: () => string;
|
|
31
|
+
type PluginContainer = {
|
|
32
|
+
resolveId: (id: string, importer: string, options: {
|
|
33
|
+
ssr: boolean;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
id: string;
|
|
36
|
+
} | null>;
|
|
37
|
+
};
|
|
38
|
+
type VitestContext = {
|
|
39
|
+
vitest: {
|
|
40
|
+
config: {
|
|
41
|
+
related?: string[];
|
|
42
|
+
sequence: {
|
|
43
|
+
seed: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
onClose: (work: () => Promise<void>) => void;
|
|
47
|
+
state: {
|
|
48
|
+
getFiles: () => {
|
|
49
|
+
filepath: string;
|
|
50
|
+
}[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
project: {
|
|
54
|
+
config: {
|
|
55
|
+
root: string;
|
|
56
|
+
maxWorkers: number;
|
|
57
|
+
provide: {
|
|
58
|
+
[phaseProvideKey]?: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
globFiles: (include: string[], exclude: string[], root: string) => Promise<string[]>;
|
|
62
|
+
provide: <Key extends keyof ProvidedContext>(key: Key, value: ProvidedContext[Key]) => void;
|
|
63
|
+
vite: {
|
|
64
|
+
pluginContainer: PluginContainer;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
defineCacheKeyGenerator?: (generate: () => string) => void;
|
|
68
|
+
};
|
|
69
|
+
type ResolvedConfig = {
|
|
70
|
+
mode: string;
|
|
71
|
+
};
|
|
72
|
+
type Transformed = {
|
|
73
|
+
code: string;
|
|
74
|
+
map: null;
|
|
75
|
+
} | null;
|
|
76
|
+
type CrushPlugin = {
|
|
77
|
+
name: string;
|
|
78
|
+
enforce: 'pre';
|
|
79
|
+
config: () => {
|
|
80
|
+
test: {
|
|
81
|
+
server: {
|
|
82
|
+
deps: {
|
|
83
|
+
external: RegExp[];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
configResolved: (config: ResolvedConfig) => void;
|
|
89
|
+
watchChange: () => void;
|
|
90
|
+
configureVitest: (context: VitestContext) => Promise<void>;
|
|
91
|
+
transform: (source: string, id: string) => Promise<Transformed>;
|
|
92
|
+
};
|
|
93
|
+
type CrushProject = {
|
|
94
|
+
plugins: object[];
|
|
95
|
+
test: {
|
|
96
|
+
name: string;
|
|
97
|
+
[setting: string]: unknown;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
type DiscoverTests = (project: VitestContext['project']) => Promise<string[]>;
|
|
101
|
+
type CrushPluginInput = {
|
|
102
|
+
root: string;
|
|
103
|
+
entries: string[];
|
|
104
|
+
jsx: boolean;
|
|
105
|
+
plugins: readonly ForkPlugin[];
|
|
106
|
+
steps: boolean;
|
|
107
|
+
mutation: MutationSettings;
|
|
108
|
+
explore: boolean;
|
|
109
|
+
discoverTests: DiscoverTests;
|
|
110
|
+
};
|
|
111
|
+
export declare const crushPlugin: ({ root, entries, jsx, plugins, steps, mutation, explore, discoverTests }: CrushPluginInput) => CrushPlugin;
|
|
112
|
+
type Mutation = z.input<typeof mutationSettingsInput>;
|
|
113
|
+
type CrushProjectsInput = {
|
|
114
|
+
root: string;
|
|
115
|
+
include: string[];
|
|
116
|
+
entries: string[];
|
|
117
|
+
mode?: string;
|
|
118
|
+
jsx?: boolean;
|
|
119
|
+
exclude?: string[];
|
|
120
|
+
removableTests?: RemovableTests;
|
|
121
|
+
steps?: boolean;
|
|
122
|
+
redundant?: boolean;
|
|
123
|
+
forks?: ForkPlugin[];
|
|
124
|
+
mutation?: Mutation;
|
|
125
|
+
explore?: ExploreLimits;
|
|
126
|
+
};
|
|
127
|
+
export declare const questionsProject: ({ root, include, exclude, removableTests, steps }: CrushProjectsInput) => CrushProject;
|
|
128
|
+
export declare const stressesProject: ({ root }: CrushProjectsInput) => CrushProject;
|
|
129
|
+
export declare const recordProject: (input: CrushProjectsInput) => CrushProject;
|
|
130
|
+
export declare const judgeProject: (input: CrushProjectsInput) => CrushProject;
|
|
131
|
+
export declare const exploreProject: ({ root, include, exclude, entries, jsx, removableTests, steps, forks, mutation: written, explore }: CrushProjectsInput) => CrushProject;
|
|
132
|
+
export {};
|