@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,101 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* §14.4
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* mechanical-versus-semantic classification needs the actual diff lines at the
|
|
6
|
-
* shared node, which this module never sees … Guessing 'mechanical' without
|
|
7
|
-
* reading the lines would be the one place in this system where a wrong guess
|
|
8
|
-
* edits somebody's branch."* This is that module, and it reads the lines.
|
|
9
|
-
*
|
|
10
|
-
* ## The bar here is higher than anywhere else in §14, not lower
|
|
11
|
-
*
|
|
12
|
-
* §14.4 is the **single documented exception** to approval-before-code-change
|
|
13
|
-
* (§9, rule 8). Every other check in this package tells a human to look at
|
|
14
|
-
* something. A `MECHANICAL` verdict may be **auto-applied** — it edits a branch
|
|
15
|
-
* without asking.
|
|
16
|
-
*
|
|
17
|
-
* So rule 2 inverts in consequence, and the asymmetry is the whole design:
|
|
18
|
-
*
|
|
19
|
-
* > A missed mechanical resolution costs a human thirty seconds of `git
|
|
20
|
-
* > mergetool`. A false one silently rewrites two people's work into something
|
|
21
|
-
* > neither wrote and reports success.
|
|
22
|
-
*
|
|
23
|
-
* `MECHANICAL` is therefore claimed **only when every condition is affirmatively
|
|
24
|
-
* established**, never when nothing contradicts it. Absent hunks, a hunk whose
|
|
25
|
-
* shape cannot be read, a file this module cannot reason about — each produces
|
|
26
|
-
* `UNCLASSIFIABLE` with a reason, and `UNCLASSIFIABLE` never auto-applies.
|
|
27
|
-
* `SEMANTIC` is the answer when the lines were read and disagree; that is a
|
|
28
|
-
* different sentence from "the lines were not read", and the two are kept apart
|
|
29
|
-
* for the reason they are kept apart everywhere else in this package.
|
|
30
|
-
*
|
|
31
|
-
* ## What "only add new, non-overlapping lines" has to mean to be safe
|
|
32
|
-
*
|
|
33
|
-
* §14.4's diamond asks whether both changes *"only add new, non-overlapping
|
|
34
|
-
* lines"*. Read literally that is a test on the post-image, and the post-images
|
|
35
|
-
* of two branches are not comparable — they are two different files. The test
|
|
36
|
-
* that means anything is on the **base**:
|
|
37
|
-
*
|
|
38
|
-
* 1. **Every hunk on both sides is a pure insertion** — it consumes zero base
|
|
39
|
-
* lines (`baseLines === 0`). One modified or deleted base line anywhere at
|
|
40
|
-
* this node makes the whole overlap `SEMANTIC`. Not "the modified hunks are
|
|
41
|
-
* semantic and the rest are mechanical": a partially auto-applied overlap is
|
|
42
|
-
* a merge nobody reviewed.
|
|
43
|
-
*
|
|
44
|
-
* 2. **No two insertion points from opposite sides fall within the context
|
|
45
|
-
* window.** Two insertions at base lines 10 and 12 do not touch the same
|
|
46
|
-
* line and git still refuses them, because their three-line contexts
|
|
47
|
-
* overlap. Matching git's own margin rather than testing for exact equality
|
|
48
|
-
* is the difference between a rule about text and a rule about what the
|
|
49
|
-
* merge will actually do.
|
|
50
|
-
*
|
|
51
|
-
* The margin is `CONTEXT_LINES`, and it is deliberately the *conservative*
|
|
52
|
-
* direction: a real mechanical case inside the margin is reported `SEMANTIC` and
|
|
53
|
-
* a human resolves it in half a minute.
|
|
54
|
-
*
|
|
55
|
-
* ## Two claims, two different sources of authority — and only one of them
|
|
56
|
-
* gates the apply
|
|
57
|
-
*
|
|
58
|
-
* This finding rests on two separate things and it is worth being exact about
|
|
59
|
-
* which does what, because conflating them would either block safe applies or
|
|
60
|
-
* permit unsafe ones:
|
|
61
|
-
*
|
|
62
|
-
* | claim | rests on | governs |
|
|
63
|
-
* | --- | --- | --- |
|
|
64
|
-
* | *both changes touch this node* | the graph | whether this is **surfaced**, and the reliability class |
|
|
65
|
-
* | *these hunks merge without conflict* | the diff text | whether this may be **applied** |
|
|
66
|
-
*
|
|
67
|
-
* The reliability class follows `overlap.ts` — the weaker of the two sides'
|
|
68
|
-
* resolutions, per DEC-058 and §11A.5 — and it describes how much to trust that
|
|
69
|
-
* this overlap *matters*. It does not gate the apply, and that is not a
|
|
70
|
-
* loosening: if the graph were wrong about the node, "keep both non-adjacent
|
|
71
|
-
* pure insertions" is still exactly as safe, because the textual claim never
|
|
72
|
-
* depended on the graph being right. Gating the apply on the graph's resolution
|
|
73
|
-
* would be borrowing authority from the wrong evidence.
|
|
74
|
-
*
|
|
75
|
-
* A caller wanting the stricter rule can require class A itself. The point is
|
|
76
|
-
* that the module states which evidence carries which claim rather than folding
|
|
77
|
-
* both into one number.
|
|
78
|
-
*
|
|
79
|
-
* ## Verify-after is not a recommendation and is not expressible as one
|
|
80
|
-
*
|
|
81
|
-
* §14.4 makes the post-apply verification **mandatory** (§19). A `verifyAfter:
|
|
82
|
-
* true` field on a result would be advisory, and an advisory obligation is one
|
|
83
|
-
* `if` away from being skipped by a caller in a hurry.
|
|
84
|
-
*
|
|
85
|
-
* So the apply path is `applyMechanical(plan, { apply, verify })` and **both
|
|
86
|
-
* callbacks are required by the type**. There is no overload that applies
|
|
87
|
-
* without verifying. A `verify` returning false produces `"reverted"`, and a
|
|
88
|
-
* `verify` that throws produces `"verification-failed"` — which is *not* the
|
|
89
|
-
* same outcome and is not collapsed into it, because "the change broke
|
|
90
|
-
* something" and "we could not tell whether the change broke something" are the
|
|
91
|
-
* two categories §20.2 exists to keep apart.
|
|
2
|
+
* §14.4 mechanical-vs-semantic overlap check — the one documented exception to
|
|
3
|
+
* approval-before-code-change (§9 rule 8): MECHANICAL auto-applies only when every
|
|
4
|
+
* hunk on both sides is a pure insertion and insertion points sit >CONTEXT_LINES apart on the base; else UNCLASSIFIABLE/SEMANTIC. Reliability (DEC-058) never gates the apply; verify-after is mandatory (§19).
|
|
92
5
|
*/
|
|
93
6
|
import { reliabilityCap, reliabilityNote } from "@descryy/ir";
|
|
94
|
-
/**
|
|
95
|
-
* git
|
|
96
|
-
* produce overlapping context and git declines to merge them, so this module
|
|
97
|
-
* declines too.
|
|
98
|
-
*/
|
|
7
|
+
/** git's default diff context. Two insertions closer than this on the base
|
|
8
|
+
* overlap and git declines to merge them, so this module declines too. */
|
|
99
9
|
export const CONTEXT_LINES = 3;
|
|
100
10
|
/** Every reason this module declines, as data — a refusal is a row, never a silence. */
|
|
101
11
|
const REASONS = {
|
|
@@ -106,8 +16,7 @@ const REASONS = {
|
|
|
106
16
|
"an unreadable hunk is not an absent one",
|
|
107
17
|
};
|
|
108
18
|
function hunksFor(hunks, node) {
|
|
109
|
-
//
|
|
110
|
-
// below, not a filter that silently returns nothing here.
|
|
19
|
+
// No file means no hunk can be matched — refused below, not filtered silently.
|
|
111
20
|
if (node.file === undefined)
|
|
112
21
|
return [];
|
|
113
22
|
return hunks.filter((hunk) => hunk.file === node.file);
|
|
@@ -144,10 +53,8 @@ function classifyOne(node, aHunks, bHunks, contextLines) {
|
|
|
144
53
|
if (all.some((hunk) => hunk.baseLines < 0 || hunk.headLines < 0 || hunk.baseStart < 0)) {
|
|
145
54
|
return { ...base, verdict: "UNCLASSIFIABLE", reason: REASONS.negativeLines };
|
|
146
55
|
}
|
|
147
|
-
// Condition 1
|
|
148
|
-
// base line
|
|
149
|
-
// no partial auto-apply, because a partially applied overlap is a merge
|
|
150
|
-
// nobody reviewed.
|
|
56
|
+
// Condition 1: every hunk on both sides is a pure insertion. One modified
|
|
57
|
+
// base line makes the whole overlap semantic — no partial auto-apply.
|
|
151
58
|
const modifying = all.filter((hunk) => hunk.baseLines > 0);
|
|
152
59
|
if (modifying.length > 0) {
|
|
153
60
|
const where = modifying
|
|
@@ -163,9 +70,8 @@ function classifyOne(node, aHunks, bHunks, contextLines) {
|
|
|
163
70
|
"overlap is a merge nobody reviewed.",
|
|
164
71
|
};
|
|
165
72
|
}
|
|
166
|
-
// Condition 2
|
|
167
|
-
//
|
|
168
|
-
// overlapping context, so this uses git's own margin.
|
|
73
|
+
// Condition 2: no insertion point from either side within the context window
|
|
74
|
+
// of the other — uses git's own margin, not exact-equality.
|
|
169
75
|
const collisions = [];
|
|
170
76
|
for (const a of aHunks) {
|
|
171
77
|
for (const b of bHunks) {
|
|
@@ -200,14 +106,8 @@ function classifyOne(node, aHunks, bHunks, contextLines) {
|
|
|
200
106
|
resolution: { kind: "keep-both", order },
|
|
201
107
|
};
|
|
202
108
|
}
|
|
203
|
-
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* @param shared the nodes `findOverlaps` surfaced — this module does not decide
|
|
207
|
-
* what is worth looking at, only what may be done about it
|
|
208
|
-
* @param aHunks side A's hunks, against the base both sides share
|
|
209
|
-
* @param bHunks side B's hunks, against the same base
|
|
210
|
-
*/
|
|
109
|
+
/** Classify every surfaced overlap between two changes. `shared` is what
|
|
110
|
+
* findOverlaps surfaced; `aHunks`/`bHunks` are each side's hunks vs the same base. */
|
|
211
111
|
export function classifyOverlaps(shared, aHunks, bHunks, options = {}) {
|
|
212
112
|
const contextLines = options.contextLines ?? CONTEXT_LINES;
|
|
213
113
|
const classifications = shared.map((node) => classifyOne(node, hunksFor(aHunks, node), hunksFor(bHunks, node), contextLines));
|
|
@@ -218,9 +118,8 @@ export function classifyOverlaps(shared, aHunks, bHunks, options = {}) {
|
|
|
218
118
|
semantic: classifications.filter((c) => c.verdict === "SEMANTIC").length,
|
|
219
119
|
unclassifiable: classifications.filter((c) => c.verdict === "UNCLASSIFIABLE").length,
|
|
220
120
|
};
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
// conclusion.
|
|
121
|
+
// Same precondition shape as hidden-dependency.ts: nothing read means
|
|
122
|
+
// nothing can be concluded — "nothing was mechanical" is a conclusion.
|
|
224
123
|
const analysed = counts.withHunksBothSides > 0;
|
|
225
124
|
const notes = [];
|
|
226
125
|
if (!analysed && shared.length > 0) {
|
|
@@ -249,19 +148,9 @@ export function classifyOverlaps(shared, aHunks, bHunks, options = {}) {
|
|
|
249
148
|
};
|
|
250
149
|
return { data: { classifications, analysed, checked: counts }, stamp, truncated: false, notes };
|
|
251
150
|
}
|
|
252
|
-
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
* The mandatory verification of §14.4/§19 is enforced by the *type*: `verify` is
|
|
256
|
-
* a required member of `ApplyHooks`, so a caller that wants to skip it has to
|
|
257
|
-
* write a function that lies, which is a different and more visible act than
|
|
258
|
-
* omitting an optional field.
|
|
259
|
-
*
|
|
260
|
-
* Refuses outright, before touching anything, when the verdict is not
|
|
261
|
-
* `MECHANICAL` or when no `revert` was supplied — auto-applying a change that
|
|
262
|
-
* cannot be undone if verification fails is the exception's precondition, not a
|
|
263
|
-
* detail of it.
|
|
264
|
-
*/
|
|
151
|
+
/** Apply one mechanical resolution, then verify — always both. §14.4/§19's
|
|
152
|
+
* mandatory verification is enforced by the type: `verify` is required on
|
|
153
|
+
* `ApplyHooks`. Refuses upfront if verdict isn't MECHANICAL or no `revert` given. */
|
|
265
154
|
export async function applyMechanical(classification, hooks) {
|
|
266
155
|
if (classification.verdict !== "MECHANICAL" || classification.resolution === undefined) {
|
|
267
156
|
return {
|
|
@@ -289,9 +178,8 @@ export async function applyMechanical(classification, hooks) {
|
|
|
289
178
|
ok = await hooks.verify();
|
|
290
179
|
}
|
|
291
180
|
catch (error) {
|
|
292
|
-
// Verification
|
|
293
|
-
//
|
|
294
|
-
// we do not know rather than that it was bad.
|
|
181
|
+
// Verification couldn't answer. Revert anyway, but report "don't know",
|
|
182
|
+
// not "it was bad".
|
|
295
183
|
try {
|
|
296
184
|
await hooks.revert();
|
|
297
185
|
}
|
|
@@ -322,12 +210,8 @@ export async function applyMechanical(classification, hooks) {
|
|
|
322
210
|
}
|
|
323
211
|
return { status: "applied", verified: true };
|
|
324
212
|
}
|
|
325
|
-
/**
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* Exported so `overlap.ts`'s rule and this one cannot drift apart silently: both
|
|
329
|
-
* take the weaker of the two sides, per DEC-058.
|
|
330
|
-
*/
|
|
213
|
+
/** Reliability class for a pair of resolutions — the weaker side, per DEC-058.
|
|
214
|
+
* Exported so overlap.ts's rule can't drift apart from this one. */
|
|
331
215
|
export function pairReliability(a, b) {
|
|
332
216
|
return reliabilityCap(a < b ? a : b, false);
|
|
333
217
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mechanical.js","sourceRoot":"","sources":["../../src/multipr/mechanical.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mechanical.js","sourceRoot":"","sources":["../../src/multipr/mechanical.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAK9D;2EAC2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AA8D/B,wFAAwF;AACxF,MAAM,OAAO,GAAG;IACd,QAAQ,EAAE,gEAAgE;IAC1E,QAAQ,EAAE,gEAAgE;IAC1E,aAAa,EAAE,qEAAqE;IACpF,aAAa,EACX,4EAA4E;QAC5E,yCAAyC;CACnC,CAAC;AAEX,SAAS,QAAQ,CACf,KAA0B,EAC1B,IAAgB;IAEhB,+EAA+E;IAC/E,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAClB,IAAgB,EAChB,MAA2B,EAC3B,MAA2B,EAC3B,YAAoB;IAEpB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACrC,MAAM,UAAU,GACd,GAAG,eAAe,CA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AAO,WAAW,EAAE,CAAC;YACrB,OAAO;gBACL,MAAM,EAAE,qBAAqB;gBAC7B,GAAG,EACD,6CAA6C,MAAM,CAAC,WAAW,CAAC,sBAAsB;oBACtF,8CAA8C;aACjD,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,kDAAkD,EAAE,CAAC;IACzF,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED;qEACqE;AACrE,MAAM,UAAU,eAAe,CAAC,CAAkB,EAAE,CAAkB;IACpE,OAAO,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1,73 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* ## What this computes, and why it is the real computation rather than a proxy
|
|
6
|
-
*
|
|
7
|
-
* Migrations form a DAG: each revision names its parent(s), and a **head** is a
|
|
8
|
-
* revision nothing else descends from. Every migration runner refuses to run
|
|
9
|
-
* with more than one — Alembic's *"Multiple head revisions are present"* is the
|
|
10
|
-
* canonical spelling, and the equivalent exists in every tool that versions
|
|
11
|
-
* migrations at all.
|
|
12
|
-
*
|
|
13
|
-
* The obvious shortcut is to group migrations by declared parent and flag any
|
|
14
|
-
* parent claimed by two different changes. **That is wrong**, and wrong in the
|
|
15
|
-
* direction that produces false findings: a merge migration declaring two
|
|
16
|
-
* parents exists precisely to resolve such a fork, and the shortcut cannot see
|
|
17
|
-
* it. So this computes heads over the union the way the runner does. The check
|
|
18
|
-
* is only worth its Class A ceiling if it computes what the tool computes.
|
|
19
|
-
*
|
|
20
|
-
* ## Nothing here names a framework, and that is §14.6's own argument
|
|
21
|
-
*
|
|
22
|
-
* §14.6 says the SQL adapter makes this work identically across ORMs and raw-SQL
|
|
23
|
-
* tooling "rather than being written once per framework". So the input is a
|
|
24
|
-
* revision, its declared parents and where it came from — the shape every
|
|
25
|
-
* migration tool has, whatever it calls the fields. Reading `down_revision` out
|
|
26
|
-
* of an Alembic file, `dependencies` out of a Django one or a timestamp chain
|
|
27
|
-
* out of a Rails one is producer work. Rule 1: none of those words appear below
|
|
28
|
-
* this sentence.
|
|
29
|
-
*
|
|
30
|
-
* ## The class, and a disagreement with §15.2 that is already settled
|
|
31
|
-
*
|
|
32
|
-
* §15.2 lists "migration head conflict" as **Class A — deterministically
|
|
33
|
-
* verifiable, a structural fact, not an inference**. That is right about the
|
|
34
|
-
* *inference*: given both parent lists, the conclusion follows with no
|
|
35
|
-
* judgement at all. It is not right unconditionally, because the parent lists
|
|
36
|
-
* still have to be obtained, and reading `down_revision` with a regex is R0
|
|
37
|
-
* evidence however certain the arithmetic on top of it.
|
|
38
|
-
*
|
|
39
|
-
* This is the same disagreement the env/config check hit, and §15.3 already
|
|
40
|
-
* records the resolution: **the Class column is a ceiling, not a floor** —
|
|
41
|
-
* "corrected after the env/config check was built and the two disagreed". So A
|
|
42
|
-
* is what this check reaches when the records come from the framework's own
|
|
43
|
-
* migration history (DEC-115's promotion path, R3), and a source-read set lands
|
|
44
|
-
* where its evidence lands. DEC-058 at the finding level: the claim carries the
|
|
45
|
-
* resolution of its own evidence, not of the run.
|
|
46
|
-
*
|
|
47
|
-
* That is now the second check to disagree with §15.2's column in the same
|
|
48
|
-
* direction, which is worth someone's attention as a pattern rather than as two
|
|
49
|
-
* incidents.
|
|
50
|
-
*
|
|
51
|
-
* ## An unread migration is not a migration with no parents
|
|
52
|
-
*
|
|
53
|
-
* An initial migration genuinely has zero parents. A migration whose parent line
|
|
54
|
-
* could not be read has *unknown* parents. Both are "no parents in the record",
|
|
55
|
-
* and collapsing them silently corrupts the head computation — an unread
|
|
56
|
-
* migration might be exactly the merge that resolves the fork being reported.
|
|
57
|
-
*
|
|
58
|
-
* So `parents` is `readonly string[] | "unknown"` and the empty array cannot be
|
|
59
|
-
* used to mean the second thing. The distinction is made unrepresentable at the
|
|
60
|
-
* type rather than handled downstream, which is the repair
|
|
61
|
-
* `bench/lib/README.md` asks for at construction time rather than afterwards.
|
|
62
|
-
*/
|
|
1
|
+
/** §14.6 — head conflicts computed as the real DAG union computes them, not naive parent-grouping
|
|
2
|
+
* (false-positives on legit merge migrations). No framework named (rule 1). Class ceiling per
|
|
3
|
+
* §15.2/§15.3: A only when read at R3; a partial DAG (`parents: "unknown"`, never `[]`) caps at C. */
|
|
63
4
|
import type { ReliabilityClass, ResolutionLevel } from "@descryy/ir";
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* `parents` is the declared parent revision(s): empty for an initial migration,
|
|
68
|
-
* more than one for a merge migration, and `"unknown"` when the producer could
|
|
69
|
-
* not read them. **Never `[]` for the last case.**
|
|
70
|
-
*/
|
|
5
|
+
/** One migration a change adds. `parents`: empty for initial, multiple for merge, "unknown" when
|
|
6
|
+
* unreadable. Never `[]` for the unreadable case. */
|
|
71
7
|
export interface MigrationRecord {
|
|
72
8
|
readonly prId: string;
|
|
73
9
|
/** The revision identifier this migration declares for itself. */
|
|
@@ -100,37 +36,23 @@ export interface CrossPrDependency {
|
|
|
100
36
|
readonly disclosure: string;
|
|
101
37
|
}
|
|
102
38
|
export interface MigrationHeadReport {
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* conflict names every change involved rather than being reported pairwise,
|
|
106
|
-
* because three changes forking from one parent is one problem, not three.
|
|
107
|
-
*/
|
|
39
|
+
/** At most one — a single head, or not. Named across every change involved rather than
|
|
40
|
+
* reported pairwise: three changes forking from one parent is one problem, not three. */
|
|
108
41
|
readonly conflict: HeadConflict | null;
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* order is fine, and merging in the other order is not.
|
|
112
|
-
*/
|
|
42
|
+
/** Ordering constraints between changes — not conflicts. Merging in the stated order is fine;
|
|
43
|
+
* the other order isn't. */
|
|
113
44
|
readonly dependencies: readonly CrossPrDependency[];
|
|
114
45
|
/** Two changes declaring the same revision identifier. Always a defect. */
|
|
115
46
|
readonly duplicateRevisions: readonly {
|
|
116
47
|
revision: string;
|
|
117
48
|
prIds: readonly string[];
|
|
118
49
|
}[];
|
|
119
|
-
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* **Not the same as "no conflict".** A set with no migrations and a set whose
|
|
123
|
-
* migrations form a clean chain both report `conflict: null`.
|
|
124
|
-
*/
|
|
50
|
+
/** False when no change adds a migration at all. Not the same as "no conflict" — a set with
|
|
51
|
+
* no migrations and one with a clean chain both report `conflict: null`. */
|
|
125
52
|
readonly analysed: boolean;
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* A finding computed over a partial DAG is conditional on what was not read —
|
|
130
|
-
* an unread migration may be the merge that resolves it — and its class is
|
|
131
|
-
* capped at C for that reason alone, regardless of the resolution of the
|
|
132
|
-
* records that *were* read.
|
|
133
|
-
*/
|
|
53
|
+
/** False when any record's parents were unknown — the DAG read is partial. A finding over a
|
|
54
|
+
* partial DAG is capped at class C regardless of read resolution: an unread migration might
|
|
55
|
+
* be exactly the merge that resolves it. */
|
|
134
56
|
readonly complete: boolean;
|
|
135
57
|
readonly checked: {
|
|
136
58
|
readonly changes: number;
|
|
@@ -141,20 +63,11 @@ export interface MigrationHeadReport {
|
|
|
141
63
|
readonly notes: readonly string[];
|
|
142
64
|
}
|
|
143
65
|
export interface MigrationHeadOptions {
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* Supplying it enables one extra check — a migration branching from a
|
|
148
|
-
* revision that is *not* the current head is building on stale history — and
|
|
149
|
-
* its absence is disclosed rather than assumed away.
|
|
150
|
-
*/
|
|
66
|
+
/** Base branch's head revision, when known. Enables one extra check — a migration branching
|
|
67
|
+
* from a non-head revision is building on stale history; its absence is disclosed, not assumed away. */
|
|
151
68
|
readonly baseHead?: string;
|
|
152
69
|
}
|
|
153
|
-
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* Pure over records: no store, no graph, no framework. The producer that reads
|
|
157
|
-
* migration files decides `resolution`; this function propagates it.
|
|
158
|
-
*/
|
|
70
|
+
/** Head conflicts across in-flight changes. Pure over records — no store, no graph, no framework;
|
|
71
|
+
* the producer that reads migration files decides `resolution`, this just propagates it. */
|
|
159
72
|
export declare function findMigrationHeadConflicts(records: readonly MigrationRecord[], options?: MigrationHeadOptions): MigrationHeadReport;
|
|
160
73
|
//# sourceMappingURL=migration-heads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-heads.d.ts","sourceRoot":"","sources":["../../src/multipr/migration-heads.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migration-heads.d.ts","sourceRoot":"","sources":["../../src/multipr/migration-heads.ts"],"names":[],"mappings":"AAAA;;uGAEuG;AAGvG,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErE;sDACsD;AACtD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE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ED,MAAM,WAAW,oBAAoB;IACnC;6GACyG;IACzG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;6FAC6F;AAC7F,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CA+JrB"}
|
|
@@ -1,72 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* ## What this computes, and why it is the real computation rather than a proxy
|
|
6
|
-
*
|
|
7
|
-
* Migrations form a DAG: each revision names its parent(s), and a **head** is a
|
|
8
|
-
* revision nothing else descends from. Every migration runner refuses to run
|
|
9
|
-
* with more than one — Alembic's *"Multiple head revisions are present"* is the
|
|
10
|
-
* canonical spelling, and the equivalent exists in every tool that versions
|
|
11
|
-
* migrations at all.
|
|
12
|
-
*
|
|
13
|
-
* The obvious shortcut is to group migrations by declared parent and flag any
|
|
14
|
-
* parent claimed by two different changes. **That is wrong**, and wrong in the
|
|
15
|
-
* direction that produces false findings: a merge migration declaring two
|
|
16
|
-
* parents exists precisely to resolve such a fork, and the shortcut cannot see
|
|
17
|
-
* it. So this computes heads over the union the way the runner does. The check
|
|
18
|
-
* is only worth its Class A ceiling if it computes what the tool computes.
|
|
19
|
-
*
|
|
20
|
-
* ## Nothing here names a framework, and that is §14.6's own argument
|
|
21
|
-
*
|
|
22
|
-
* §14.6 says the SQL adapter makes this work identically across ORMs and raw-SQL
|
|
23
|
-
* tooling "rather than being written once per framework". So the input is a
|
|
24
|
-
* revision, its declared parents and where it came from — the shape every
|
|
25
|
-
* migration tool has, whatever it calls the fields. Reading `down_revision` out
|
|
26
|
-
* of an Alembic file, `dependencies` out of a Django one or a timestamp chain
|
|
27
|
-
* out of a Rails one is producer work. Rule 1: none of those words appear below
|
|
28
|
-
* this sentence.
|
|
29
|
-
*
|
|
30
|
-
* ## The class, and a disagreement with §15.2 that is already settled
|
|
31
|
-
*
|
|
32
|
-
* §15.2 lists "migration head conflict" as **Class A — deterministically
|
|
33
|
-
* verifiable, a structural fact, not an inference**. That is right about the
|
|
34
|
-
* *inference*: given both parent lists, the conclusion follows with no
|
|
35
|
-
* judgement at all. It is not right unconditionally, because the parent lists
|
|
36
|
-
* still have to be obtained, and reading `down_revision` with a regex is R0
|
|
37
|
-
* evidence however certain the arithmetic on top of it.
|
|
38
|
-
*
|
|
39
|
-
* This is the same disagreement the env/config check hit, and §15.3 already
|
|
40
|
-
* records the resolution: **the Class column is a ceiling, not a floor** —
|
|
41
|
-
* "corrected after the env/config check was built and the two disagreed". So A
|
|
42
|
-
* is what this check reaches when the records come from the framework's own
|
|
43
|
-
* migration history (DEC-115's promotion path, R3), and a source-read set lands
|
|
44
|
-
* where its evidence lands. DEC-058 at the finding level: the claim carries the
|
|
45
|
-
* resolution of its own evidence, not of the run.
|
|
46
|
-
*
|
|
47
|
-
* That is now the second check to disagree with §15.2's column in the same
|
|
48
|
-
* direction, which is worth someone's attention as a pattern rather than as two
|
|
49
|
-
* incidents.
|
|
50
|
-
*
|
|
51
|
-
* ## An unread migration is not a migration with no parents
|
|
52
|
-
*
|
|
53
|
-
* An initial migration genuinely has zero parents. A migration whose parent line
|
|
54
|
-
* could not be read has *unknown* parents. Both are "no parents in the record",
|
|
55
|
-
* and collapsing them silently corrupts the head computation — an unread
|
|
56
|
-
* migration might be exactly the merge that resolves the fork being reported.
|
|
57
|
-
*
|
|
58
|
-
* So `parents` is `readonly string[] | "unknown"` and the empty array cannot be
|
|
59
|
-
* used to mean the second thing. The distinction is made unrepresentable at the
|
|
60
|
-
* type rather than handled downstream, which is the repair
|
|
61
|
-
* `bench/lib/README.md` asks for at construction time rather than afterwards.
|
|
62
|
-
*/
|
|
1
|
+
/** §14.6 — head conflicts computed as the real DAG union computes them, not naive parent-grouping
|
|
2
|
+
* (false-positives on legit merge migrations). No framework named (rule 1). Class ceiling per
|
|
3
|
+
* §15.2/§15.3: A only when read at R3; a partial DAG (`parents: "unknown"`, never `[]`) caps at C. */
|
|
63
4
|
import { reliabilityCap, reliabilityNote } from "@descryy/ir";
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* Pure over records: no store, no graph, no framework. The producer that reads
|
|
68
|
-
* migration files decides `resolution`; this function propagates it.
|
|
69
|
-
*/
|
|
5
|
+
/** Head conflicts across in-flight changes. Pure over records — no store, no graph, no framework;
|
|
6
|
+
* the producer that reads migration files decides `resolution`, this just propagates it. */
|
|
70
7
|
export function findMigrationHeadConflicts(records, options = {}) {
|
|
71
8
|
const notes = [];
|
|
72
9
|
const changes = new Set(records.map((r) => r.prId)).size;
|
|
@@ -86,9 +23,8 @@ export function findMigrationHeadConflicts(records, options = {}) {
|
|
|
86
23
|
const unknown = records.filter((r) => r.parents === "unknown");
|
|
87
24
|
const known = records.filter((r) => r.parents !== "unknown");
|
|
88
25
|
const complete = unknown.length === 0;
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
// rather than being allowed to distort them.
|
|
26
|
+
// Same-revision-id defect also makes the DAG ill-formed, so it's detected before heads are
|
|
27
|
+
// computed rather than allowed to distort them.
|
|
92
28
|
const byRevision = new Map();
|
|
93
29
|
for (const r of records) {
|
|
94
30
|
const list = byRevision.get(r.revision);
|
|
@@ -100,10 +36,8 @@ export function findMigrationHeadConflicts(records, options = {}) {
|
|
|
100
36
|
const duplicateRevisions = [...byRevision]
|
|
101
37
|
.filter(([, rs]) => new Set(rs.map((r) => r.prId)).size > 1)
|
|
102
38
|
.map(([revision, rs]) => ({ revision, prIds: [...new Set(rs.map((r) => r.prId))].sort() }));
|
|
103
|
-
// A revision is a head when nothing in the merged set declares it as a parent.
|
|
104
|
-
//
|
|
105
|
-
// declares lives in the base history and has, by construction, at least one
|
|
106
|
-
// child — the migration that named it.
|
|
39
|
+
// A revision is a head when nothing in the merged set declares it as a parent. Only revisions
|
|
40
|
+
// the set declares are candidates — an undeclared parent lives in base history with a child already.
|
|
107
41
|
const claimedAsParent = new Set();
|
|
108
42
|
for (const r of known) {
|
|
109
43
|
for (const p of r.parents)
|
|
@@ -113,14 +47,12 @@ export function findMigrationHeadConflicts(records, options = {}) {
|
|
|
113
47
|
.filter((r) => !claimedAsParent.has(r.revision))
|
|
114
48
|
.map((r) => ({ revision: r.revision, prId: r.prId, file: r.file }))
|
|
115
49
|
.sort((a, b) => a.revision.localeCompare(b.revision));
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
// be asserted at the strength of its best one.
|
|
50
|
+
// Weakest record decides the class (same rule overlap scoring uses) — a claim resting on
|
|
51
|
+
// several observations can't be asserted at the strength of its best one.
|
|
119
52
|
const weakest = known.reduce((min, r) => (r.resolution < min ? r.resolution : min), 4);
|
|
120
53
|
const evidenceClass = reliabilityCap(weakest, true);
|
|
121
|
-
// A revision
|
|
122
|
-
//
|
|
123
|
-
// resolution on the read records repairs.
|
|
54
|
+
// A revision id is a name, so the R2 carve-out applies — but a partial DAG makes the
|
|
55
|
+
// conclusion conditional on something unread, which no read-record resolution repairs.
|
|
124
56
|
const reliability = complete ? evidenceClass : "C";
|
|
125
57
|
let disclosure = reliabilityNote(weakest, true);
|
|
126
58
|
if (!complete) {
|
|
@@ -138,9 +70,8 @@ export function findMigrationHeadConflicts(records, options = {}) {
|
|
|
138
70
|
disclosure,
|
|
139
71
|
}
|
|
140
72
|
: null;
|
|
141
|
-
// A migration whose parent only
|
|
142
|
-
//
|
|
143
|
-
// order leaves a revision pointing at a parent that is not there yet.
|
|
73
|
+
// A migration whose parent exists only in another open change. Not a conflict (one head still),
|
|
74
|
+
// but merging in the wrong order leaves a revision pointing at a parent not there yet.
|
|
144
75
|
const revisionOwner = new Map();
|
|
145
76
|
for (const r of records)
|
|
146
77
|
if (!revisionOwner.has(r.revision))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-heads.js","sourceRoot":"","sources":["../../src/multipr/migration-heads.ts"],"names":[],"mappings":"AAAA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