@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,55 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* §14.3 says this outright and it is the whole design. At real team scale many
|
|
8
|
-
* pull requests incidentally touch the same low-importance code — a shared
|
|
9
|
-
* logging helper, a barrel file, a constants module. A tool that reports every
|
|
10
|
-
* shared node reports mostly noise, and a developer who has dismissed six
|
|
11
|
-
* incidental overlaps will dismiss the seventh without reading it.
|
|
12
|
-
*
|
|
13
|
-
* So severity is a product of *what* is shared, not *that* something is:
|
|
14
|
-
*
|
|
15
|
-
* score(node) = impact × NODE_TYPE_WEIGHT[type]
|
|
16
|
-
*
|
|
17
|
-
* A shared `API_ENDPOINT` is two changes to one contract. A shared `FUNCTION`
|
|
18
|
-
* in a utility module is two people editing a file. The weights are the only
|
|
19
|
-
* thing separating them and they are tuning values, labelled as such.
|
|
20
|
-
*
|
|
21
|
-
* ## Resolution is carried per node, and that is §14.2's one addition
|
|
22
|
-
*
|
|
23
|
-
* §14.2 adds `Resolution` to the persisted row with a reason: *so overlap
|
|
24
|
-
* severity is not computed across incomparable evidence*. If one change's node
|
|
25
|
-
* was resolved by a type checker and the other's by syntax alone, an overlap
|
|
26
|
-
* asserted at the stronger level claims more than half of its own evidence
|
|
27
|
-
* supports.
|
|
28
|
-
*
|
|
29
|
-
* The rule follows DEC-058 exactly — a claim carries the resolution of ITS OWN
|
|
30
|
-
* evidence, not of the run that produced it. Here the claim rests on two
|
|
31
|
-
* observations, so it carries **the weaker of the two**, and the finding's
|
|
32
|
-
* reliability class follows from that rather than from either side alone.
|
|
33
|
-
*
|
|
34
|
-
* ## What this deliberately does not do
|
|
35
|
-
*
|
|
36
|
-
* §14.4's mechanical-versus-semantic classification needs the actual diff lines
|
|
37
|
-
* at the shared node, which this module never sees. It reports the overlap and
|
|
38
|
-
* stops; classifying it — and the auto-apply path that is the single documented
|
|
39
|
-
* exception to approval-before-code-change — belongs where the diff is.
|
|
40
|
-
* Guessing "mechanical" without reading the lines would be the one place in
|
|
41
|
-
* this system where a wrong guess edits somebody's branch.
|
|
42
|
-
*/
|
|
1
|
+
/** §14.3 — whether two in-flight changes touching the same node is a real
|
|
2
|
+
* conflict: score = impact × NODE_TYPE_WEIGHT[type] (tuning values), so a
|
|
3
|
+
* shared node alone isn't one. §14.2 carries resolution per node; a claim
|
|
4
|
+
* uses the weaker of the two (DEC-058). Does NOT classify mechanical vs
|
|
5
|
+
* semantic (§14.4) — needs diff lines this module never sees. */
|
|
43
6
|
import type { NodeType, ResolutionLevel } from "@descryy/ir";
|
|
44
7
|
import type { ReliabilityClass } from "@descryy/ir";
|
|
45
8
|
/** How a change touched a node. §14.2's `DiffType`. */
|
|
46
9
|
export type DiffType = "added" | "modified" | "deleted";
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* Defined here rather than in a store module so overlap can be computed and
|
|
51
|
-
* tested with no database, the same reason `AdjacencyProvider` exists.
|
|
52
|
-
*/
|
|
10
|
+
/** One row of a change's scoped subgraph — §14.2's shape, without
|
|
11
|
+
* persistence, so overlap can be computed/tested with no database. */
|
|
53
12
|
export interface PrScopeEntry {
|
|
54
13
|
readonly nodeId: string;
|
|
55
14
|
readonly nodeType: NodeType;
|
|
@@ -73,15 +32,8 @@ export interface PrScope {
|
|
|
73
32
|
readonly computedAt: number;
|
|
74
33
|
/** The head commit of the change itself. Identifies it; never compares it. */
|
|
75
34
|
readonly headSha: string;
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* Not the same as `headSha`, and the distinction is load-bearing: two scopes
|
|
80
|
-
* are comparable only when this agrees. A single `baseSha` field stood here
|
|
81
|
-
* first, described as "the base commit it was computed against", which is
|
|
82
|
-
* ambiguous between the two and would have let a comparison key on the wrong
|
|
83
|
-
* one. §14.2's column comment is what caught it.
|
|
84
|
-
*/
|
|
35
|
+
/** Commit the graph was at when computed — not `headSha`; two scopes are
|
|
36
|
+
* comparable only when this agrees (§14.2). */
|
|
85
37
|
readonly graphCommitSha: string;
|
|
86
38
|
}
|
|
87
39
|
/** One node two changes both touch. */
|
|
@@ -133,40 +85,14 @@ export interface OverlapReport {
|
|
|
133
85
|
/** Pairs refused before comparison — see `incomparable`. */
|
|
134
86
|
readonly incomparable: number;
|
|
135
87
|
};
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* **An incomparable pair and a non-conflicting pair produce the same empty
|
|
140
|
-
* overlap**, so they are separated here rather than left to be inferred from
|
|
141
|
-
* a count that does not distinguish them.
|
|
142
|
-
*/
|
|
88
|
+
/** Pairs that could not be compared at all — kept separate from
|
|
89
|
+
* non-conflicting pairs, which produce the same empty overlap. */
|
|
143
90
|
readonly incomparable: readonly IncomparablePair[];
|
|
144
91
|
readonly notes: readonly string[];
|
|
145
92
|
}
|
|
146
|
-
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* The architecture gives the shape and one worked contrast — a shared utility
|
|
150
|
-
* function scores low, a shared API contract scores high — and fixes no
|
|
151
|
-
* numbers. These are a defensible starting point and are expected to move once
|
|
152
|
-
* there is data. The ordering is the part that is argued:
|
|
153
|
-
*
|
|
154
|
-
* - **Contract surfaces highest.** `API_ENDPOINT` and `API_ROUTE` are the join
|
|
155
|
-
* between two services; two changes to one is the case where a merge compiles
|
|
156
|
-
* and the system breaks.
|
|
157
|
-
* - **Schema next.** A `DATABASE_TABLE` or `DATABASE_COLUMN` touched twice is
|
|
158
|
-
* two migrations against one object, which §14.6 checks separately and which
|
|
159
|
-
* fails at merge rather than at review.
|
|
160
|
-
* - **Types above callables.** Two changes to a `DTO` or `MODEL` shape reach
|
|
161
|
-
* every consumer; two changes to one `FUNCTION` reach its callers.
|
|
162
|
-
* - **`FILE` lowest of the real types.** File-level overlap is what every naive
|
|
163
|
-
* tool already reports and it is the noise this weighting exists to suppress.
|
|
164
|
-
*
|
|
165
|
-
* Exhaustive over the frozen vocabulary on purpose: `Record<NodeType, number>`
|
|
166
|
-
* means adding a node type is a compile error here rather than a silent zero,
|
|
167
|
-
* and a silent zero would make the new type invisible to conflict detection
|
|
168
|
-
* without any test failing.
|
|
169
|
-
*/
|
|
93
|
+
/** §14.3's `NodeTypeWeight` — tuning values. Ordering: contract > schema >
|
|
94
|
+
* types (DTO/MODEL) > callables > `FILE`. `Record<NodeType,...>` is
|
|
95
|
+
* exhaustive, so a new node type is a compile error, not a silent zero. */
|
|
170
96
|
export declare const NODE_TYPE_WEIGHTS: Readonly<Record<NodeType, number>>;
|
|
171
97
|
/** Default score below which a shared node is incidental rather than a conflict. */
|
|
172
98
|
export declare const DEFAULT_CONFLICT_THRESHOLD = 0.3;
|
|
@@ -176,11 +102,7 @@ export interface OverlapOptions {
|
|
|
176
102
|
/** Cap on findings, per rule 5. Truncation is reported. */
|
|
177
103
|
readonly limit?: number;
|
|
178
104
|
}
|
|
179
|
-
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* Pure over scopes, so it needs no store and no graph. §14.2's persistence is a
|
|
183
|
-
* layer above this, not a prerequisite for it.
|
|
184
|
-
*/
|
|
105
|
+
/** Overlaps between every pair of in-flight changes. Pure over scopes — no
|
|
106
|
+
* store, no graph; §14.2's persistence sits above this, not before it. */
|
|
185
107
|
export declare function findOverlaps(scopes: readonly PrScope[], options?: OverlapOptions): OverlapReport;
|
|
186
108
|
//# sourceMappingURL=overlap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlap.d.ts","sourceRoot":"","sources":["../../src/multipr/overlap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"overlap.d.ts","sourceRoot":"","sources":["../../src/multipr/overlap.ts"],"names":[],"mappings":"AAAA;;;;kEAIkE;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,uDAAuD;AACvD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD;uEACuE;AACvE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,OAAO;IACtB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAC;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;oD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
-
*
|
|
7
|
-
* §14.3 says this outright and it is the whole design. At real team scale many
|
|
8
|
-
* pull requests incidentally touch the same low-importance code — a shared
|
|
9
|
-
* logging helper, a barrel file, a constants module. A tool that reports every
|
|
10
|
-
* shared node reports mostly noise, and a developer who has dismissed six
|
|
11
|
-
* incidental overlaps will dismiss the seventh without reading it.
|
|
12
|
-
*
|
|
13
|
-
* So severity is a product of *what* is shared, not *that* something is:
|
|
14
|
-
*
|
|
15
|
-
* score(node) = impact × NODE_TYPE_WEIGHT[type]
|
|
16
|
-
*
|
|
17
|
-
* A shared `API_ENDPOINT` is two changes to one contract. A shared `FUNCTION`
|
|
18
|
-
* in a utility module is two people editing a file. The weights are the only
|
|
19
|
-
* thing separating them and they are tuning values, labelled as such.
|
|
20
|
-
*
|
|
21
|
-
* ## Resolution is carried per node, and that is §14.2's one addition
|
|
22
|
-
*
|
|
23
|
-
* §14.2 adds `Resolution` to the persisted row with a reason: *so overlap
|
|
24
|
-
* severity is not computed across incomparable evidence*. If one change's node
|
|
25
|
-
* was resolved by a type checker and the other's by syntax alone, an overlap
|
|
26
|
-
* asserted at the stronger level claims more than half of its own evidence
|
|
27
|
-
* supports.
|
|
28
|
-
*
|
|
29
|
-
* The rule follows DEC-058 exactly — a claim carries the resolution of ITS OWN
|
|
30
|
-
* evidence, not of the run that produced it. Here the claim rests on two
|
|
31
|
-
* observations, so it carries **the weaker of the two**, and the finding's
|
|
32
|
-
* reliability class follows from that rather than from either side alone.
|
|
33
|
-
*
|
|
34
|
-
* ## What this deliberately does not do
|
|
35
|
-
*
|
|
36
|
-
* §14.4's mechanical-versus-semantic classification needs the actual diff lines
|
|
37
|
-
* at the shared node, which this module never sees. It reports the overlap and
|
|
38
|
-
* stops; classifying it — and the auto-apply path that is the single documented
|
|
39
|
-
* exception to approval-before-code-change — belongs where the diff is.
|
|
40
|
-
* Guessing "mechanical" without reading the lines would be the one place in
|
|
41
|
-
* this system where a wrong guess edits somebody's branch.
|
|
42
|
-
*/
|
|
1
|
+
/** §14.3 — whether two in-flight changes touching the same node is a real
|
|
2
|
+
* conflict: score = impact × NODE_TYPE_WEIGHT[type] (tuning values), so a
|
|
3
|
+
* shared node alone isn't one. §14.2 carries resolution per node; a claim
|
|
4
|
+
* uses the weaker of the two (DEC-058). Does NOT classify mechanical vs
|
|
5
|
+
* semantic (§14.4) — needs diff lines this module never sees. */
|
|
43
6
|
import { reliabilityCap, reliabilityNote } from "@descryy/ir";
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* The architecture gives the shape and one worked contrast — a shared utility
|
|
48
|
-
* function scores low, a shared API contract scores high — and fixes no
|
|
49
|
-
* numbers. These are a defensible starting point and are expected to move once
|
|
50
|
-
* there is data. The ordering is the part that is argued:
|
|
51
|
-
*
|
|
52
|
-
* - **Contract surfaces highest.** `API_ENDPOINT` and `API_ROUTE` are the join
|
|
53
|
-
* between two services; two changes to one is the case where a merge compiles
|
|
54
|
-
* and the system breaks.
|
|
55
|
-
* - **Schema next.** A `DATABASE_TABLE` or `DATABASE_COLUMN` touched twice is
|
|
56
|
-
* two migrations against one object, which §14.6 checks separately and which
|
|
57
|
-
* fails at merge rather than at review.
|
|
58
|
-
* - **Types above callables.** Two changes to a `DTO` or `MODEL` shape reach
|
|
59
|
-
* every consumer; two changes to one `FUNCTION` reach its callers.
|
|
60
|
-
* - **`FILE` lowest of the real types.** File-level overlap is what every naive
|
|
61
|
-
* tool already reports and it is the noise this weighting exists to suppress.
|
|
62
|
-
*
|
|
63
|
-
* Exhaustive over the frozen vocabulary on purpose: `Record<NodeType, number>`
|
|
64
|
-
* means adding a node type is a compile error here rather than a silent zero,
|
|
65
|
-
* and a silent zero would make the new type invisible to conflict detection
|
|
66
|
-
* without any test failing.
|
|
67
|
-
*/
|
|
7
|
+
/** §14.3's `NodeTypeWeight` — tuning values. Ordering: contract > schema >
|
|
8
|
+
* types (DTO/MODEL) > callables > `FILE`. `Record<NodeType,...>` is
|
|
9
|
+
* exhaustive, so a new node type is a compile error, not a silent zero. */
|
|
68
10
|
export const NODE_TYPE_WEIGHTS = {
|
|
69
11
|
API_ENDPOINT: 1.0,
|
|
70
12
|
API_ROUTE: 1.0,
|
|
@@ -79,32 +21,21 @@ export const NODE_TYPE_WEIGHTS = {
|
|
|
79
21
|
FUNCTION: 0.4,
|
|
80
22
|
TEST_CASE: 0.3,
|
|
81
23
|
FILE: 0.2,
|
|
82
|
-
// History artefacts
|
|
83
|
-
//
|
|
84
|
-
// zero would hide that rather than surface it.
|
|
24
|
+
// History artefacts; if these appear in a diff scope something upstream is
|
|
25
|
+
// wrong — zero weight would hide that rather than surface it.
|
|
85
26
|
INCIDENT: 0.1,
|
|
86
27
|
FIX_PATTERN: 0.1,
|
|
87
28
|
};
|
|
88
29
|
/** Default score below which a shared node is incidental rather than a conflict. */
|
|
89
30
|
export const DEFAULT_CONFLICT_THRESHOLD = 0.3;
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* A node peripheral to one change and central to the other is a real conflict:
|
|
94
|
-
* somebody is about to have their central concern edited from underneath them.
|
|
95
|
-
* Taking the minimum would let a large blast radius be discounted by a
|
|
96
|
-
* one-line drive-by touching the same node, which is the case most worth
|
|
97
|
-
* catching.
|
|
98
|
-
*/
|
|
31
|
+
/** Impact of a shared node is the **higher** of the two — a node peripheral
|
|
32
|
+
* to one change and central to the other is still a real conflict; the
|
|
33
|
+
* min would let a drive-by touch discount a large blast radius. */
|
|
99
34
|
function impactOfPair(a, b) {
|
|
100
35
|
return Math.max(a.impactScore, b.impactScore);
|
|
101
36
|
}
|
|
102
|
-
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* Pure over scopes, so it needs no store and no graph. §14.2's persistence is a
|
|
106
|
-
* layer above this, not a prerequisite for it.
|
|
107
|
-
*/
|
|
37
|
+
/** Overlaps between every pair of in-flight changes. Pure over scopes — no
|
|
38
|
+
* store, no graph; §14.2's persistence sits above this, not before it. */
|
|
108
39
|
export function findOverlaps(scopes, options = {}) {
|
|
109
40
|
const threshold = options.threshold ?? DEFAULT_CONFLICT_THRESHOLD;
|
|
110
41
|
const weights = options.weights ?? NODE_TYPE_WEIGHTS;
|
|
@@ -121,14 +52,9 @@ export function findOverlaps(scopes, options = {}) {
|
|
|
121
52
|
pairs += 1;
|
|
122
53
|
const left = byId[i];
|
|
123
54
|
const right = byId[j];
|
|
124
|
-
// Refused BEFORE any node is compared
|
|
125
|
-
//
|
|
126
|
-
//
|
|
127
|
-
// overlap a scope from last week with one from today and report a
|
|
128
|
-
// number". That warning is honoured here rather than in the store,
|
|
129
|
-
// because a caller constructing scopes by hand never touches a store —
|
|
130
|
-
// and because an incomparable pair returns the same empty overlap a
|
|
131
|
-
// genuinely non-conflicting one does.
|
|
55
|
+
// Refused BEFORE any node is compared: comparing across two graph
|
|
56
|
+
// states of one PR would silently overlap "last week" with "today".
|
|
57
|
+
// Checked here, not the store, since hand-built scopes never touch one.
|
|
132
58
|
const reason = left.scope.repo !== right.scope.repo
|
|
133
59
|
? "different-repo"
|
|
134
60
|
: left.scope.graphCommitSha !== right.scope.graphCommitSha
|
|
@@ -146,9 +72,8 @@ export function findOverlaps(scopes, options = {}) {
|
|
|
146
72
|
if (b === undefined)
|
|
147
73
|
continue;
|
|
148
74
|
overlapSize += 1;
|
|
149
|
-
// DEC-058 at the pair level:
|
|
150
|
-
//
|
|
151
|
-
// half its own evidence supports.
|
|
75
|
+
// DEC-058 at the pair level: claim carries the weaker of the two
|
|
76
|
+
// observations — the stronger would claim more than its evidence supports.
|
|
152
77
|
const resolution = Math.min(a.resolution, b.resolution);
|
|
153
78
|
const resolutionMismatch = a.resolution !== b.resolution;
|
|
154
79
|
if (resolutionMismatch)
|
|
@@ -169,9 +94,8 @@ export function findOverlaps(scopes, options = {}) {
|
|
|
169
94
|
score,
|
|
170
95
|
diffTypes: [a.diffType, b.diffType],
|
|
171
96
|
resolution,
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
// class A here where a shape claim on the same evidence would not.
|
|
97
|
+
// Name-level fact (which symbols both changes touch), not a shape
|
|
98
|
+
// claim — R2 permits class A here where a shape claim would not.
|
|
175
99
|
reliability: reliabilityCap(resolution, true),
|
|
176
100
|
resolutionMismatch,
|
|
177
101
|
});
|
|
@@ -195,13 +119,9 @@ export function findOverlaps(scopes, options = {}) {
|
|
|
195
119
|
b: right.scope.prId,
|
|
196
120
|
overlapSize,
|
|
197
121
|
surfaced: shared,
|
|
198
|
-
// §14.3
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
// an unrelated overlap. Summing the per-node scores keeps the same
|
|
202
|
-
// intent — more shared, and more important, scores higher — and stays
|
|
203
|
-
// monotonic in both. The divergence is deliberate and recorded rather
|
|
204
|
-
// than silently "interpreted".
|
|
122
|
+
// §14.3 literally says OverlapSize × ImpactScore × NodeTypeWeight,
|
|
123
|
+
// which would let one trivial node scale with an unrelated overlap's
|
|
124
|
+
// size. Summing per-node scores keeps the same intent; deliberate divergence.
|
|
205
125
|
conflictScore: shared.reduce((sum, s) => sum + s.score, 0),
|
|
206
126
|
disclosure,
|
|
207
127
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlap.js","sourceRoot":"","sources":["../../src/multipr/overlap.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"overlap.js","sourceRoot":"","sources":["../../src/multipr/overlap.ts"],"names":[],"mappings":"AAAA;;;;kEAIkE;AAGlE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA+F9D;;4EAE4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAuC;IACnE,YAAY,EAAE,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,eAAe,EAAE,GAAG;IACpB,cAAc,EAAE,GAAG;IACnB,GAAG,EAAE,GAAG;IACR,KAAK,EAAE,GAAG;IACV,KAAK,EAAE,GAAG;IACV,SAAS,EAAE,GAAG;IACd,I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
1
1
|
/**
|
|
2
|
-
* §14.2 — persisting a change's scoped subgraph
|
|
3
|
-
* two
|
|
4
|
-
*
|
|
5
|
-
* ## Why this is stored at all, when everything else derived is thrown away
|
|
6
|
-
*
|
|
7
|
-
* A scope looks derived. It is not, and the reason is easy to get backwards:
|
|
8
|
-
* everything on the derived side regenerates because *the source still produces
|
|
9
|
-
* it*. A PR scope was computed against a graph **at one commit**, and that graph
|
|
10
|
-
* moves. Recomputing it later does not restore it — it answers a different
|
|
11
|
-
* question and returns a plausible answer to it. Dropping it does not lose time,
|
|
12
|
-
* it loses the comparison basis.
|
|
13
|
-
*
|
|
14
|
-
* That is why `pr_scopes` sits in `EARNED_TABLES` beside observed edges and
|
|
15
|
-
* human corrections, and it is the weaker-looking member of that set in one
|
|
16
|
-
* respect and the more dangerous in another: an R4 observation cannot be
|
|
17
|
-
* recomputed at any price, whereas a PR scope can be recomputed **wrongly**.
|
|
18
|
-
*
|
|
19
|
-
* ## `graphCommitSha` is the whole design
|
|
20
|
-
*
|
|
21
|
-
* Two scopes are comparable only when they were computed against the same
|
|
22
|
-
* graph. The schema puts that commit in the primary key so the same PR at two
|
|
23
|
-
* graph states is two rows rather than one silently overwriting the other, and
|
|
24
|
-
* indexes `(repo, graph_commit_sha)` because overlap scoring's only real query
|
|
25
|
-
* is *every scope computed against one graph*.
|
|
26
|
-
*
|
|
27
|
-
* **It is a different commit from the PR's own head**, and this module renamed a
|
|
28
|
-
* field to say so. `overlap.ts` originally carried one `baseSha` described as
|
|
29
|
-
* "the base commit it was computed against", which is ambiguous between the two
|
|
30
|
-
* and would have let a comparison key on the wrong one. The store's column
|
|
31
|
-
* comment is what caught it.
|
|
32
|
-
*
|
|
33
|
-
* ## An incomparable pair and a non-conflicting pair look identical
|
|
34
|
-
*
|
|
35
|
-
* Both produce an empty overlap. The schema comment warns that a reader
|
|
36
|
-
* ignoring `graph_commit_sha` "will happily overlap a scope from last week with
|
|
37
|
-
* one from today and report a number" — so the refusal lives in `findOverlaps`
|
|
38
|
-
* rather than here, where it also protects the caller who never touches a store.
|
|
2
|
+
* §14.2 — persisting a change's scoped subgraph. Looks derived but isn't: computed against a graph at one commit, and that graph moves — recomputing later answers a different question, so pr_scopes sits in EARNED_TABLES (worse than an R4 observation: it can be recomputed wrongly, not just never).
|
|
3
|
+
* graphCommitSha (distinct from the PR's head — a prior `baseSha` name was ambiguous) is in the primary key so two graph states are two rows, not an overwrite. An incomparable pair and a non-conflicting pair both produce empty overlap, so that refusal lives in findOverlaps, not here.
|
|
39
4
|
*/
|
|
40
5
|
import type { SqlDriver } from "../store/driver/driver.ts";
|
|
41
6
|
import type { PrScope } from "./overlap.ts";
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* A corrupt row is not an empty scope. Returning `[]` here would make a damaged
|
|
46
|
-
* store indistinguishable from a PR that touched nothing, which is the
|
|
47
|
-
* conflation §14.8 exists to refuse one layer up.
|
|
48
|
-
*/
|
|
7
|
+
/** Thrown when a stored scope can't be decoded. A corrupt row is not an
|
|
8
|
+
* empty scope — returning [] would conflate the two (§14.8 refuses this). */
|
|
49
9
|
export declare class ScopeDecodeError extends Error {
|
|
50
10
|
readonly name = "ScopeDecodeError";
|
|
51
11
|
constructor(message: string, options?: {
|
|
52
12
|
cause?: unknown;
|
|
53
13
|
});
|
|
54
14
|
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* nothing here scores, compares or decides staleness.
|
|
58
|
-
*/
|
|
15
|
+
/** Row access for pr_scopes. Thin on purpose (style of reader.ts): nothing
|
|
16
|
+
* here scores, compares or decides staleness. */
|
|
59
17
|
export declare class ScopeStore {
|
|
60
18
|
#private;
|
|
61
19
|
constructor(driver: SqlDriver);
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* Replacement is safe **only** because the graph commit is in the key:
|
|
66
|
-
* recomputing the same PR against the same graph must produce the same scope,
|
|
67
|
-
* so the row being replaced is equal to the one replacing it. Recomputing
|
|
68
|
-
* against a *different* graph writes a new row and leaves the old comparison
|
|
69
|
-
* basis intact, which is the entire reason the column is in the key.
|
|
70
|
-
*/
|
|
20
|
+
/** Write a scope, replacing any row for (repo, prId, graphCommitSha).
|
|
21
|
+
* Safe only because the graph commit is in the key — a different graph
|
|
22
|
+
* writes a new row and leaves the old comparison basis intact. */
|
|
71
23
|
save(scope: PrScope): void;
|
|
72
24
|
saveAll(scopes: readonly PrScope[]): void;
|
|
73
25
|
/** One scope, or `undefined` when no row exists for that exact graph state. */
|
|
74
26
|
load(repo: string, prId: string, graphCommitSha: string): PrScope | undefined;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* graph, and therefore every scope that can legitimately be compared.
|
|
78
|
-
*
|
|
79
|
-
* Ordered by `pr_id` so a report is stable across runs — an unordered read
|
|
80
|
-
* makes two identical graphs produce two differently-ordered reports and
|
|
81
|
-
* turns a diff into noise.
|
|
82
|
-
*/
|
|
27
|
+
/** The query overlap scoring is for: every scope computed against one
|
|
28
|
+
* graph. Ordered by pr_id so a report is stable across runs. */
|
|
83
29
|
loadForGraph(repo: string, graphCommitSha: string): PrScope[];
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* Exposed because "this PR was scoped against three different graphs" is a
|
|
88
|
-
* fact a caller may need and cannot reconstruct from `load`, which requires
|
|
89
|
-
* knowing the commit in advance.
|
|
90
|
-
*/
|
|
30
|
+
/** Every graph state a PR has a scope for, newest first — not reconstructable
|
|
31
|
+
* from `load`, which requires knowing the commit in advance. */
|
|
91
32
|
graphStatesFor(repo: string, prId: string): {
|
|
92
33
|
graphCommitSha: string;
|
|
93
34
|
computedAt: number;
|
|
94
35
|
}[];
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* The only legitimate deletion: a closed or merged PR is not in flight and
|
|
99
|
-
* cannot conflict with anything. Deleting a *single* graph state is not
|
|
100
|
-
* offered, because the row is the comparison basis and there is no caller who
|
|
101
|
-
* wants exactly one of them gone.
|
|
102
|
-
*/
|
|
36
|
+
/** Forget a PR entirely — every graph state it was scoped against. The only
|
|
37
|
+
* legitimate deletion: a closed/merged PR can't conflict with anything. */
|
|
103
38
|
forget(repo: string, prId: string): number;
|
|
104
39
|
}
|
|
105
40
|
//# sourceMappingURL=scope-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-store.d.ts","sourceRoot":"","sources":["../../src/multipr/scope-store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scope-store.d.ts","sourceRoot":"","sources":["../../src/multipr/scope-store.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AAc1D;8EAC8E;AAC9E,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,SAAkB,IAAI,sBAAsB;gBAEhC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAG3D;AA4CD;kDACkD;AAClD,qBAAa,UAAU;;gBAGT,MAAM,EAAE,SAAS;IAI7B;;uEAEmE;IACnE,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAsB1B,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;IAMzC,+EAA+E;IAC/E,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAS7E;qEACiE;IACjE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,EAAE;IAS7D;qEACiE;IACjE,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE;IAU5F;gFAC4E;IAC5E,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;CAK3C"}
|