@descryy/core 0.3.0 → 0.5.0
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/dist/budget/reply.d.ts +11 -46
- package/dist/budget/reply.d.ts.map +1 -1
- package/dist/budget/reply.js +10 -39
- package/dist/budget/reply.js.map +1 -1
- package/dist/budget/size.d.ts +2 -21
- package/dist/budget/size.d.ts.map +1 -1
- package/dist/budget/size.js +3 -24
- package/dist/budget/size.js.map +1 -1
- package/dist/capabilities/preconditions.d.ts +7 -68
- package/dist/capabilities/preconditions.d.ts.map +1 -1
- package/dist/capabilities/preconditions.js +6 -57
- package/dist/capabilities/preconditions.js.map +1 -1
- package/dist/contracts/engine.d.ts +26 -12
- package/dist/contracts/engine.d.ts.map +1 -1
- package/dist/contracts/engine.js +28 -11
- package/dist/contracts/engine.js.map +1 -1
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/orphans.d.ts +28 -77
- package/dist/contracts/orphans.d.ts.map +1 -1
- package/dist/contracts/orphans.js +124 -94
- package/dist/contracts/orphans.js.map +1 -1
- package/dist/contracts/paths.d.ts +4 -114
- package/dist/contracts/paths.d.ts.map +1 -1
- package/dist/contracts/paths.js +7 -140
- package/dist/contracts/paths.js.map +1 -1
- package/dist/contracts/shapes.d.ts +13 -66
- package/dist/contracts/shapes.d.ts.map +1 -1
- package/dist/contracts/shapes.js +20 -91
- package/dist/contracts/shapes.js.map +1 -1
- package/dist/governance/budget.d.ts +12 -48
- package/dist/governance/budget.d.ts.map +1 -1
- package/dist/governance/budget.js +12 -48
- package/dist/governance/budget.js.map +1 -1
- package/dist/governance/candidate-boundary.d.ts +4 -32
- package/dist/governance/candidate-boundary.d.ts.map +1 -1
- package/dist/governance/candidate-boundary.js +4 -32
- package/dist/governance/candidate-boundary.js.map +1 -1
- package/dist/governance/escalation.d.ts +7 -45
- package/dist/governance/escalation.d.ts.map +1 -1
- package/dist/governance/escalation.js +7 -45
- package/dist/governance/escalation.js.map +1 -1
- package/dist/governance/fact-boundary.d.ts +7 -49
- package/dist/governance/fact-boundary.d.ts.map +1 -1
- package/dist/governance/fact-boundary.js +5 -43
- package/dist/governance/fact-boundary.js.map +1 -1
- package/dist/governance/finding-funnel.d.ts +11 -72
- package/dist/governance/finding-funnel.d.ts.map +1 -1
- package/dist/governance/finding-funnel.js +9 -68
- package/dist/governance/finding-funnel.js.map +1 -1
- package/dist/graph/build.d.ts +13 -75
- package/dist/graph/build.d.ts.map +1 -1
- package/dist/graph/build.js +0 -0
- package/dist/graph/build.js.map +1 -1
- package/dist/graph/cross-language.d.ts +4 -43
- package/dist/graph/cross-language.d.ts.map +1 -1
- package/dist/graph/cross-language.js +9 -77
- package/dist/graph/cross-language.js.map +1 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/merge.d.ts +8 -76
- package/dist/graph/merge.d.ts.map +1 -1
- package/dist/graph/merge.js +27 -77
- package/dist/graph/merge.js.map +1 -1
- package/dist/graph/observed-tests.d.ts +7 -68
- package/dist/graph/observed-tests.d.ts.map +1 -1
- package/dist/graph/observed-tests.js +5 -60
- package/dist/graph/observed-tests.js.map +1 -1
- package/dist/graph/persist.d.ts +2 -25
- package/dist/graph/persist.d.ts.map +1 -1
- package/dist/graph/persist.js +2 -25
- package/dist/graph/persist.js.map +1 -1
- package/dist/graph/runtime-confirmation.d.ts +14 -91
- package/dist/graph/runtime-confirmation.d.ts.map +1 -1
- package/dist/graph/runtime-confirmation.js +19 -103
- package/dist/graph/runtime-confirmation.js.map +1 -1
- package/dist/ledger/mint.d.ts +9 -43
- package/dist/ledger/mint.d.ts.map +1 -1
- package/dist/ledger/mint.js +15 -65
- package/dist/ledger/mint.js.map +1 -1
- package/dist/ledger/resolve.d.ts +13 -81
- package/dist/ledger/resolve.d.ts.map +1 -1
- package/dist/ledger/resolve.js +13 -76
- package/dist/ledger/resolve.js.map +1 -1
- package/dist/multipr/fingerprint.d.ts +5 -46
- package/dist/multipr/fingerprint.d.ts.map +1 -1
- package/dist/multipr/fingerprint.js +22 -74
- package/dist/multipr/fingerprint.js.map +1 -1
- package/dist/multipr/hidden-dependency.d.ts +13 -73
- package/dist/multipr/hidden-dependency.d.ts.map +1 -1
- package/dist/multipr/hidden-dependency.js +12 -63
- package/dist/multipr/hidden-dependency.js.map +1 -1
- package/dist/multipr/mechanical.d.ts +25 -160
- package/dist/multipr/mechanical.d.ts.map +1 -1
- package/dist/multipr/mechanical.js +21 -137
- package/dist/multipr/mechanical.js.map +1 -1
- package/dist/multipr/migration-heads.d.ts +18 -105
- package/dist/multipr/migration-heads.d.ts.map +1 -1
- package/dist/multipr/migration-heads.js +15 -84
- package/dist/multipr/migration-heads.js.map +1 -1
- package/dist/multipr/overlap.d.ts +16 -94
- package/dist/multipr/overlap.d.ts.map +1 -1
- package/dist/multipr/overlap.js +25 -105
- package/dist/multipr/overlap.js.map +1 -1
- package/dist/multipr/scope-store.d.ts +15 -80
- package/dist/multipr/scope-store.d.ts.map +1 -1
- package/dist/multipr/scope-store.js +17 -87
- package/dist/multipr/scope-store.js.map +1 -1
- package/dist/multipr/superseded.d.ts +10 -95
- package/dist/multipr/superseded.d.ts.map +1 -1
- package/dist/multipr/superseded.js +7 -60
- package/dist/multipr/superseded.js.map +1 -1
- package/dist/query/confirmed-facts.d.ts +12 -58
- package/dist/query/confirmed-facts.d.ts.map +1 -1
- package/dist/query/confirmed-facts.js +8 -47
- package/dist/query/confirmed-facts.js.map +1 -1
- package/dist/query/declared-value-closure.d.ts +13 -104
- package/dist/query/declared-value-closure.d.ts.map +1 -1
- package/dist/query/declared-value-closure.js +15 -104
- package/dist/query/declared-value-closure.js.map +1 -1
- package/dist/query/memory.d.ts +5 -9
- package/dist/query/memory.d.ts.map +1 -1
- package/dist/query/memory.js +31 -15
- package/dist/query/memory.js.map +1 -1
- package/dist/query/prominence.d.ts +6 -55
- package/dist/query/prominence.d.ts.map +1 -1
- package/dist/query/prominence.js +6 -55
- package/dist/query/prominence.js.map +1 -1
- package/dist/query/provider.d.ts +28 -81
- package/dist/query/provider.d.ts.map +1 -1
- package/dist/query/provider.js +8 -29
- package/dist/query/provider.js.map +1 -1
- package/dist/query/queries.d.ts +15 -65
- package/dist/query/queries.d.ts.map +1 -1
- package/dist/query/queries.js +43 -100
- package/dist/query/queries.js.map +1 -1
- package/dist/query/refusal-fetch.d.ts +8 -85
- package/dist/query/refusal-fetch.d.ts.map +1 -1
- package/dist/query/refusal-fetch.js +11 -93
- package/dist/query/refusal-fetch.js.map +1 -1
- package/dist/query/refusal-questions.d.ts +17 -92
- package/dist/query/refusal-questions.d.ts.map +1 -1
- package/dist/query/refusal-questions.js +14 -78
- package/dist/query/refusal-questions.js.map +1 -1
- package/dist/query/resolution-floor.d.ts +3 -23
- package/dist/query/resolution-floor.d.ts.map +1 -1
- package/dist/query/resolution-floor.js +3 -23
- package/dist/query/resolution-floor.js.map +1 -1
- package/dist/query/root-cause-score.d.ts +11 -161
- package/dist/query/root-cause-score.d.ts.map +1 -1
- package/dist/query/root-cause-score.js +6 -137
- package/dist/query/root-cause-score.js.map +1 -1
- package/dist/query/row-closure-picture.d.ts +5 -67
- package/dist/query/row-closure-picture.d.ts.map +1 -1
- package/dist/query/row-closure-picture.js +6 -67
- package/dist/query/row-closure-picture.js.map +1 -1
- package/dist/query/similar-incidents.d.ts +6 -41
- package/dist/query/similar-incidents.d.ts.map +1 -1
- package/dist/query/similar-incidents.js +15 -69
- package/dist/query/similar-incidents.js.map +1 -1
- package/dist/query/sqlite.d.ts +3 -7
- package/dist/query/sqlite.d.ts.map +1 -1
- package/dist/query/sqlite.js +13 -16
- package/dist/query/sqlite.js.map +1 -1
- package/dist/query/test-coverage.d.ts +5 -45
- package/dist/query/test-coverage.d.ts.map +1 -1
- package/dist/query/test-coverage.js +10 -53
- package/dist/query/test-coverage.js.map +1 -1
- package/dist/query/traverse.d.ts +22 -126
- package/dist/query/traverse.d.ts.map +1 -1
- package/dist/query/traverse.js +0 -0
- package/dist/query/traverse.js.map +1 -1
- package/dist/query/unresolved.d.ts +19 -164
- package/dist/query/unresolved.d.ts.map +1 -1
- package/dist/query/unresolved.js +11 -138
- package/dist/query/unresolved.js.map +1 -1
- package/dist/query/verification-status.d.ts +12 -109
- package/dist/query/verification-status.d.ts.map +1 -1
- package/dist/query/verification-status.js +9 -99
- package/dist/query/verification-status.js.map +1 -1
- package/dist/recording/migrate.d.ts +4 -10
- package/dist/recording/migrate.d.ts.map +1 -1
- package/dist/recording/migrate.js +4 -10
- package/dist/recording/migrate.js.map +1 -1
- package/dist/recording/reader.d.ts +2 -7
- package/dist/recording/reader.d.ts.map +1 -1
- package/dist/recording/reader.js +2 -7
- package/dist/recording/reader.js.map +1 -1
- package/dist/recording/redact.d.ts +6 -57
- package/dist/recording/redact.d.ts.map +1 -1
- package/dist/recording/redact.js +8 -64
- package/dist/recording/redact.js.map +1 -1
- package/dist/recording/schema.d.ts +3 -38
- package/dist/recording/schema.d.ts.map +1 -1
- package/dist/recording/schema.js +3 -38
- package/dist/recording/schema.js.map +1 -1
- package/dist/recording/writer.d.ts +11 -74
- package/dist/recording/writer.d.ts.map +1 -1
- package/dist/recording/writer.js +3 -43
- package/dist/recording/writer.js.map +1 -1
- package/dist/scoping/fanout.d.ts +6 -68
- package/dist/scoping/fanout.d.ts.map +1 -1
- package/dist/scoping/fanout.js +6 -68
- package/dist/scoping/fanout.js.map +1 -1
- package/dist/scoping/score.d.ts +20 -70
- package/dist/scoping/score.d.ts.map +1 -1
- package/dist/scoping/score.js +20 -70
- package/dist/scoping/score.js.map +1 -1
- package/dist/scoping/tiers.d.ts +4 -16
- package/dist/scoping/tiers.d.ts.map +1 -1
- package/dist/scoping/tiers.js +4 -16
- package/dist/scoping/tiers.js.map +1 -1
- package/dist/scoping/traverse.d.ts +3 -25
- package/dist/scoping/traverse.d.ts.map +1 -1
- package/dist/scoping/traverse.js +14 -49
- package/dist/scoping/traverse.js.map +1 -1
- package/dist/scoping/weights.d.ts +10 -74
- package/dist/scoping/weights.d.ts.map +1 -1
- package/dist/scoping/weights.js +14 -86
- package/dist/scoping/weights.js.map +1 -1
- package/dist/sources/confirmed/incidents.d.ts +5 -35
- package/dist/sources/confirmed/incidents.d.ts.map +1 -1
- package/dist/sources/confirmed/incidents.js +14 -48
- package/dist/sources/confirmed/incidents.js.map +1 -1
- package/dist/sources/git/diff.d.ts +71 -65
- package/dist/sources/git/diff.d.ts.map +1 -1
- package/dist/sources/git/diff.js +136 -83
- package/dist/sources/git/diff.js.map +1 -1
- package/dist/sources/git/env.d.ts +7 -0
- package/dist/sources/git/env.d.ts.map +1 -1
- package/dist/sources/git/env.js +10 -11
- package/dist/sources/git/env.js.map +1 -1
- package/dist/sources/git/history.d.ts +64 -84
- package/dist/sources/git/history.d.ts.map +1 -1
- package/dist/sources/git/history.js +141 -112
- package/dist/sources/git/history.js.map +1 -1
- package/dist/sources/git/incidents.d.ts +13 -75
- package/dist/sources/git/incidents.d.ts.map +1 -1
- package/dist/sources/git/incidents.js +21 -91
- package/dist/sources/git/incidents.js.map +1 -1
- package/dist/sources/git/index.d.ts +5 -3
- package/dist/sources/git/index.d.ts.map +1 -1
- package/dist/sources/git/index.js +3 -2
- package/dist/sources/git/index.js.map +1 -1
- package/dist/sources/git/source.d.ts +9 -79
- package/dist/sources/git/source.d.ts.map +1 -1
- package/dist/sources/git/source.js +0 -0
- package/dist/sources/git/source.js.map +1 -1
- package/dist/sources/migrations/across-change.d.ts +94 -0
- package/dist/sources/migrations/across-change.d.ts.map +1 -0
- package/dist/sources/migrations/across-change.js +278 -0
- package/dist/sources/migrations/across-change.js.map +1 -0
- package/dist/sources/migrations/dialects.d.ts +20 -36
- package/dist/sources/migrations/dialects.d.ts.map +1 -1
- package/dist/sources/migrations/dialects.js +11 -36
- package/dist/sources/migrations/dialects.js.map +1 -1
- package/dist/sources/migrations/index.d.ts +3 -1
- package/dist/sources/migrations/index.d.ts.map +1 -1
- package/dist/sources/migrations/index.js +2 -1
- package/dist/sources/migrations/index.js.map +1 -1
- package/dist/sources/migrations/read.d.ts +14 -79
- package/dist/sources/migrations/read.d.ts.map +1 -1
- package/dist/sources/migrations/read.js +14 -89
- package/dist/sources/migrations/read.js.map +1 -1
- package/dist/sources/workspace/workspace.d.ts +6 -42
- package/dist/sources/workspace/workspace.d.ts.map +1 -1
- package/dist/sources/workspace/workspace.js +10 -53
- package/dist/sources/workspace/workspace.js.map +1 -1
- package/dist/store/driver/driver.d.ts +9 -38
- package/dist/store/driver/driver.d.ts.map +1 -1
- package/dist/store/driver/driver.js +4 -22
- package/dist/store/driver/driver.js.map +1 -1
- package/dist/store/driver/node-sqlite.d.ts +3 -12
- package/dist/store/driver/node-sqlite.d.ts.map +1 -1
- package/dist/store/driver/node-sqlite.js +4 -18
- package/dist/store/driver/node-sqlite.js.map +1 -1
- package/dist/store/index.d.ts +2 -7
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +4 -10
- package/dist/store/index.js.map +1 -1
- package/dist/store/migrate.d.ts +14 -50
- package/dist/store/migrate.d.ts.map +1 -1
- package/dist/store/migrate.js +15 -52
- package/dist/store/migrate.js.map +1 -1
- package/dist/store/reader.d.ts +19 -84
- package/dist/store/reader.d.ts.map +1 -1
- package/dist/store/reader.js +25 -92
- package/dist/store/reader.js.map +1 -1
- package/dist/store/schema.d.ts +14 -76
- package/dist/store/schema.d.ts.map +1 -1
- package/dist/store/schema.js +14 -76
- package/dist/store/schema.js.map +1 -1
- package/dist/store/writer.d.ts +14 -88
- package/dist/store/writer.d.ts.map +1 -1
- package/dist/store/writer.js +29 -123
- package/dist/store/writer.js.map +1 -1
- package/dist/tiers/certify.d.ts +46 -281
- package/dist/tiers/certify.d.ts.map +1 -1
- package/dist/tiers/certify.js +46 -226
- package/dist/tiers/certify.js.map +1 -1
- package/dist/tiers/ladder.d.ts +7 -51
- package/dist/tiers/ladder.d.ts.map +1 -1
- package/dist/tiers/ladder.js +13 -89
- package/dist/tiers/ladder.js.map +1 -1
- package/dist/validation/attributes.d.ts +47 -0
- package/dist/validation/attributes.d.ts.map +1 -0
- package/dist/validation/attributes.js +130 -0
- package/dist/validation/attributes.js.map +1 -0
- package/dist/validation/config-graph.d.ts +7 -56
- package/dist/validation/config-graph.d.ts.map +1 -1
- package/dist/validation/config-graph.js +15 -61
- package/dist/validation/config-graph.js.map +1 -1
- package/dist/validation/env.d.ts +53 -2
- package/dist/validation/env.d.ts.map +1 -1
- package/dist/validation/env.js +99 -4
- package/dist/validation/env.js.map +1 -1
- package/dist/validation/index.d.ts +5 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +3 -1
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/join-substitution.d.ts +22 -120
- package/dist/validation/join-substitution.d.ts.map +1 -1
- package/dist/validation/join-substitution.js +13 -90
- package/dist/validation/join-substitution.js.map +1 -1
- package/dist/validation/migration-integrity.d.ts +72 -0
- package/dist/validation/migration-integrity.d.ts.map +1 -0
- package/dist/validation/migration-integrity.js +238 -0
- package/dist/validation/migration-integrity.js.map +1 -0
- package/dist/validation/migrations.d.ts +23 -88
- package/dist/validation/migrations.d.ts.map +1 -1
- package/dist/validation/migrations.js +20 -79
- package/dist/validation/migrations.js.map +1 -1
- package/dist/validation/nodes.d.ts +3 -1
- package/dist/validation/nodes.d.ts.map +1 -1
- package/dist/validation/nodes.js +3 -1
- package/dist/validation/nodes.js.map +1 -1
- package/dist/validation/rollback.d.ts +10 -73
- package/dist/validation/rollback.d.ts.map +1 -1
- package/dist/validation/rollback.js +23 -81
- package/dist/validation/rollback.js.map +1 -1
- package/dist/validation/route-drift.d.ts +9 -62
- package/dist/validation/route-drift.d.ts.map +1 -1
- package/dist/validation/route-drift.js +7 -52
- package/dist/validation/route-drift.js.map +1 -1
- package/dist/validation/sources.d.ts +16 -94
- package/dist/validation/sources.d.ts.map +1 -1
- package/dist/validation/sources.js +51 -147
- package/dist/validation/sources.js.map +1 -1
- package/dist/worker/pool.d.ts +6 -45
- package/dist/worker/pool.d.ts.map +1 -1
- package/dist/worker/pool.js +5 -42
- package/dist/worker/pool.js.map +1 -1
- package/dist/worker/protocol.d.ts +7 -20
- package/dist/worker/protocol.d.ts.map +1 -1
- package/dist/worker/protocol.js +3 -10
- package/dist/worker/protocol.js.map +1 -1
- package/dist/worker/traversal.worker.d.ts +2 -21
- package/dist/worker/traversal.worker.d.ts.map +1 -1
- package/dist/worker/traversal.worker.js +4 -23
- package/dist/worker/traversal.worker.js.map +1 -1
- package/package.json +11 -2
|
@@ -1,44 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* DEC-274 declined to build embedding/pgvector similarity search until a
|
|
5
|
-
* measurement showed what the *existing* graph machinery already answers.
|
|
6
|
-
* `rootCauseSearch` (queries.ts) is half of that existing machinery: it walks
|
|
7
|
-
* `INCIDENT_CORRELATED`/`FIXED_BY` edges from a node **already in the graph**.
|
|
8
|
-
* It cannot help with a brand-new failure that has no node yet — a stack
|
|
9
|
-
* trace or a set of touched files observed just now, before anything about
|
|
10
|
-
* this run has been written to the store.
|
|
11
|
-
*
|
|
12
|
-
* This module is the other half: given a new failure described only as
|
|
13
|
-
* "these files were touched" and/or "this is the error text", rank the
|
|
14
|
-
* `INCIDENT` nodes already in the graph by how much they resemble it, using
|
|
15
|
-
* two signals computed from data the graph already has — no embeddings, no
|
|
16
|
-
* new dependency, no model call:
|
|
17
|
-
*
|
|
18
|
-
* 1. **File-overlap Jaccard** — the new failure's touched-file set against
|
|
19
|
-
* each `INCIDENT`'s `INCIDENT_CORRELATED` file set (§11.6's own
|
|
20
|
-
* correlation edge, read in bulk instead of from one seed node).
|
|
21
|
-
* 2. **Token-set Jaccard on the error text** — the new failure's message
|
|
22
|
-
* against each `INCIDENT` node's `name` (today, always a commit subject
|
|
23
|
-
* line — real signal, but thin; see the git source's own module doc).
|
|
24
|
-
*
|
|
25
|
-
* Both are O(1) string/set operations, not a search index, so this scans
|
|
26
|
-
* every `INCIDENT` node per call. That is deliberate for now: the corpus
|
|
27
|
-
* measured in DEC-274 is a handful of incidents, and a linear scan over a
|
|
28
|
-
* few hundred nodes is not where this decision's cost lives. Revisit if the
|
|
29
|
-
* `INCIDENT` count ever reaches a size where that stops being true — it is
|
|
30
|
-
* not a reason to reach for embeddings, just for an index over this same
|
|
31
|
-
* data.
|
|
2
|
+
* Deterministic "seen this failure before" matcher (DEC-274 declined embedding/pgvector search pending measurement). Ranks INCIDENT nodes against a new failure via file-overlap and error-text token Jaccard — no embeddings, no model call.
|
|
3
|
+
* Linear scan is deliberate at this corpus size; revisit by indexing, not by reaching for embeddings.
|
|
32
4
|
*/
|
|
33
5
|
import type { IRNode } from "@descryy/ir";
|
|
34
6
|
import type { AdjacencyProvider, QueryResult } from "./provider.ts";
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Exported so the measurement script and the tests can assert on it directly
|
|
39
|
-
* rather than only through the combined ranking, per the "caller must see
|
|
40
|
-
* why" requirement below.
|
|
41
|
-
*/
|
|
7
|
+
/** Jaccard similarity of the two strings' token sets. Exported so the
|
|
8
|
+
* measurement script and tests can assert on it directly, not just via the combined ranking. */
|
|
42
9
|
export declare function tokenSetSimilarity(a: string, b: string): number;
|
|
43
10
|
/** Jaccard similarity of two file-path sets. Exported for the same reason as above. */
|
|
44
11
|
export declare function fileOverlapSimilarity(a: readonly string[], b: readonly string[]): number;
|
|
@@ -68,9 +35,7 @@ export interface SimilarIncidentOptions {
|
|
|
68
35
|
readonly minScore?: number;
|
|
69
36
|
readonly limit?: number;
|
|
70
37
|
}
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
* failure — graph identity only, explicitly not embeddings (DEC-274).
|
|
74
|
-
*/
|
|
38
|
+
/** Rank existing INCIDENT nodes by resemblance to a new, not-yet-recorded
|
|
39
|
+
* failure — graph identity only, explicitly not embeddings (DEC-274). */
|
|
75
40
|
export declare function similarIncidents(provider: AdjacencyProvider, query: SimilarFailureQuery, options?: SimilarIncidentOptions): QueryResult<SimilarIncidentMatch[]>;
|
|
76
41
|
//# sourceMappingURL=similar-incidents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"similar-incidents.d.ts","sourceRoot":"","sources":["../../src/query/similar-incidents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"similar-incidents.d.ts","sourceRoot":"","sources":["../../src/query/similar-incidents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,aAAa,CAAC;AAE3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AASpE;iGACiG;AACjG,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ/D;AAED,uFAAuF;AACvF,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,SAAS,MAAM,EAAE,EACpB,CAAC,EAAE,SAAS,MAAM,EAAE,GACnB,MAAM,CAQR;AAED,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,MAAM,yBAAyB,GAAG,cAAc,GAAG,oBAAoB,CAAC;AAE9E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oFAAoF;IACpF,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,sFAAsF;IACtF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACrC,6FAA6F;IAC7F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAoBD;0EAC0E;AAC1E,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,mBAAmB,EAC1B,OAAO,GAAE,sBAA2B,GACnC,WAAW,CAAC,oBAAoB,EAAE,CAAC,CAgErC"}
|
|
@@ -1,55 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* DEC-274 declined to build embedding/pgvector similarity search until a
|
|
5
|
-
* measurement showed what the *existing* graph machinery already answers.
|
|
6
|
-
* `rootCauseSearch` (queries.ts) is half of that existing machinery: it walks
|
|
7
|
-
* `INCIDENT_CORRELATED`/`FIXED_BY` edges from a node **already in the graph**.
|
|
8
|
-
* It cannot help with a brand-new failure that has no node yet — a stack
|
|
9
|
-
* trace or a set of touched files observed just now, before anything about
|
|
10
|
-
* this run has been written to the store.
|
|
11
|
-
*
|
|
12
|
-
* This module is the other half: given a new failure described only as
|
|
13
|
-
* "these files were touched" and/or "this is the error text", rank the
|
|
14
|
-
* `INCIDENT` nodes already in the graph by how much they resemble it, using
|
|
15
|
-
* two signals computed from data the graph already has — no embeddings, no
|
|
16
|
-
* new dependency, no model call:
|
|
17
|
-
*
|
|
18
|
-
* 1. **File-overlap Jaccard** — the new failure's touched-file set against
|
|
19
|
-
* each `INCIDENT`'s `INCIDENT_CORRELATED` file set (§11.6's own
|
|
20
|
-
* correlation edge, read in bulk instead of from one seed node).
|
|
21
|
-
* 2. **Token-set Jaccard on the error text** — the new failure's message
|
|
22
|
-
* against each `INCIDENT` node's `name` (today, always a commit subject
|
|
23
|
-
* line — real signal, but thin; see the git source's own module doc).
|
|
24
|
-
*
|
|
25
|
-
* Both are O(1) string/set operations, not a search index, so this scans
|
|
26
|
-
* every `INCIDENT` node per call. That is deliberate for now: the corpus
|
|
27
|
-
* measured in DEC-274 is a handful of incidents, and a linear scan over a
|
|
28
|
-
* few hundred nodes is not where this decision's cost lives. Revisit if the
|
|
29
|
-
* `INCIDENT` count ever reaches a size where that stops being true — it is
|
|
30
|
-
* not a reason to reach for embeddings, just for an index over this same
|
|
31
|
-
* data.
|
|
32
|
-
*/
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
// Token-set Jaccard — the deterministic stand-in for "fuzzy" text matching.
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
/**
|
|
37
|
-
* Lowercased alphanumeric tokens. No stemming, no stopword list — either
|
|
38
|
-
* would be a modelling decision this function has no business making, and
|
|
39
|
-
* DEC-274 asks for "a real string-similarity measure", not a bespoke NLP
|
|
40
|
-
* pipeline standing in for the embeddings this decision is deferring.
|
|
2
|
+
* Deterministic "seen this failure before" matcher (DEC-274 declined embedding/pgvector search pending measurement). Ranks INCIDENT nodes against a new failure via file-overlap and error-text token Jaccard — no embeddings, no model call.
|
|
3
|
+
* Linear scan is deliberate at this corpus size; revisit by indexing, not by reaching for embeddings.
|
|
41
4
|
*/
|
|
5
|
+
/** Lowercased alphanumeric tokens. No stemming, no stopword list — either
|
|
6
|
+
* would be a modelling decision, not the string-similarity measure DEC-274 asks for. */
|
|
42
7
|
function tokenize(text) {
|
|
43
8
|
const matches = text.toLowerCase().match(/[a-z0-9]+/g);
|
|
44
9
|
return new Set(matches ?? []);
|
|
45
10
|
}
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* Exported so the measurement script and the tests can assert on it directly
|
|
50
|
-
* rather than only through the combined ranking, per the "caller must see
|
|
51
|
-
* why" requirement below.
|
|
52
|
-
*/
|
|
11
|
+
/** Jaccard similarity of the two strings' token sets. Exported so the
|
|
12
|
+
* measurement script and tests can assert on it directly, not just via the combined ranking. */
|
|
53
13
|
export function tokenSetSimilarity(a, b) {
|
|
54
14
|
const ta = tokenize(a);
|
|
55
15
|
const tb = tokenize(b);
|
|
@@ -75,24 +35,13 @@ export function fileOverlapSimilarity(a, b) {
|
|
|
75
35
|
const union = sa.size + sb.size - intersection;
|
|
76
36
|
return union === 0 ? 0 : intersection / union;
|
|
77
37
|
}
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* fact about the code, while a commit subject line is an incidental label a
|
|
81
|
-
* human happened to type. Both are real signal; neither is authoritative
|
|
82
|
-
* alone, which is exactly why DEC-274 asks for both rather than one.
|
|
83
|
-
*/
|
|
38
|
+
/** File overlap outweighs message similarity: which files broke is a fact
|
|
39
|
+
* about the code, a commit subject is an incidental human label. */
|
|
84
40
|
const FILE_OVERLAP_WEIGHT = 0.6;
|
|
85
41
|
const MESSAGE_SIMILARITY_WEIGHT = 0.4;
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* a candidate matching on one signal alone outrank a candidate matching on
|
|
90
|
-
* both signals whenever the second signal's score is imperfect — a single
|
|
91
|
-
* exact file match would beat a near-exact file match paired with a partial
|
|
92
|
-
* message match, which inverts the whole point of combining two signals:
|
|
93
|
-
* corroborating evidence should rank *above* single-signal evidence, never
|
|
94
|
-
* below it. Zero-scoring an attempted-but-absent signal keeps that true.
|
|
95
|
-
*/
|
|
42
|
+
/** Weighted average over signals attempted, not just non-zero ones —
|
|
43
|
+
* normalising over non-zero only would let single-signal evidence outrank
|
|
44
|
+
* corroborating two-signal evidence whenever the second score is imperfect. */
|
|
96
45
|
function combine(attempted) {
|
|
97
46
|
if (attempted.length === 0)
|
|
98
47
|
return 0;
|
|
@@ -103,10 +52,8 @@ function combine(attempted) {
|
|
|
103
52
|
const weighted = attempted.reduce((sum, s) => sum + weightOf(s.kind) * s.score, 0);
|
|
104
53
|
return weighted / totalWeight;
|
|
105
54
|
}
|
|
106
|
-
/**
|
|
107
|
-
*
|
|
108
|
-
* failure — graph identity only, explicitly not embeddings (DEC-274).
|
|
109
|
-
*/
|
|
55
|
+
/** Rank existing INCIDENT nodes by resemblance to a new, not-yet-recorded
|
|
56
|
+
* failure — graph identity only, explicitly not embeddings (DEC-274). */
|
|
110
57
|
export function similarIncidents(provider, query, options = {}) {
|
|
111
58
|
const minScore = options.minScore ?? 0;
|
|
112
59
|
const { nodes: incidents, truncated } = provider.nodesOfType("INCIDENT");
|
|
@@ -115,9 +62,8 @@ export function similarIncidents(provider, query, options = {}) {
|
|
|
115
62
|
const matches = [];
|
|
116
63
|
let floor = 4;
|
|
117
64
|
for (const incident of incidents) {
|
|
118
|
-
// Every signal
|
|
119
|
-
//
|
|
120
|
-
// actually fired, since that is the "why" a caller should see.
|
|
65
|
+
// Every attempted signal, including zero-scoring — combine's denominator.
|
|
66
|
+
// `signals` below keeps only fired ones, the "why" a caller should see.
|
|
121
67
|
const attempted = [];
|
|
122
68
|
if (queryFiles.length > 0) {
|
|
123
69
|
const correlated = provider.outgoing(incident.id, { types: ["INCIDENT_CORRELATED"] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"similar-incidents.js","sourceRoot":"","sources":["../../src/query/similar-incidents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"similar-incidents.js","sourceRoot":"","sources":["../../src/query/similar-incidents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;yFACyF;AACzF,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACvD,OAAO,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;iGACiG;AACjG,MAAM,UAAU,kBAAkB,CAAC,CAAS,EAAE,CAAS;IACrD,MAAM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AAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,KAAK,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;IACtG,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE;QACrF,SAAS,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;QACvF,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/query/sqlite.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* One implementation of the interface, not the interface's reason for existing.
|
|
5
|
-
* Everything above it is written against `AdjacencyProvider`, so swapping this
|
|
6
|
-
* for a Postgres or worker-hosted provider changes this file and nothing else.
|
|
7
|
-
*/
|
|
1
|
+
/** The store-backed `AdjacencyProvider` — one implementation of the
|
|
2
|
+
* interface, not its reason for existing. Everything above is written
|
|
3
|
+
* against the interface, so swapping backends touches only this file. */
|
|
8
4
|
import { type AdjacencyProvider } from "./provider.ts";
|
|
9
5
|
import type { SqlDriver } from "../store/driver/driver.ts";
|
|
10
6
|
export declare function createStoreProvider(driver: SqlDriver): AdjacencyProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/query/sqlite.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/query/sqlite.ts"],"names":[],"mappings":"AAAA;;0EAE0E;AAE1E,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAmCxE;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAMtD"}
|
package/dist/query/sqlite.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* One implementation of the interface, not the interface's reason for existing.
|
|
5
|
-
* Everything above it is written against `AdjacencyProvider`, so swapping this
|
|
6
|
-
* for a Postgres or worker-hosted provider changes this file and nothing else.
|
|
7
|
-
*/
|
|
1
|
+
/** The store-backed `AdjacencyProvider` — one implementation of the
|
|
2
|
+
* interface, not its reason for existing. Everything above is written
|
|
3
|
+
* against the interface, so swapping backends touches only this file. */
|
|
8
4
|
import { DEFAULT_NODE_SET_LIMIT, } from "./provider.js";
|
|
9
5
|
import { getNode, incoming, nodesOfType, outgoing, unresolvedRefs } from "../store/reader.js";
|
|
10
6
|
import { IR_SCHEMA_VERSION } from "../store/schema.js";
|
|
@@ -15,11 +11,15 @@ export function createStoreProvider(driver) {
|
|
|
15
11
|
incoming: (id, options) => withOptions(incoming(driver, id, options), options),
|
|
16
12
|
nodesOfType: (type, limit = DEFAULT_NODE_SET_LIMIT) => nodesOfType(driver, type, limit),
|
|
17
13
|
unresolvedRefs: (options) => unresolvedRefs(driver, options ?? {}),
|
|
14
|
+
// `adapter_runs` is one row per accepted batch (§24.1) — a distinct
|
|
15
|
+
// `adapter_id` is authoritative even for a run with zero surviving nodes.
|
|
16
|
+
sourcesRun: () => driver
|
|
17
|
+
.prepare("SELECT DISTINCT adapter_id FROM adapter_runs ORDER BY adapter_id")
|
|
18
|
+
.all()
|
|
19
|
+
.map((row) => row.adapter_id),
|
|
18
20
|
baseStamp() {
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// of the graph describes code that is no longer what the other part
|
|
22
|
-
// describes — and it is surfaced as a note rather than averaged away.
|
|
21
|
+
// Most recent commit, plus distinct commit count — >1 is a real
|
|
22
|
+
// staleness signal, surfaced as a note rather than averaged away.
|
|
23
23
|
const row = driver
|
|
24
24
|
.prepare(`SELECT
|
|
25
25
|
(SELECT commit_sha FROM adapter_runs ORDER BY written_at DESC, id ASC LIMIT 1) AS commit_sha,
|
|
@@ -41,11 +41,8 @@ export function commitSpread(driver) {
|
|
|
41
41
|
.prepare("SELECT COUNT(DISTINCT commit_sha) AS n FROM adapter_runs")
|
|
42
42
|
.get()?.n ?? 0);
|
|
43
43
|
}
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* floor is applied here rather than pushed down, so that a provider swap cannot
|
|
47
|
-
* silently change which edges a traversal sees.
|
|
48
|
-
*/
|
|
44
|
+
/** Reader filters type/limit in SQL; confidence floor applied here instead,
|
|
45
|
+
* so a provider swap can't silently change which edges a traversal sees. */
|
|
49
46
|
function withOptions(edges, options = {}) {
|
|
50
47
|
if (options.minConfidence === undefined)
|
|
51
48
|
return [...edges];
|
package/dist/query/sqlite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../src/query/sqlite.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../src/query/sqlite.ts"],"names":[],"mappings":"AAAA;;0EAE0E;AAE1E,OAAO,EACL,sBAAsB,GAIvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AASvD,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,OAAO;QACL,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC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AAED;6EAC6E;AAC7E,SAAS,WAAW,CAClB,KAAmB,EACnB,UAA4B,EAAE;IAE9B,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC;IACpC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,KAAK,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,36 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* this is how it finished. Almost nobody asks about a test case. They ask about
|
|
6
|
-
* a function, a file, a scope from an earlier `impact` call, and getting from
|
|
7
|
-
* one to the other crosses a `TESTS` edge.
|
|
8
|
-
*
|
|
9
|
-
* ## What the crossing costs, and why it is disclosed rather than hidden
|
|
10
|
-
*
|
|
11
|
-
* The `TESTS` edge is **static**. An adapter inferred it, at whatever
|
|
12
|
-
* resolution that adapter reached, and nothing in a test run witnesses it: the
|
|
13
|
-
* run witnessed that a test executed, not which functions it touched. So the
|
|
14
|
-
* honest claim this query supports is *"a test that claims to cover this ran,
|
|
15
|
-
* and here is how it finished"* and **not** *"this function executed"*. The two
|
|
16
|
-
* are close enough in English to be conflated by a reader in a hurry, and far
|
|
17
|
-
* enough apart that conflating them turns an inference into a fabricated
|
|
18
|
-
* observation. {@link ObservedTestFor} carries `direct` for exactly this
|
|
19
|
-
* reason: `true` means the caller asked about the test case itself and the
|
|
20
|
-
* answer is witnessed end to end; `false` means the answer leans on an edge no
|
|
21
|
-
* run confirmed.
|
|
22
|
-
*
|
|
23
|
-
* That is also why this lives here rather than inside
|
|
24
|
-
* `computeVerificationStatus`. That module's contract is the *static* half, it
|
|
25
|
-
* says so in its own header, and it stays that way. Composing the static half
|
|
26
|
-
* with this earned one is the tool layer's job, the same place `observe_runtime`
|
|
27
|
-
* composes rather than absorbs.
|
|
28
|
-
*
|
|
29
|
-
* ## Absent, not empty
|
|
30
|
-
*
|
|
31
|
-
* A node no observed test reaches is missing from the returned map rather than
|
|
32
|
-
* present with an empty list. Inventing a key would let a caller iterate the
|
|
33
|
-
* map and believe it had asked about everything.
|
|
2
|
+
* Joins `observed_tests` to code a caller asked about, across a static `TESTS` edge. Honest claim: "a
|
|
3
|
+
* test that claims to cover this ran", never "this function executed" — `direct` marks which. A node no
|
|
4
|
+
* observed test reaches is absent from the map, never an empty list.
|
|
34
5
|
*/
|
|
35
6
|
import type { ObservedTestOutcome } from "../graph/observed-tests.ts";
|
|
36
7
|
import type { SqlDriver } from "../store/driver/driver.ts";
|
|
@@ -42,24 +13,13 @@ export interface ObservedTestFor {
|
|
|
42
13
|
readonly outcome: ObservedTestOutcome;
|
|
43
14
|
readonly runId: string;
|
|
44
15
|
readonly observedAt: number;
|
|
45
|
-
/**
|
|
46
|
-
* `true` when the caller asked about this very test case, witnessed end to
|
|
47
|
-
* end. `false` when the answer was reached across a static `TESTS` edge,
|
|
48
|
-
* which no run confirmed. See the module header.
|
|
49
|
-
*/
|
|
16
|
+
/** `true`: caller asked about this test case, witnessed end to end. `false`: reached via a static `TESTS` edge no run confirmed. */
|
|
50
17
|
readonly direct: boolean;
|
|
51
18
|
}
|
|
52
19
|
export interface TestCoverageForRef {
|
|
53
20
|
readonly ref: string;
|
|
54
21
|
readonly tests: readonly ObservedTestFor[];
|
|
55
22
|
}
|
|
56
|
-
/**
|
|
57
|
-
* For each requested node id, the observed tests that bear on it.
|
|
58
|
-
*
|
|
59
|
-
* One test contributes at most one entry per ref: a test re-run across several
|
|
60
|
-
* runs is still one test, and the **most recent** observation is what the code
|
|
61
|
-
* stands verified against now. Reporting every historical run instead would
|
|
62
|
-
* make a flaky test look like broad coverage.
|
|
63
|
-
*/
|
|
23
|
+
/** For each node id, the observed tests that bear on it. One entry per test per ref — the most recent run wins, so a flaky test doesn't look like broad coverage. */
|
|
64
24
|
export declare function observedTestCoverage(driver: SqlDriver, refs: readonly string[]): ReadonlyMap<string, TestCoverageForRef>;
|
|
65
25
|
//# sourceMappingURL=test-coverage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-coverage.d.ts","sourceRoot":"","sources":["../../src/query/test-coverage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"test-coverage.d.ts","sourceRoot":"","sources":["../../src/query/test-coverage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oIAAoI;IACpI,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CAC5C;AAaD,qKAAqK;AACrK,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAiDzC"}
|
|
@@ -1,53 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* this is how it finished. Almost nobody asks about a test case. They ask about
|
|
6
|
-
* a function, a file, a scope from an earlier `impact` call, and getting from
|
|
7
|
-
* one to the other crosses a `TESTS` edge.
|
|
8
|
-
*
|
|
9
|
-
* ## What the crossing costs, and why it is disclosed rather than hidden
|
|
10
|
-
*
|
|
11
|
-
* The `TESTS` edge is **static**. An adapter inferred it, at whatever
|
|
12
|
-
* resolution that adapter reached, and nothing in a test run witnesses it: the
|
|
13
|
-
* run witnessed that a test executed, not which functions it touched. So the
|
|
14
|
-
* honest claim this query supports is *"a test that claims to cover this ran,
|
|
15
|
-
* and here is how it finished"* and **not** *"this function executed"*. The two
|
|
16
|
-
* are close enough in English to be conflated by a reader in a hurry, and far
|
|
17
|
-
* enough apart that conflating them turns an inference into a fabricated
|
|
18
|
-
* observation. {@link ObservedTestFor} carries `direct` for exactly this
|
|
19
|
-
* reason: `true` means the caller asked about the test case itself and the
|
|
20
|
-
* answer is witnessed end to end; `false` means the answer leans on an edge no
|
|
21
|
-
* run confirmed.
|
|
22
|
-
*
|
|
23
|
-
* That is also why this lives here rather than inside
|
|
24
|
-
* `computeVerificationStatus`. That module's contract is the *static* half, it
|
|
25
|
-
* says so in its own header, and it stays that way. Composing the static half
|
|
26
|
-
* with this earned one is the tool layer's job, the same place `observe_runtime`
|
|
27
|
-
* composes rather than absorbs.
|
|
28
|
-
*
|
|
29
|
-
* ## Absent, not empty
|
|
30
|
-
*
|
|
31
|
-
* A node no observed test reaches is missing from the returned map rather than
|
|
32
|
-
* present with an empty list. Inventing a key would let a caller iterate the
|
|
33
|
-
* map and believe it had asked about everything.
|
|
34
|
-
*/
|
|
35
|
-
/**
|
|
36
|
-
* For each requested node id, the observed tests that bear on it.
|
|
37
|
-
*
|
|
38
|
-
* One test contributes at most one entry per ref: a test re-run across several
|
|
39
|
-
* runs is still one test, and the **most recent** observation is what the code
|
|
40
|
-
* stands verified against now. Reporting every historical run instead would
|
|
41
|
-
* make a flaky test look like broad coverage.
|
|
2
|
+
* Joins `observed_tests` to code a caller asked about, across a static `TESTS` edge. Honest claim: "a
|
|
3
|
+
* test that claims to cover this ran", never "this function executed" — `direct` marks which. A node no
|
|
4
|
+
* observed test reaches is absent from the map, never an empty list.
|
|
42
5
|
*/
|
|
6
|
+
/** For each node id, the observed tests that bear on it. One entry per test per ref — the most recent run wins, so a flaky test doesn't look like broad coverage. */
|
|
43
7
|
export function observedTestCoverage(driver, refs) {
|
|
44
8
|
const out = new Map();
|
|
45
9
|
if (refs.length === 0)
|
|
46
10
|
return out;
|
|
47
11
|
const placeholders = refs.map(() => "?").join(", ");
|
|
48
|
-
// Two arms
|
|
49
|
-
//
|
|
50
|
-
// by a TESTS edge must not be counted twice for one subject.
|
|
12
|
+
// Two arms unioned, not fetched separately, so de-duplication below sees
|
|
13
|
+
// both — a test both direct and TESTS-joined must not count twice.
|
|
51
14
|
const sql = "SELECT e.target AS subject, o.node_id, o.qualified_name, o.outcome, o.run_id, o.observed_at," +
|
|
52
15
|
" 0 AS direct, o.rowid AS seq" +
|
|
53
16
|
" FROM observed_tests o" +
|
|
@@ -58,18 +21,12 @@ export function observedTestCoverage(driver, refs) {
|
|
|
58
21
|
" 1 AS direct, o.rowid AS seq" +
|
|
59
22
|
" FROM observed_tests o" +
|
|
60
23
|
` WHERE o.node_id IN (${placeholders})` +
|
|
61
|
-
// `seq` breaks
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
// this query answer "verified against a failing run" when a later run had
|
|
65
|
-
// passed. rowid is monotonic for an ordinary (non-WITHOUT ROWID) table, so
|
|
66
|
-
// ordering by it is exactly "whichever row was written last" -- which is
|
|
67
|
-
// the semantics the timestamp was reaching for and could not express at
|
|
68
|
-
// millisecond resolution.
|
|
24
|
+
// `seq` breaks a real tie: two runs can land in the same millisecond, so
|
|
25
|
+
// `observed_at` alone once returned a failing run over a later passing one.
|
|
26
|
+
// rowid is monotonic, so it means "whichever was written last."
|
|
69
27
|
" ORDER BY observed_at DESC, seq DESC, node_id ASC";
|
|
70
28
|
const rows = driver.prepare(sql).all(...refs, ...refs);
|
|
71
|
-
// Rows arrive newest first, so the first
|
|
72
|
-
// is the observation that stands. Later ones are older runs of the same test.
|
|
29
|
+
// Rows arrive newest first, so the first (subject, test) sighting stands.
|
|
73
30
|
const seen = new Set();
|
|
74
31
|
for (const row of rows) {
|
|
75
32
|
const key = `${row.subject} ${row.node_id}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-coverage.js","sourceRoot":"","sources":["../../src/query/test-coverage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"test-coverage.js","sourceRoot":"","sources":["../../src/query/test-coverage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiCH,qKAAqK;AACrK,MAAM,UAAU,oBAAoB,CAClC,MAAiB,EACjB,IAAuB;IAEvB,MAAM,GAAG,GAAG,IAAI,GAAG,EAA8B,CAAC;IAClD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IAElC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpD,yEAAyE;IACzE,mEAAmE;IACnE,MAAM,GAAG,GACP,8FAA8F;QAC9F,8BAA8B;QAC9B,wBAAwB;QACxB,4DAA4D;QAC5D,uBAAuB,YAAY,GAAG;QACtC,aAAa;QACb,+FAA+F;QAC/F,8BAA8B;QAC9B,wBAAwB;QACxB,wBAAwB,YAAY,GAAG;QACvC,yEAAyE;QACzE,4EAA4E;QAC5E,gEAAgE;QAChE,mDAAmD,CAAC;IAEtD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAc,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAEpE,0EAA0E;IAC1E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,GAAG,GAAG,C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