@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
package/dist/query/traverse.d.ts
CHANGED
|
@@ -1,77 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* All written against `AdjacencyProvider`, never against the store. §11.8 chose
|
|
5
|
-
* application-code traversal over recursive SQL so that decay scoring, budgets
|
|
6
|
-
* and per-edge weights behave identically on SQLite and Postgres; that only
|
|
7
|
-
* holds while the traversal cannot tell which it is talking to.
|
|
8
|
-
*
|
|
9
|
-
* ## The termination trap, guarded here rather than at Step 12
|
|
10
|
-
*
|
|
11
|
-
* §12.4 scores a hop as
|
|
12
|
-
*
|
|
13
|
-
* new = parent × edgeWeight × coupling × incident × confidence
|
|
14
|
-
*
|
|
15
|
-
* and the coupling and incident factors *boost* — they can exceed 1.0. Three
|
|
16
|
-
* things break the moment the product can reach 1.0:
|
|
17
|
-
*
|
|
18
|
-
* - score stops decreasing monotonically, so best-first is no longer optimal;
|
|
19
|
-
* - a node can be reached later by a better path than the one that first found
|
|
20
|
-
* it, so a plain visited-set silently keeps the worse score;
|
|
21
|
-
* - on a cycle where the product is ≥ 1, traversal **does not terminate**.
|
|
22
|
-
*
|
|
23
|
-
* Two fixes, both here: `weightedBfs` keeps a best-score map and re-pushes on
|
|
24
|
-
* improvement (relaxation), and any hop whose combined factor reaches 1.0 is
|
|
25
|
-
* rejected with an error naming the edge. Step 12 supplies the weights; this is
|
|
26
|
-
* the layer that refuses to run with weights that cannot terminate.
|
|
27
|
-
*
|
|
28
|
-
* ## Confidence is not the traversal weight
|
|
29
|
-
*
|
|
30
|
-
* This module's default `weightFor` used to be `edge.confidence` and nothing
|
|
31
|
-
* else, which made two shipped modules contradict each other. `runtime-
|
|
32
|
-
* confirmation.ts` writes `confidence = 1.0` on every edge it promotes or mints
|
|
33
|
-
* at R4 — correctly, because rule 3 makes R4 unconditionally class A and a
|
|
34
|
-
* witnessed edge is not 99% believed. The old default then handed that same 1.0
|
|
35
|
-
* to the guard above as a *weight*, so the strongest edge in the graph was the
|
|
36
|
-
* one edge `impact` refused to walk. Any graph that had ever had a runtime
|
|
37
|
-
* observation applied threw.
|
|
38
|
-
*
|
|
39
|
-
* The two quantities were never the same thing, and `weights.ts` has said so
|
|
40
|
-
* all along: `validateScopingConfig` asserts
|
|
41
|
-
* `0 < edgeWeight x maxFanOutMultiplier x maxConfidence < 1` and notes in its
|
|
42
|
-
* own comment that *"maxConfidence is 1.0 by definition"*. Termination is the
|
|
43
|
-
* **edge weight's** job; confidence is evidence strength and is entitled to
|
|
44
|
-
* reach 1.0. The old default was the degenerate weight table with every edge
|
|
45
|
-
* type at 1.0 — precisely the configuration `validateScopingConfig` refuses to
|
|
46
|
-
* load. The in-process path was running a config the config loader would
|
|
47
|
-
* reject, while the worker path passed a real table and did not.
|
|
48
|
-
*
|
|
49
|
-
* So the default is now {@link defaultTraversalWeight}: the per-edge-type decay
|
|
50
|
-
* of `DEFAULT_EDGE_WEIGHTS` times the edge's confidence — the same product
|
|
51
|
-
* `weightFromTable` builds for the worker. Termination survives on three
|
|
52
|
-
* independent legs, none of which is a stored confidence value:
|
|
53
|
-
*
|
|
54
|
-
* 1. every weight in `DEFAULT_EDGE_WEIGHTS` is <= 0.95, and confidence is
|
|
55
|
-
* capped at 1.0 by the IR, so the per-hop factor is <= 0.95 < 1 by
|
|
56
|
-
* construction rather than by data;
|
|
57
|
-
* 2. `validateScopingConfig` refuses, at config load, any table that would
|
|
58
|
-
* break leg 1;
|
|
59
|
-
* 3. the per-hop `RangeError` below is unchanged and still refuses any weight
|
|
60
|
-
* outside (0, 1), which is what holds a caller-supplied `weightFor` to the
|
|
61
|
-
* same rule.
|
|
62
|
-
*
|
|
63
|
-
* Ruled in `DEC-386`.
|
|
64
|
-
*/
|
|
1
|
+
/** blueprint 1.1's bfs/weightedBfs/findPath, over AdjacencyProvider only (§11.8: no SQL). §12.4's
|
|
2
|
+
* boost factors can push a hop to >=1.0, breaking termination — weightedBfs relaxes and rejects
|
|
3
|
+
* hops reaching 1.0. Weight = type decay × confidence, never confidence alone (DEC-386). */
|
|
65
4
|
import type { EdgeType, IREdge, ResolutionLevel } from "@descryy/ir";
|
|
66
5
|
import type { AdjacencyProvider } from "./provider.ts";
|
|
67
6
|
export type Direction = "out" | "in" | "both";
|
|
68
|
-
/**
|
|
69
|
-
* `
|
|
70
|
-
* `API_ENDPOINT` node — a caller reaches it from one side, a route serves it
|
|
71
|
-
* from the other, and either side can exist without the other (golden
|
|
72
|
-
* pattern 08's own note). Named once so `crossApiEndpoint` and its tests read
|
|
73
|
-
* the same list rather than two copies drifting.
|
|
74
|
-
*/
|
|
7
|
+
/** USES_API/SERVES_API — the two halves DEC-115 joins at one API_ENDPOINT; either side can exist
|
|
8
|
+
* without the other. Named once so `crossApiEndpoint` and its tests share one list. */
|
|
75
9
|
export declare const API_JOIN_EDGE_TYPES: readonly EdgeType[];
|
|
76
10
|
export interface TraversalOptions {
|
|
77
11
|
readonly types?: readonly EdgeType[];
|
|
@@ -82,17 +16,9 @@ export interface TraversalOptions {
|
|
|
82
16
|
readonly minConfidence?: number;
|
|
83
17
|
/** Fan-out cap per hop. Guards against hub nodes with in-degree in the thousands. */
|
|
84
18
|
readonly perNodeLimit?: number;
|
|
85
|
-
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* using — DEC-138's measured gap: a walk reaching the shared endpoint from
|
|
89
|
-
* one side (say, a frontend caller's `USES_API` edge, direction `out`)
|
|
90
|
-
* cannot see the route that serves it, because `SERVES_API` is stored
|
|
91
|
-
* route -> endpoint and a uniform `out` walk never looks incoming at that
|
|
92
|
-
* one node. Off by default because it is a real, deliberate exception to
|
|
93
|
-
* "the walk means one direction throughout" — every other node keeps that
|
|
94
|
-
* property; only the join node DEC-115 designed to be crossed does not.
|
|
95
|
-
*/
|
|
19
|
+
/** Opt-in, default off. At an API_ENDPOINT, also follows USES_API/SERVES_API in the direction not
|
|
20
|
+
* already walked — DEC-138: a caller-side USES_API walk can't see the SERVES_API route stored the
|
|
21
|
+
* other way. The one deliberate exception to "the walk means one direction throughout". */
|
|
96
22
|
readonly crossApiEndpoint?: boolean;
|
|
97
23
|
}
|
|
98
24
|
export interface Reached {
|
|
@@ -109,60 +35,30 @@ export interface TraversalOutcome {
|
|
|
109
35
|
/** Lowest resolution on any edge the answer traversed. Caps the reliability class. */
|
|
110
36
|
readonly resolutionFloor: ResolutionLevel;
|
|
111
37
|
}
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* Terminates on a cyclic graph by construction — a plain visited-set is correct
|
|
116
|
-
* here precisely because there is no score to improve on a second visit.
|
|
117
|
-
*/
|
|
38
|
+
/** Breadth-first reachability. Unweighted: every reached node scores 1.0. Terminates on a cyclic
|
|
39
|
+
* graph by construction — a plain visited-set is correct since there's no score to improve. */
|
|
118
40
|
export declare function bfs(provider: AdjacencyProvider, seeds: readonly string[], options?: TraversalOptions): TraversalOutcome;
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
* the
|
|
122
|
-
*
|
|
123
|
-
* Both terms are §12.4's, and neither one alone is the weight. Confidence
|
|
124
|
-
* carries how much the producer believes the edge; the type weight carries how
|
|
125
|
-
* far a change actually travels along that kind of edge — an `IMPORTS` hop at
|
|
126
|
-
* 0.4 is a weak signal even when it is certain, and a witnessed `CALLS` hop at
|
|
127
|
-
* 0.95 x 1.0 is strong precisely because it was witnessed.
|
|
128
|
-
*
|
|
129
|
-
* Exported so a caller can compose with it rather than reconstruct it, and so
|
|
130
|
-
* the in-process and worker paths are demonstrably the same function — see the
|
|
131
|
-
* parity test in `worker.test.ts`. It is the callback form of
|
|
132
|
-
* `weightFromTable({ weights: DEFAULT_EDGE_WEIGHTS, fallback: ... })`.
|
|
133
|
-
*/
|
|
41
|
+
/** Default per-hop decay: §12.4's edge-type weight times the edge's confidence — both terms are
|
|
42
|
+
* §12.4's, neither alone is the weight (type weight = how far a change travels on that edge kind;
|
|
43
|
+
* confidence = how sure the producer is). Exported so in-process and worker paths are the same function. */
|
|
134
44
|
export declare function defaultTraversalWeight(edge: {
|
|
135
45
|
readonly type: EdgeType;
|
|
136
46
|
readonly confidence: number;
|
|
137
47
|
}): number;
|
|
138
48
|
export interface WeightedOptions extends TraversalOptions {
|
|
139
|
-
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* {@link defaultTraversalWeight}: the edge type's §12.4 weight times the
|
|
143
|
-
* edge's confidence. **Not confidence alone** — that conflated evidence
|
|
144
|
-
* strength with decay and made a witnessed R4 edge untraversable.
|
|
145
|
-
*/
|
|
49
|
+
/** Per-hop decay factor. Must be strictly < 1.0 (see file header). Defaults to
|
|
50
|
+
* {@link defaultTraversalWeight} — type weight × confidence, not confidence alone (that
|
|
51
|
+
* conflated evidence strength with decay and made a witnessed R4 edge untraversable). */
|
|
146
52
|
readonly weightFor?: (edge: IREdge) => number;
|
|
147
53
|
/** Stop expanding below this score. The main reason traversal ends before the budget. */
|
|
148
54
|
readonly minScore?: number;
|
|
149
55
|
}
|
|
150
|
-
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* "Relaxation" is not an optimisation here, it is what makes the result correct:
|
|
154
|
-
* with boosting factors in play a node can be reached later by a better path,
|
|
155
|
-
* and a visited-set that refuses to revisit would keep the worse score
|
|
156
|
-
* permanently. The best-score map plus re-push on improvement is the fix, and
|
|
157
|
-
* it costs nothing when scores do decrease monotonically.
|
|
158
|
-
*/
|
|
56
|
+
/** Best-first traversal with score decay and relaxation. "Relaxation" isn't an optimisation here,
|
|
57
|
+
* it's correctness: with boosting factors a node can be reached later by a better path, and a
|
|
58
|
+
* plain visited-set would keep the worse score permanently. Costs nothing when scores decay monotonically. */
|
|
159
59
|
export declare function weightedBfs(provider: AdjacencyProvider, seeds: readonly string[], options?: WeightedOptions): TraversalOutcome;
|
|
160
|
-
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* Hop count rather than score: "how is this connected" and "how much impact
|
|
164
|
-
* propagates" are different questions, and answering the first with the second's
|
|
165
|
-
* machinery gives a path that is heavier but shorter-looking.
|
|
166
|
-
*/
|
|
60
|
+
/** Shortest path by hop count, as edges. Empty when unreachable. Hop count, not score — "how is
|
|
61
|
+
* this connected" and "how much impact propagates" are different questions; answering the first
|
|
62
|
+
* with the second's machinery gives a heavier, shorter-looking path. */
|
|
167
63
|
export declare function findPath(provider: AdjacencyProvider, from: string, to: string, options?: TraversalOptions): readonly IREdge[];
|
|
168
64
|
//# sourceMappingURL=traverse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../src/query/traverse.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../src/query/traverse.ts"],"names":[],"mappings":"AAAA;;6FAE6F;AAE7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;AAE9C;wFACwF;AACxF,eAAO,MAAM,mBAAmB,EAAE,SAAS,QAAQ,EAA+B,CAAC;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,QAA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,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;+GAE+G;AAC/G,wBAAgB,WAAW,CACzB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE,eAAoB,GAC5B,gBAAgB,CAwDlB;AAED;;yEAEyE;AACzE,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,gBAAqB,GAC7B,SAAS,MAAM,EAAE,CA8BnB"}
|
package/dist/query/traverse.js
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/query/traverse.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/query/traverse.ts"],"names":[],"mappings":"AAAA;;6FAE6F;AAI7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAM9D;wFACwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAwB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAiCnF,SAAS,UAAU,CACjB,QAA2B,EAC3B,EAAU,EACV,OAAyB;IAEzB,MAAM,SAAS,GAAG;QAChB,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAChE,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;QACxF,GAAG,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AAE,OAAO,GAAG,IAAI,CAAC;gBACtF,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAE,CAAC,KAAK,GAAG,KAAK,CAAC,OAAO,CAAE,CAAC,KAAK;oBAAE,OAAO,GAAG,KAAK,CAAC;gBACzF,IAAI,OAAO,KAAK,KAAK;oBAAE,MAAM;gBAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAE,EAAE,KAAK,CAAC,OAAO,CAAE,CAAC,CAAC;gBAClE,KAAK,GAAG,OAAO,CAAC;YAClB,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -1,164 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `UnresolvedRef` records what an adapter saw and could not resolve, and
|
|
8
|
-
* everything filed there reads as a **gap**. Two unrelated things are filed:
|
|
9
|
-
*
|
|
10
|
-
* - An outbound call to a third party, **read perfectly**. There is no endpoint
|
|
11
|
-
* in this workspace for it and there never will be. That is §20.2's *not
|
|
12
|
-
* applicable* — a fact, not a gap.
|
|
13
|
-
* - A call against this workspace's own surface whose target is not statically
|
|
14
|
-
* determinable. That is the gap, and it is *not analysable*.
|
|
15
|
-
*
|
|
16
|
-
* A read-rate census across nine repositories reported **90 edges read against
|
|
17
|
-
* 773 recognised-and-refused, a 10% read rate**, and concluded that `USES_API`
|
|
18
|
-
* resolution was the system's largest deficit. On one repository **115 of 163
|
|
19
|
-
* ledger rows are calls to Microsoft, Zoom, Hitpay and Zoho** — correctly
|
|
20
|
-
* refused, counted as deficit. The deficit there is real and it is 47%, not 20%.
|
|
21
|
-
*
|
|
22
|
-
* ## What running it on real code established, and it is not what was expected
|
|
23
|
-
*
|
|
24
|
-
* **`rawTarget` does not carry the target.** On the reference repository every
|
|
25
|
-
* one of the 64 `USES_API` refusals carries the *callee* — `"fetch"`,
|
|
26
|
-
* `"api.get"`, `"api.post"` — because the URL was an expression the adapter
|
|
27
|
-
* could not evaluate, and the expression text is not what gets filed. So the
|
|
28
|
-
* ledger **cannot** be split from stored data by any engine-side rule, and this
|
|
29
|
-
* module reports all 64 as `undetermined`, which is the correct answer and a
|
|
30
|
-
* useless one.
|
|
31
|
-
*
|
|
32
|
-
* The distinction nevertheless **already exists** — in `reason`, as prose. Two
|
|
33
|
-
* sentence forms account for all 64, and they split it exactly as a hand count
|
|
34
|
-
* of the source did:
|
|
35
|
-
*
|
|
36
|
-
* | `reason` says | count | what it means |
|
|
37
|
-
* | --- | --- | --- |
|
|
38
|
-
* | *"the path is not repository-relative"* | **39** | outbound. A fact |
|
|
39
|
-
* | *"the request path is not a literal or template"* | **25** | the gap |
|
|
40
|
-
*
|
|
41
|
-
* 39 + 25 = 64, and the independent hand count of that repository was 39 outbound
|
|
42
|
-
* and 25 genuinely unread. **The adapter knows which population a refusal is in
|
|
43
|
-
* and says so in a sentence.** Parsing that sentence is not an option: it is
|
|
44
|
-
* free text, it is written per producer, and a consumer that greps it breaks
|
|
45
|
-
* silently the first time one is reworded — the CRLF-stripper failure exactly.
|
|
46
|
-
*
|
|
47
|
-
* So the conclusion is the opposite of this module's premise: **the
|
|
48
|
-
* discriminator has to be a field**, and this module is the evidence for that
|
|
49
|
-
* rather than a substitute for it. It classifies what the text can carry, and
|
|
50
|
-
* discloses everything it cannot, which is what makes the gap measurable.
|
|
51
|
-
*
|
|
52
|
-
* ## Why the field is still not added here
|
|
53
|
-
*
|
|
54
|
-
* The `category` discriminator is the right end state and is deliberately **not**
|
|
55
|
-
* added here, for two reasons that are the same reason:
|
|
56
|
-
*
|
|
57
|
-
* 1. **No adapter would set it today.** Shipping a consumer that reads a carrier
|
|
58
|
-
* no producer emits is exactly the defect DEC-112 names, and it has already
|
|
59
|
-
* cost this project three checks that were dead on every real repository. A
|
|
60
|
-
* field added ahead of its producer is a dead carrier however obviously
|
|
61
|
-
* correct it looks — so the field lands with an adapter emitting it, not
|
|
62
|
-
* before.
|
|
63
|
-
* 2. **The storage column needs the migration policy** that is still open
|
|
64
|
-
* (architecture §32). An engine-side classifier needs neither, works on graphs
|
|
65
|
-
* already written, and turns the IR change into a request backed by measured
|
|
66
|
-
* populations rather than a speculative one.
|
|
67
|
-
*
|
|
68
|
-
* ## DEC-242 landed, and this module now defers to it where it can
|
|
69
|
-
*
|
|
70
|
-
* The heuristic above is what this module reasoned its way to before a
|
|
71
|
-
* discriminator field existed. It now does: `attrs.refusalClass` (DEC-242),
|
|
72
|
-
* producer-declared and persisted (the store gained a real `attrs` column
|
|
73
|
-
* for it — DEC-224). `classifyRefusal` checks `refusalClass === "out-of-scope"`
|
|
74
|
-
* first and trusts it outright, ahead of the text heuristic below — a
|
|
75
|
-
* producer that resolved the target and declared it out of scope did real
|
|
76
|
-
* analysis, which is better evidence than this module re-deriving the same
|
|
77
|
-
* fact from `rawTarget` text. DEC-242's other three classes
|
|
78
|
-
* (`value-unknown`, `capability-gap`, `varies-per-call`) answer a different
|
|
79
|
-
* question — whether a human sentence could close the row — and say nothing
|
|
80
|
-
* about scope, so they and an unset field both fall through to the
|
|
81
|
-
* unchanged heuristic rather than being read as "not out-of-scope." Every
|
|
82
|
-
* row written before DEC-242 shipped is graded exactly as it always was.
|
|
83
|
-
*
|
|
84
|
-
* The practical consequence, per DEC-242's own note: any future recall
|
|
85
|
-
* figure computed over `unresolved.length` must exclude `refusalClass ===
|
|
86
|
-
* "out-of-scope"` rows from its deficit denominator, the same way
|
|
87
|
-
* `readRate` below already excludes this module's own `outOfScope`
|
|
88
|
-
* verdict — measured at 3 of ~215 rows on the corpora checked so far
|
|
89
|
-
* (DEC-260), small today and not distorting any published number, but
|
|
90
|
-
* expressible now in a way it was not before the field existed.
|
|
91
|
-
*
|
|
92
|
-
* ## The third population is the point
|
|
93
|
-
*
|
|
94
|
-
* A ledger row whose target is a runtime value cannot be classified either way:
|
|
95
|
-
* `fetch(url)` may be outbound or internal and the text does not say. Several
|
|
96
|
-
* such rows on the census repository turned out to be outbound, discovered by
|
|
97
|
-
* hand. **So this returns three counts and refuses to return one rate.** Folding
|
|
98
|
-
* `undetermined` into either side is the same error one level down — the whole
|
|
99
|
-
* defect was a denominator that quietly absorbed a population it should have
|
|
100
|
-
* disclosed.
|
|
101
|
-
*/
|
|
2
|
+
* Refusal ledger mixes outbound calls (correctly refused, §20.2 not applicable) with
|
|
3
|
+
* unresolvable internal targets (a real gap) — one rate hid this (10% read vs a true
|
|
4
|
+
* 47% deficit, one repo). `attrs.refusalClass` (DEC-242) trusted first, text heuristic
|
|
5
|
+
* falls back. Returns three counts, never one rate. */
|
|
102
6
|
import type { UnresolvedRef } from "@descryy/ir";
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* serve. `unreadable` — recognised, target not determinable. `undetermined` —
|
|
106
|
-
* the evidence does not say, and pretending otherwise is what produced the
|
|
107
|
-
* wrong number in the first place.
|
|
108
|
-
*/
|
|
7
|
+
/** outOfScope: read correctly, target outside this workspace. unreadable: recognised,
|
|
8
|
+
* target unresolvable. undetermined: evidence doesn't say — don't fold into either. */
|
|
109
9
|
export type RefusalClass = "outOfScope" | "unreadable" | "undetermined";
|
|
110
10
|
export interface RefusalScope {
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* Empty means "no host is known to be ours", which is honest rather than
|
|
116
|
-
* convenient: with no known host every absolute target classifies as
|
|
117
|
-
* `outOfScope`, so a caller that has hosts and does not pass them will
|
|
118
|
-
* understate its own deficit. `classifyRefusals` reports `scopeKnown` so that
|
|
119
|
-
* cannot happen silently.
|
|
120
|
-
*/
|
|
11
|
+
/** Hosts this workspace serves; an absolute target on one is a genuine gap, not
|
|
12
|
+
* outbound. Empty understates the deficit (all absolute targets read outOfScope) —
|
|
13
|
+
* `classifyRefusals`'s `scopeKnown` discloses this so it can't happen silently. */
|
|
121
14
|
readonly internalHosts?: readonly string[];
|
|
122
15
|
}
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* **A producer's own `attrs.refusalClass: "out-of-scope"` (DEC-242) is
|
|
127
|
-
* trusted directly, ahead of everything below.** DEC-242 landed after this
|
|
128
|
-
* module's own heuristic did, and it is strictly better evidence for the same
|
|
129
|
-
* question: a producer that read the call, resolved the target, and declared
|
|
130
|
-
* it out of scope did real analysis (Lane F's DEC-260 origin check, for one),
|
|
131
|
-
* where this module's `hostOf`/`isOpaque` pair is inference from `rawTarget`
|
|
132
|
-
* text alone. Rule 3's "declared beats re-derived" reordering, not a new rule.
|
|
133
|
-
*
|
|
134
|
-
* **A row with no `refusalClass`, or one of DEC-242's other three values
|
|
135
|
-
* (`value-unknown`, `capability-gap`, `varies-per-call`), falls through to
|
|
136
|
-
* the text heuristic unchanged — a deliberate choice, not an oversight.**
|
|
137
|
-
* Those three classes answer "is a human sentence enough to close this row,"
|
|
138
|
-
* a different question from "is this target inside or outside the
|
|
139
|
-
* workspace," and none of them says a row is or is not out of scope; reading
|
|
140
|
-
* absence as "therefore not out-of-scope" would be exactly the silent
|
|
141
|
-
* behaviour change this module's own module-header history warns against.
|
|
142
|
-
* Every row written before DEC-242 shipped, and every row a producer has not
|
|
143
|
-
* classified yet, is graded identically to how it always was.
|
|
144
|
-
*
|
|
145
|
-
* **Below that: absolute target on a host that is not ours → `outOfScope`.**
|
|
146
|
-
* The only positive classification made here from text alone, so it is as
|
|
147
|
-
* reliable as the text. Everything else is `unreadable` when it looks like a
|
|
148
|
-
* path this workspace could serve, and `undetermined` when the target says
|
|
149
|
-
* nothing about where the call goes.
|
|
150
|
-
*/
|
|
16
|
+
/** `attrs.refusalClass === "out-of-scope"` (DEC-242) is trusted first — producer already
|
|
17
|
+
* resolved the target, better evidence than text inference. Other refusalClass values
|
|
18
|
+
* and unset both fall through unchanged to the text heuristic below. */
|
|
151
19
|
export declare function classifyRefusal(ref: UnresolvedRef, scope?: RefusalScope): RefusalClass;
|
|
152
20
|
export interface RefusalCensus {
|
|
153
21
|
readonly total: number;
|
|
154
22
|
readonly outOfScope: number;
|
|
155
23
|
readonly unreadable: number;
|
|
156
24
|
readonly undetermined: number;
|
|
157
|
-
/**
|
|
158
|
-
*
|
|
159
|
-
* then `outOfScope`, which **understates the deficit**, and a report that does
|
|
160
|
-
* not say so is making a claim it cannot support.
|
|
161
|
-
*/
|
|
25
|
+
/** False with no supplied internal hosts — every absolute target then reads
|
|
26
|
+
* outOfScope, understating the deficit. Callers must check before trusting the rate. */
|
|
162
27
|
readonly scopeKnown: boolean;
|
|
163
28
|
/** Hosts seen on absolute targets, most frequent first — the evidence for `internalHosts`. */
|
|
164
29
|
readonly hosts: readonly {
|
|
@@ -167,16 +32,9 @@ export interface RefusalCensus {
|
|
|
167
32
|
}[];
|
|
168
33
|
}
|
|
169
34
|
export declare function classifyRefusals(refs: readonly UnresolvedRef[], scope?: RefusalScope): RefusalCensus;
|
|
170
|
-
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* `overRecognised` is the census's original figure and it is kept because
|
|
174
|
-
* deleting a published number is worse than captioning it. `overInternal` is
|
|
175
|
-
* the one that describes the analyser's actual deficit. **Both are `null` when
|
|
176
|
-
* their denominator is zero** — `decisions()`'s rule, one level out: a rate over
|
|
177
|
-
* nothing is not 0% and not 100%, it is undefined, and returning a number there
|
|
178
|
-
* is how a dead component scores well.
|
|
179
|
-
*/
|
|
35
|
+
/** Two rates plus disclosure, never one number. `overRecognised` is the original
|
|
36
|
+
* (kept, captioned) figure; `overInternal` is the real deficit. Both null when
|
|
37
|
+
* denominator is zero — undefined, not 0% or 100%. */
|
|
180
38
|
export interface ReadRate {
|
|
181
39
|
readonly read: number;
|
|
182
40
|
readonly census: RefusalCensus;
|
|
@@ -184,11 +42,8 @@ export interface ReadRate {
|
|
|
184
42
|
readonly overRecognised: number | null;
|
|
185
43
|
/** read / (read + refusals that could plausibly be ours). The deficit that is actually ours. */
|
|
186
44
|
readonly overInternal: number | null;
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* the numbers differ, because the gap between them is exactly the thing a
|
|
190
|
-
* single figure hid.
|
|
191
|
-
*/
|
|
45
|
+
/** Why the two rates differ; non-empty whenever they do — the gap is exactly
|
|
46
|
+
* what a single figure would have hidden. */
|
|
192
47
|
readonly disclosure: readonly string[];
|
|
193
48
|
}
|
|
194
49
|
export declare function readRate(read: number, refs: readonly UnresolvedRef[], scope?: RefusalScope): ReadRate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unresolved.d.ts","sourceRoot":"","sources":["../../src/query/unresolved.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"unresolved.d.ts","sourceRoot":"","sources":["../../src/query/unresolved.ts"],"names":[],"mappings":"AAAA;;;;uDAIuD;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD;wFACwF;AACxF,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,YAAY,GAAG,cAAc,CAAC;AAExE,MAAM,WAAW,YAAY;IAC3B;;wFAEoF;IACpF,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AA2BD;;yEAEyE;AACzE,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,GAAE,YAAiB,GAAG,YAAY,CAQ1F;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6FACyF;IACzF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC9E;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,KAAK,GAAE,YAAiB,GACvB,aAAa,CAgBf;AAED;;uDAEuD;AACvD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,yFAAyF;IACzF,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,gGAAgG;IAChG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;kDAC8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,aAAa,EAAE,EAC9B,KAAK,GAAE,YAAiB,GACvB,QAAQ,CAwCV"}
|
package/dist/query/unresolved.js
CHANGED
|
@@ -1,104 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `UnresolvedRef` records what an adapter saw and could not resolve, and
|
|
8
|
-
* everything filed there reads as a **gap**. Two unrelated things are filed:
|
|
9
|
-
*
|
|
10
|
-
* - An outbound call to a third party, **read perfectly**. There is no endpoint
|
|
11
|
-
* in this workspace for it and there never will be. That is §20.2's *not
|
|
12
|
-
* applicable* — a fact, not a gap.
|
|
13
|
-
* - A call against this workspace's own surface whose target is not statically
|
|
14
|
-
* determinable. That is the gap, and it is *not analysable*.
|
|
15
|
-
*
|
|
16
|
-
* A read-rate census across nine repositories reported **90 edges read against
|
|
17
|
-
* 773 recognised-and-refused, a 10% read rate**, and concluded that `USES_API`
|
|
18
|
-
* resolution was the system's largest deficit. On one repository **115 of 163
|
|
19
|
-
* ledger rows are calls to Microsoft, Zoom, Hitpay and Zoho** — correctly
|
|
20
|
-
* refused, counted as deficit. The deficit there is real and it is 47%, not 20%.
|
|
21
|
-
*
|
|
22
|
-
* ## What running it on real code established, and it is not what was expected
|
|
23
|
-
*
|
|
24
|
-
* **`rawTarget` does not carry the target.** On the reference repository every
|
|
25
|
-
* one of the 64 `USES_API` refusals carries the *callee* — `"fetch"`,
|
|
26
|
-
* `"api.get"`, `"api.post"` — because the URL was an expression the adapter
|
|
27
|
-
* could not evaluate, and the expression text is not what gets filed. So the
|
|
28
|
-
* ledger **cannot** be split from stored data by any engine-side rule, and this
|
|
29
|
-
* module reports all 64 as `undetermined`, which is the correct answer and a
|
|
30
|
-
* useless one.
|
|
31
|
-
*
|
|
32
|
-
* The distinction nevertheless **already exists** — in `reason`, as prose. Two
|
|
33
|
-
* sentence forms account for all 64, and they split it exactly as a hand count
|
|
34
|
-
* of the source did:
|
|
35
|
-
*
|
|
36
|
-
* | `reason` says | count | what it means |
|
|
37
|
-
* | --- | --- | --- |
|
|
38
|
-
* | *"the path is not repository-relative"* | **39** | outbound. A fact |
|
|
39
|
-
* | *"the request path is not a literal or template"* | **25** | the gap |
|
|
40
|
-
*
|
|
41
|
-
* 39 + 25 = 64, and the independent hand count of that repository was 39 outbound
|
|
42
|
-
* and 25 genuinely unread. **The adapter knows which population a refusal is in
|
|
43
|
-
* and says so in a sentence.** Parsing that sentence is not an option: it is
|
|
44
|
-
* free text, it is written per producer, and a consumer that greps it breaks
|
|
45
|
-
* silently the first time one is reworded — the CRLF-stripper failure exactly.
|
|
46
|
-
*
|
|
47
|
-
* So the conclusion is the opposite of this module's premise: **the
|
|
48
|
-
* discriminator has to be a field**, and this module is the evidence for that
|
|
49
|
-
* rather than a substitute for it. It classifies what the text can carry, and
|
|
50
|
-
* discloses everything it cannot, which is what makes the gap measurable.
|
|
51
|
-
*
|
|
52
|
-
* ## Why the field is still not added here
|
|
53
|
-
*
|
|
54
|
-
* The `category` discriminator is the right end state and is deliberately **not**
|
|
55
|
-
* added here, for two reasons that are the same reason:
|
|
56
|
-
*
|
|
57
|
-
* 1. **No adapter would set it today.** Shipping a consumer that reads a carrier
|
|
58
|
-
* no producer emits is exactly the defect DEC-112 names, and it has already
|
|
59
|
-
* cost this project three checks that were dead on every real repository. A
|
|
60
|
-
* field added ahead of its producer is a dead carrier however obviously
|
|
61
|
-
* correct it looks — so the field lands with an adapter emitting it, not
|
|
62
|
-
* before.
|
|
63
|
-
* 2. **The storage column needs the migration policy** that is still open
|
|
64
|
-
* (architecture §32). An engine-side classifier needs neither, works on graphs
|
|
65
|
-
* already written, and turns the IR change into a request backed by measured
|
|
66
|
-
* populations rather than a speculative one.
|
|
67
|
-
*
|
|
68
|
-
* ## DEC-242 landed, and this module now defers to it where it can
|
|
69
|
-
*
|
|
70
|
-
* The heuristic above is what this module reasoned its way to before a
|
|
71
|
-
* discriminator field existed. It now does: `attrs.refusalClass` (DEC-242),
|
|
72
|
-
* producer-declared and persisted (the store gained a real `attrs` column
|
|
73
|
-
* for it — DEC-224). `classifyRefusal` checks `refusalClass === "out-of-scope"`
|
|
74
|
-
* first and trusts it outright, ahead of the text heuristic below — a
|
|
75
|
-
* producer that resolved the target and declared it out of scope did real
|
|
76
|
-
* analysis, which is better evidence than this module re-deriving the same
|
|
77
|
-
* fact from `rawTarget` text. DEC-242's other three classes
|
|
78
|
-
* (`value-unknown`, `capability-gap`, `varies-per-call`) answer a different
|
|
79
|
-
* question — whether a human sentence could close the row — and say nothing
|
|
80
|
-
* about scope, so they and an unset field both fall through to the
|
|
81
|
-
* unchanged heuristic rather than being read as "not out-of-scope." Every
|
|
82
|
-
* row written before DEC-242 shipped is graded exactly as it always was.
|
|
83
|
-
*
|
|
84
|
-
* The practical consequence, per DEC-242's own note: any future recall
|
|
85
|
-
* figure computed over `unresolved.length` must exclude `refusalClass ===
|
|
86
|
-
* "out-of-scope"` rows from its deficit denominator, the same way
|
|
87
|
-
* `readRate` below already excludes this module's own `outOfScope`
|
|
88
|
-
* verdict — measured at 3 of ~215 rows on the corpora checked so far
|
|
89
|
-
* (DEC-260), small today and not distorting any published number, but
|
|
90
|
-
* expressible now in a way it was not before the field existed.
|
|
91
|
-
*
|
|
92
|
-
* ## The third population is the point
|
|
93
|
-
*
|
|
94
|
-
* A ledger row whose target is a runtime value cannot be classified either way:
|
|
95
|
-
* `fetch(url)` may be outbound or internal and the text does not say. Several
|
|
96
|
-
* such rows on the census repository turned out to be outbound, discovered by
|
|
97
|
-
* hand. **So this returns three counts and refuses to return one rate.** Folding
|
|
98
|
-
* `undetermined` into either side is the same error one level down — the whole
|
|
99
|
-
* defect was a denominator that quietly absorbed a population it should have
|
|
100
|
-
* disclosed.
|
|
101
|
-
*/
|
|
2
|
+
* Refusal ledger mixes outbound calls (correctly refused, §20.2 not applicable) with
|
|
3
|
+
* unresolvable internal targets (a real gap) — one rate hid this (10% read vs a true
|
|
4
|
+
* 47% deficit, one repo). `attrs.refusalClass` (DEC-242) trusted first, text heuristic
|
|
5
|
+
* falls back. Returns three counts, never one rate. */
|
|
102
6
|
const ABSOLUTE = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//;
|
|
103
7
|
/** The host of an absolute target, lowercased and without a port; `null` if the target is not absolute. */
|
|
104
8
|
function hostOf(rawTarget) {
|
|
@@ -111,55 +15,24 @@ function hostOf(rawTarget) {
|
|
|
111
15
|
return null;
|
|
112
16
|
}
|
|
113
17
|
}
|
|
114
|
-
/**
|
|
115
|
-
*
|
|
116
|
-
* at all — a bare identifier, a call expression, a template with nothing fixed.
|
|
117
|
-
* These are the rows that cannot be classified, and they must stay visible.
|
|
118
|
-
*/
|
|
18
|
+
/** No path-like evidence (bare identifier, call expression, template with nothing
|
|
19
|
+
* fixed) means unclassifiable — must stay visible, not folded into either class. */
|
|
119
20
|
function isOpaque(rawTarget) {
|
|
120
21
|
const t = rawTarget.trim();
|
|
121
22
|
if (t === "")
|
|
122
23
|
return true;
|
|
123
|
-
//
|
|
124
|
-
// nothing about where the call goes, so it is opaque rather than internal.
|
|
125
|
-
// Reached only when `hostOf` has already returned null for it.
|
|
24
|
+
// Absolute with no parseable host (hostOf returned null): opaque, not internal.
|
|
126
25
|
if (ABSOLUTE.test(t))
|
|
127
26
|
return true;
|
|
128
27
|
if (t.startsWith("/"))
|
|
129
28
|
return false;
|
|
130
|
-
//
|
|
131
|
-
// the call goes. Anything containing a `/` outside a placeholder does.
|
|
29
|
+
// Bare `{param}`/`${...}` with no fixed segment says nothing; `/` elsewhere does.
|
|
132
30
|
const withoutPlaceholders = t.replace(/\$?\{[^}]*\}/g, "");
|
|
133
31
|
return !withoutPlaceholders.includes("/");
|
|
134
32
|
}
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* **A producer's own `attrs.refusalClass: "out-of-scope"` (DEC-242) is
|
|
139
|
-
* trusted directly, ahead of everything below.** DEC-242 landed after this
|
|
140
|
-
* module's own heuristic did, and it is strictly better evidence for the same
|
|
141
|
-
* question: a producer that read the call, resolved the target, and declared
|
|
142
|
-
* it out of scope did real analysis (Lane F's DEC-260 origin check, for one),
|
|
143
|
-
* where this module's `hostOf`/`isOpaque` pair is inference from `rawTarget`
|
|
144
|
-
* text alone. Rule 3's "declared beats re-derived" reordering, not a new rule.
|
|
145
|
-
*
|
|
146
|
-
* **A row with no `refusalClass`, or one of DEC-242's other three values
|
|
147
|
-
* (`value-unknown`, `capability-gap`, `varies-per-call`), falls through to
|
|
148
|
-
* the text heuristic unchanged — a deliberate choice, not an oversight.**
|
|
149
|
-
* Those three classes answer "is a human sentence enough to close this row,"
|
|
150
|
-
* a different question from "is this target inside or outside the
|
|
151
|
-
* workspace," and none of them says a row is or is not out of scope; reading
|
|
152
|
-
* absence as "therefore not out-of-scope" would be exactly the silent
|
|
153
|
-
* behaviour change this module's own module-header history warns against.
|
|
154
|
-
* Every row written before DEC-242 shipped, and every row a producer has not
|
|
155
|
-
* classified yet, is graded identically to how it always was.
|
|
156
|
-
*
|
|
157
|
-
* **Below that: absolute target on a host that is not ours → `outOfScope`.**
|
|
158
|
-
* The only positive classification made here from text alone, so it is as
|
|
159
|
-
* reliable as the text. Everything else is `unreadable` when it looks like a
|
|
160
|
-
* path this workspace could serve, and `undetermined` when the target says
|
|
161
|
-
* nothing about where the call goes.
|
|
162
|
-
*/
|
|
33
|
+
/** `attrs.refusalClass === "out-of-scope"` (DEC-242) is trusted first — producer already
|
|
34
|
+
* resolved the target, better evidence than text inference. Other refusalClass values
|
|
35
|
+
* and unset both fall through unchanged to the text heuristic below. */
|
|
163
36
|
export function classifyRefusal(ref, scope = {}) {
|
|
164
37
|
if (ref.attrs?.["refusalClass"] === "out-of-scope")
|
|
165
38
|
return "outOfScope";
|