@descryy/core 0.4.0 → 0.5.1
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 +23 -11
- package/dist/contracts/engine.d.ts.map +1 -1
- package/dist/contracts/engine.js +23 -11
- package/dist/contracts/engine.js.map +1 -1
- package/dist/contracts/orphans.d.ts +18 -122
- package/dist/contracts/orphans.d.ts.map +1 -1
- package/dist/contracts/orphans.js +36 -134
- 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 +9 -90
- package/dist/graph/build.d.ts.map +1 -1
- package/dist/graph/build.js +15 -62
- 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/merge.d.ts +8 -88
- package/dist/graph/merge.d.ts.map +1 -1
- package/dist/graph/merge.js +9 -93
- 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 +4 -16
- package/dist/query/memory.d.ts.map +1 -1
- package/dist/query/memory.js +9 -22
- 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 +27 -93
- 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 +30 -104
- 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 +9 -19
- 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 +25 -126
- 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 +93 -63
- package/dist/sources/git/diff.d.ts.map +1 -1
- package/dist/sources/git/diff.js +200 -81
- 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 +33 -133
- 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 +6 -55
- package/dist/validation/attributes.d.ts.map +1 -1
- package/dist/validation/attributes.js +6 -55
- package/dist/validation/attributes.js.map +1 -1
- 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 +47 -8
- package/dist/validation/env.d.ts.map +1 -1
- package/dist/validation/env.js +119 -31
- package/dist/validation/env.js.map +1 -1
- package/dist/validation/index.d.ts +2 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -0
- 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 +11 -72
- package/dist/validation/migration-integrity.d.ts.map +1 -1
- package/dist/validation/migration-integrity.js +16 -79
- package/dist/validation/migration-integrity.js.map +1 -1
- package/dist/validation/migrations.d.ts +22 -101
- package/dist/validation/migrations.d.ts.map +1 -1
- package/dist/validation/migrations.js +19 -83
- 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/orm-registration.d.ts +106 -0
- package/dist/validation/orm-registration.d.ts.map +1 -0
- package/dist/validation/orm-registration.js +191 -0
- package/dist/validation/orm-registration.js.map +1 -0
- package/dist/validation/rollback.d.ts +10 -73
- package/dist/validation/rollback.d.ts.map +1 -1
- package/dist/validation/rollback.js +15 -82
- 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,86 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* DEC-166
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* them is why the row looked unreachable. **Source fidelity** — does a call
|
|
6
|
-
* site's text really support the edge's claim — is
|
|
7
|
-
* `bench/precision-adjudicate.mjs`'s job and is almost entirely
|
|
8
|
-
* `null`-producing (NOTE-C). **Join / identity fidelity** — does the endpoint
|
|
9
|
-
* id a caller's edge targets correspond, and *only* correspond, to the route
|
|
10
|
-
* an independent producer says is served there — is this file's job, and it
|
|
11
|
-
* is the layer the numbers this project publishes are actually made of.
|
|
12
|
-
*
|
|
13
|
-
* ## The instrument
|
|
14
|
-
*
|
|
15
|
-
* For every joined `USES_API` edge:
|
|
16
|
-
*
|
|
17
|
-
* 1. Take the **population** — every `SERVES_API`-linked route in the same
|
|
18
|
-
* repository, deduplicated by (method, normalised template). A fact
|
|
19
|
-
* produced by a *different pass* than the one under test.
|
|
20
|
-
* 2. **Exclude** any route identical in (method, template) to the edge's true
|
|
21
|
-
* target. A group of one substitutes onto itself, which is not a wrong
|
|
22
|
-
* target. This exclusion is load-bearing: without it every draw would match
|
|
23
|
-
* by construction and the control would manufacture false acceptances.
|
|
24
|
-
* 3. Substitute a different route from that population, holding the caller's
|
|
25
|
-
* raw evidence fixed.
|
|
26
|
-
* 4. Re-run the same identity computation against the substituted target.
|
|
27
|
-
* 5. **Expect refusal, always.** The substituted target's identity did not
|
|
28
|
-
* come from the rule under test and did not come from the caller — it came
|
|
29
|
-
* from an independent producer, so the harness can say why the seeded value
|
|
30
|
-
* is wrong without consulting the rule being tested. That is precisely what
|
|
31
|
-
* NOTE-C limit (a) requires and address-keyed source rules could not give.
|
|
32
|
-
*
|
|
33
|
-
* **Threshold 0%, and it is not a dial.** Wrongness here is established by an
|
|
34
|
-
* independent producer, so 0% is the honest floor rather than a number picked
|
|
35
|
-
* to accommodate anything. A non-zero acceptance is a row to read, never a
|
|
36
|
-
* ceiling to raise.
|
|
37
|
-
*
|
|
38
|
-
* ## What this control is, honestly, and what it is not
|
|
39
|
-
*
|
|
40
|
-
* On a correct implementation this control is **structurally** 0%: the
|
|
41
|
-
* caller's evidence normalises onto its own target, the population is
|
|
42
|
-
* deduplicated by that same identity, and every other group is by definition
|
|
43
|
-
* a different string. That is not a weakness dressed up as a floor — it is
|
|
44
|
-
* what a 0% floor *means*, and it is why the number is not a dial. Its value
|
|
45
|
-
* is as a **regression detector over the normalisation layer**: change
|
|
46
|
-
* `normaliseEndpointPath` (or the DEC-097 base composition, or the method
|
|
47
|
-
* half of the identity) so that it discards discriminating information, and
|
|
48
|
-
* two genuinely distinct routes collapse onto one string — at which point the
|
|
49
|
-
* caller's evidence supports a route it never called and the acceptance rate
|
|
50
|
-
* leaves zero. It is a detector for the *class* of suspect join, not a rule
|
|
51
|
-
* that says which flagged rows are wrong; a flagged row still needs a
|
|
52
|
-
* decision, the same way DEC-163's own open question does.
|
|
53
|
-
*
|
|
54
|
-
* ## Why the exclusion key is fixed while the identity under test is not
|
|
55
|
-
*
|
|
56
|
-
* `options.identity` exists so a deliberately degraded identity can be run
|
|
57
|
-
* through the same instrument and the control observed to fire — this repo's
|
|
58
|
-
* standing bar for an instrument (DEC-162's seeded-grader work): a control
|
|
59
|
-
* that has never been seen to fire proves nothing. The population's dedup and
|
|
60
|
-
* step 2's exclusion deliberately do **not** use it. They use the engine's
|
|
61
|
-
* fixed `endpointQsp`, because they are arithmetic over an independently
|
|
62
|
-
* produced route table, not the thing under test. If the exclusion used the
|
|
63
|
-
* identity under test, a degraded identity would collapse the whole
|
|
64
|
-
* population into the target's own group, every candidate would be excluded,
|
|
65
|
-
* and the run would report `UNCONTROLLABLE` — the defect hiding inside the
|
|
66
|
-
* one state that is explicitly not a pass. `join-substitution.test.ts` pins
|
|
67
|
-
* exactly that.
|
|
2
|
+
* DEC-166's join/identity control for `USES_API` (distinct from source fidelity in `bench/precision-adjudicate.mjs`, NOTE-C).
|
|
3
|
+
* Substitutes an independent route, keyed by the fixed engine identity — never `options.identity` under test — and expects refusal always.
|
|
4
|
+
* Threshold 0%: a DEC-097 normalisation regression detector, not a dial.
|
|
68
5
|
*/
|
|
69
6
|
import { endpointQsp } from "@descryy/ir";
|
|
70
7
|
/** The fixed key: the engine's identity, never the one under test. */
|
|
71
8
|
const groupKey = (method, path) => endpointQsp(method, path);
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* Deterministic and exhaustive: every candidate in the population is drawn for
|
|
76
|
-
* every caller, never a fixed-N sample. Route tables are frequently far below
|
|
77
|
-
* any fixed draw size — axum shipped 18/18, full population — and a fixed-N
|
|
78
|
-
* bar would make this layer structurally uncontrollable for exactly the
|
|
79
|
-
* repositories with the smallest, most auditable route tables.
|
|
80
|
-
*/
|
|
9
|
+
/** Runs the control over one repository's joined edges and route table.
|
|
10
|
+
* Deterministic and exhaustive — every candidate is drawn for every caller,
|
|
11
|
+
* never a fixed-N sample (axum shipped 18/18, full population). */
|
|
81
12
|
export function runJoinSubstitutionControl(callers, routes, options = {}) {
|
|
82
13
|
const identity = options.identity ?? endpointQsp;
|
|
83
|
-
//
|
|
14
|
+
// Population, deduplicated by the engine's own identity.
|
|
84
15
|
const population = new Map();
|
|
85
16
|
for (const route of routes) {
|
|
86
17
|
const key = groupKey(route.method, route.path);
|
|
@@ -96,9 +27,7 @@ export function runJoinSubstitutionControl(callers, routes, options = {}) {
|
|
|
96
27
|
flagged: [],
|
|
97
28
|
unreproducible: [],
|
|
98
29
|
};
|
|
99
|
-
//
|
|
100
|
-
// names them: a repository with neither routes nor callers is first of all a
|
|
101
|
-
// repository that serves nothing.
|
|
30
|
+
// Route legs checked before caller leg, per DEC-166's order.
|
|
102
31
|
if (population.size === 0) {
|
|
103
32
|
return {
|
|
104
33
|
controllable: false,
|
|
@@ -137,12 +66,10 @@ export function runJoinSubstitutionControl(callers, routes, options = {}) {
|
|
|
137
66
|
let substitutions = 0;
|
|
138
67
|
let accepted = 0;
|
|
139
68
|
for (const caller of callers) {
|
|
140
|
-
//
|
|
141
|
-
// composition is `basePath + written`; DEC-170's query strip and DEC-163's
|
|
142
|
-
// method+template identity are inside `identity` itself.
|
|
69
|
+
// Caller's raw evidence, recomposed per DEC-097; DEC-170/DEC-163 are inside `identity`.
|
|
143
70
|
const derived = identity(caller.method, `${caller.basePath}${caller.written}`);
|
|
144
71
|
const trueIdentity = identity(caller.targetMethod, caller.targetPath);
|
|
145
|
-
//
|
|
72
|
+
// Exclude the true target's own group, under the fixed key.
|
|
146
73
|
const excluded = groupKey(caller.targetMethod, caller.targetPath);
|
|
147
74
|
if (derived !== trueIdentity) {
|
|
148
75
|
unreproducible.push({ at: caller.at, derived, trueTarget: excluded });
|
|
@@ -151,8 +78,7 @@ export function runJoinSubstitutionControl(callers, routes, options = {}) {
|
|
|
151
78
|
if (key === excluded)
|
|
152
79
|
continue;
|
|
153
80
|
substitutions += 1;
|
|
154
|
-
//
|
|
155
|
-
// against the substituted target, expect refusal.
|
|
81
|
+
// Hold the caller's evidence fixed, re-run against the substituted target.
|
|
156
82
|
if (identity(route.method, route.path) === derived) {
|
|
157
83
|
accepted += 1;
|
|
158
84
|
flagged.push({
|
|
@@ -165,11 +91,8 @@ export function runJoinSubstitutionControl(callers, routes, options = {}) {
|
|
|
165
91
|
}
|
|
166
92
|
}
|
|
167
93
|
return {
|
|
168
|
-
//
|
|
169
|
-
// the
|
|
170
|
-
// is structural rather than hoped for. Asserted through the returned flag
|
|
171
|
-
// anyway, so a future change to the population arithmetic cannot turn an
|
|
172
|
-
// empty draw into a silent pass.
|
|
94
|
+
// population >= 2 guarantees substitutions > 0 structurally; asserted via
|
|
95
|
+
// the returned flag so a future arithmetic change can't silently pass.
|
|
173
96
|
controllable: substitutions > 0,
|
|
174
97
|
...(substitutions > 0
|
|
175
98
|
? {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-substitution.js","sourceRoot":"","sources":["../../src/validation/join-substitution.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"join-substitution.js","sourceRoot":"","sources":["../../src/validation/join-substitution.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAiF1C,sEAAsE;AACtE,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,IAAY,EAAU,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAErF;;oEAEoE;AACpE,MAAM,UAAU,0BAA0B,CACxC,OAAsC,EACtC,MAAoC,EACpC,UAAmC,EAAE;IAErC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,WAAW,CAAC;IAEjD,yDAAyD;IACzD,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B,CAAC;IACxD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,UAAU,EAAE,UAAU,CAAC,IAAI;QAC3B,OAAO,EAAE,OAAO,CAAC,MAAM;QACvB,aAAa,E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AC,CAAC,QAAQ,GAAG,aAAa;QACrE,OAAO;QACP,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -1,54 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `attrs.migrationDir` on a file-scoped node.
|
|
5
|
-
*
|
|
6
|
-
* UAT round 3's field report named this the third of four defects Descry
|
|
7
|
-
* missed on a genuine feature: a migration file sat in the repository root
|
|
8
|
-
* instead of the project's migrations directory, so the migration tool never
|
|
9
|
-
* saw it, and its declared parent was off the branch's actual lineage. Both
|
|
10
|
-
* are provable from the graph alone — a contradiction between two producers
|
|
11
|
-
* that must agree, not an inference about behaviour — which is what makes them
|
|
12
|
-
* defects rather than leads.
|
|
13
|
-
*
|
|
14
|
-
* ## The judgement this check makes that the producer deliberately did not
|
|
15
|
-
*
|
|
16
|
-
* The adapter records `migrationDir` — the file's own containing directory,
|
|
17
|
-
* a POSIX-path detail with one right answer — and leaves *which* directory is
|
|
18
|
-
* "the" project's migrations directory to whoever consumes it, because that is
|
|
19
|
-
* a judgement, not a derivation. This module makes that judgement the only way
|
|
20
|
-
* it can be made without naming a migration tool: from the graph itself. The
|
|
21
|
-
* directory most of the migration-revision-carrying modules agree on **is**
|
|
22
|
-
* the project's migrations directory, empirically, the same way `env.ts`'s
|
|
23
|
-
* coverage guard treats a repository's own declaration surface as ground
|
|
24
|
-
* truth rather than a hardcoded list of platform variable names. A single
|
|
25
|
-
* outlier against that consensus is exactly the orphaned-migration shape;
|
|
26
|
-
* asking the question needs no literal path and names no framework.
|
|
27
|
-
*
|
|
28
|
-
* A repository with too few migration-revision-carrying modules to form a
|
|
29
|
-
* consensus, or one split evenly between two directories, cannot answer this
|
|
30
|
-
* question honestly — so it does not answer it. See `MIN_MODULES_FOR_CONSENSUS`
|
|
31
|
-
* and the tie handling below. Precision over recall: a wrong consensus would
|
|
32
|
-
* turn every legitimate migration in a project's true directory into a false
|
|
33
|
-
* "outside the migrations directory" finding.
|
|
34
|
-
*
|
|
35
|
-
* ## The revision chain, and its four cases
|
|
36
|
-
*
|
|
37
|
-
* `migrationDownRevision` is `null` for a declared root (never a finding —
|
|
38
|
-
* every chain starts somewhere), a string for a single parent, an array for a
|
|
39
|
-
* merge revision (each element checked independently), and the literal string
|
|
40
|
-
* `"unknown"` when the producer could not read it as any of the first three.
|
|
41
|
-
* `"unknown"` is not treated as `null`, the same "not a synonym" rule
|
|
42
|
-
* `MigrationOp.section` already carries one field over: an unreadable chain is
|
|
43
|
-
* refused, counted and disclosed, never reported as broken.
|
|
44
|
-
*/
|
|
1
|
+
/** Migration-integrity: location + revision-chain findings from migrationRevision/
|
|
2
|
+
* migrationDownRevision/migrationDir (UAT round 3's 3rd of 4 missed defects). Migrations
|
|
3
|
+
* directory is inferred by graph consensus, never hardcoded; `"unknown"` downRevision is refused, never null. */
|
|
45
4
|
import type { ResolutionLevel } from "@descryy/ir";
|
|
46
5
|
import type { AdjacencyProvider, QueryResult } from "../query/provider.ts";
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
* revision, each element its own parent. `"unknown"` — the producer could not
|
|
50
|
-
* read this as any of the three; refuse to judge, never a synonym for `null`.
|
|
51
|
-
*/
|
|
6
|
+
/** null = declared root. string = single parent. array = merge revision. "unknown" = unreadable
|
|
7
|
+
* as any of the three — refused, never a synonym for null. */
|
|
52
8
|
export type MigrationDownRevision = string | readonly string[] | null | "unknown";
|
|
53
9
|
export interface MigrationRevisionInfo {
|
|
54
10
|
readonly revision: string;
|
|
@@ -93,31 +49,14 @@ export interface MigrationIntegrityOptions {
|
|
|
93
49
|
/** Cap on file-scoped nodes enumerated. Truncation is reported. */
|
|
94
50
|
readonly limit?: number;
|
|
95
51
|
}
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* A `downRevision` that is not `null`, `"unknown"`, a non-empty string or a
|
|
101
|
-
* non-empty array of strings is **dropped, not guessed at** — defaulting it to
|
|
102
|
-
* root or to a single parent would manufacture a chain claim the producer
|
|
103
|
-
* never made.
|
|
104
|
-
*/
|
|
52
|
+
/** Pulls migrationRevision/migrationDownRevision/migrationDir off a node, refusing anything
|
|
53
|
+
* malformed. A downRevision that isn't null/"unknown"/a non-empty string or string array is
|
|
54
|
+
* dropped, not guessed at — defaulting it would manufacture a chain claim never made. */
|
|
105
55
|
export declare function readMigrationRevision(attrs: Readonly<Record<string, unknown>> | undefined, file: string, resolution: ResolutionLevel): MigrationRevisionInfo | null;
|
|
106
56
|
export declare function checkMigrationIntegrity(provider: AdjacencyProvider, options?: MigrationIntegrityOptions): QueryResult<MigrationIntegrityReport>;
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* this graph declares as its parent; more than one means the chain has
|
|
111
|
-
* forked, the shape that needs a manual merge revision to resolve.
|
|
112
|
-
*
|
|
113
|
-
* Computed over the graph as built, not as a comparison of base's and head's
|
|
114
|
-
* migration state separately — the graph already carries every migration
|
|
115
|
-
* this run resolved, forked or not, and that is the fact this check reports.
|
|
116
|
-
* A down-revision this run could not read (`"unknown"`) is not treated as
|
|
117
|
-
* "no parent": it is counted and disclosed, because treating it as absent
|
|
118
|
-
* could silently promote a revision to "head" that genuinely has a child
|
|
119
|
-
* this run only failed to read.
|
|
120
|
-
*/
|
|
57
|
+
/** `cross_pr`'s migration-heads check: would merging these leave more than one head? Computed
|
|
58
|
+
* over the graph as built, not base-vs-head separately. An unreadable ("unknown") down-revision
|
|
59
|
+
* is counted and disclosed, never treated as absent — that could wrongly promote a revision with an unread child. */
|
|
121
60
|
export interface MigrationHeadsReport {
|
|
122
61
|
/** Revisions with no other migration in this graph declaring them as a parent. More than one means a fork. */
|
|
123
62
|
readonly heads: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-integrity.d.ts","sourceRoot":"","sources":["../../src/validation/migration-integrity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,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AW,CAAC,oBAAoB,CAAC,CAiDnC"}
|
|
@@ -1,68 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* `attrs.migrationDir` on a file-scoped node.
|
|
5
|
-
*
|
|
6
|
-
* UAT round 3's field report named this the third of four defects Descry
|
|
7
|
-
* missed on a genuine feature: a migration file sat in the repository root
|
|
8
|
-
* instead of the project's migrations directory, so the migration tool never
|
|
9
|
-
* saw it, and its declared parent was off the branch's actual lineage. Both
|
|
10
|
-
* are provable from the graph alone — a contradiction between two producers
|
|
11
|
-
* that must agree, not an inference about behaviour — which is what makes them
|
|
12
|
-
* defects rather than leads.
|
|
13
|
-
*
|
|
14
|
-
* ## The judgement this check makes that the producer deliberately did not
|
|
15
|
-
*
|
|
16
|
-
* The adapter records `migrationDir` — the file's own containing directory,
|
|
17
|
-
* a POSIX-path detail with one right answer — and leaves *which* directory is
|
|
18
|
-
* "the" project's migrations directory to whoever consumes it, because that is
|
|
19
|
-
* a judgement, not a derivation. This module makes that judgement the only way
|
|
20
|
-
* it can be made without naming a migration tool: from the graph itself. The
|
|
21
|
-
* directory most of the migration-revision-carrying modules agree on **is**
|
|
22
|
-
* the project's migrations directory, empirically, the same way `env.ts`'s
|
|
23
|
-
* coverage guard treats a repository's own declaration surface as ground
|
|
24
|
-
* truth rather than a hardcoded list of platform variable names. A single
|
|
25
|
-
* outlier against that consensus is exactly the orphaned-migration shape;
|
|
26
|
-
* asking the question needs no literal path and names no framework.
|
|
27
|
-
*
|
|
28
|
-
* A repository with too few migration-revision-carrying modules to form a
|
|
29
|
-
* consensus, or one split evenly between two directories, cannot answer this
|
|
30
|
-
* question honestly — so it does not answer it. See `MIN_MODULES_FOR_CONSENSUS`
|
|
31
|
-
* and the tie handling below. Precision over recall: a wrong consensus would
|
|
32
|
-
* turn every legitimate migration in a project's true directory into a false
|
|
33
|
-
* "outside the migrations directory" finding.
|
|
34
|
-
*
|
|
35
|
-
* ## The revision chain, and its four cases
|
|
36
|
-
*
|
|
37
|
-
* `migrationDownRevision` is `null` for a declared root (never a finding —
|
|
38
|
-
* every chain starts somewhere), a string for a single parent, an array for a
|
|
39
|
-
* merge revision (each element checked independently), and the literal string
|
|
40
|
-
* `"unknown"` when the producer could not read it as any of the first three.
|
|
41
|
-
* `"unknown"` is not treated as `null`, the same "not a synonym" rule
|
|
42
|
-
* `MigrationOp.section` already carries one field over: an unreadable chain is
|
|
43
|
-
* refused, counted and disclosed, never reported as broken.
|
|
44
|
-
*/
|
|
1
|
+
/** Migration-integrity: location + revision-chain findings from migrationRevision/
|
|
2
|
+
* migrationDownRevision/migrationDir (UAT round 3's 3rd of 4 missed defects). Migrations
|
|
3
|
+
* directory is inferred by graph consensus, never hardcoded; `"unknown"` downRevision is refused, never null. */
|
|
45
4
|
import { fileScopedNodes } from "./nodes.js";
|
|
46
5
|
import { MIGRATION_DIRECTORY } from "./migrations.js";
|
|
47
6
|
const DEFAULT_MAX_FINDINGS = 25;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* not a consensus — a repository with one migration cannot disagree with
|
|
51
|
-
* itself, and two tied at one apiece is not a majority either way.
|
|
52
|
-
*/
|
|
7
|
+
/** Below this many modules, a directory count isn't a consensus — one migration can't disagree
|
|
8
|
+
* with itself, and two tied at one apiece isn't a majority either way. */
|
|
53
9
|
const MIN_MODULES_FOR_CONSENSUS = 2;
|
|
54
10
|
function isNonEmptyStringArray(value) {
|
|
55
11
|
return Array.isArray(value) && value.length > 0 && value.every((v) => typeof v === "string" && v !== "");
|
|
56
12
|
}
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* A `downRevision` that is not `null`, `"unknown"`, a non-empty string or a
|
|
62
|
-
* non-empty array of strings is **dropped, not guessed at** — defaulting it to
|
|
63
|
-
* root or to a single parent would manufacture a chain claim the producer
|
|
64
|
-
* never made.
|
|
65
|
-
*/
|
|
13
|
+
/** Pulls migrationRevision/migrationDownRevision/migrationDir off a node, refusing anything
|
|
14
|
+
* malformed. A downRevision that isn't null/"unknown"/a non-empty string or string array is
|
|
15
|
+
* dropped, not guessed at — defaulting it would manufacture a chain claim never made. */
|
|
66
16
|
export function readMigrationRevision(attrs, file, resolution) {
|
|
67
17
|
if (attrs === undefined)
|
|
68
18
|
return null;
|
|
@@ -90,15 +40,9 @@ export function readMigrationRevision(attrs, file, resolution) {
|
|
|
90
40
|
function nameDir(dir) {
|
|
91
41
|
return dir === "" ? "the repository root" : dir;
|
|
92
42
|
}
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* A tie is broken toward a directory matching the generic migration-directory
|
|
97
|
-
* *shape* `migrations.ts` already matches for the format half of this check's
|
|
98
|
-
* sibling — a shape check, not a guess at which one is "real". A tie that
|
|
99
|
-
* survives that is genuinely ambiguous and is refused, disclosed, never
|
|
100
|
-
* guessed.
|
|
101
|
-
*/
|
|
43
|
+
/** The directory most modules agree on. A tie is broken toward one matching migrations.ts's
|
|
44
|
+
* generic directory shape (a shape check, not a guess). A tie surviving that is genuinely
|
|
45
|
+
* ambiguous — refused and disclosed, never guessed. */
|
|
102
46
|
function consensusDirectory(infos) {
|
|
103
47
|
if (infos.length < MIN_MODULES_FOR_CONSENSUS) {
|
|
104
48
|
return {
|
|
@@ -127,12 +71,8 @@ function consensusDirectory(infos) {
|
|
|
127
71
|
"MIGRATION_OUTSIDE_DIRECTORY did not run.",
|
|
128
72
|
};
|
|
129
73
|
}
|
|
130
|
-
/**
|
|
131
|
-
*
|
|
132
|
-
* triple in the graph, from a file-scoped node — the shared carrier both
|
|
133
|
-
* `checkMigrationIntegrity` and `checkMigrationHeads` read, so the two checks
|
|
134
|
-
* cannot disagree about what counts as "a migration node".
|
|
135
|
-
*/
|
|
74
|
+
/** Every well-formed migration triple in the graph — shared by `checkMigrationIntegrity` and
|
|
75
|
+
* `checkMigrationHeads` so the two checks can't disagree on what counts as a migration node. */
|
|
136
76
|
function collectMigrationRevisions(provider, limit) {
|
|
137
77
|
const nodes = fileScopedNodes(provider, limit);
|
|
138
78
|
const infos = [];
|
|
@@ -151,16 +91,13 @@ export function checkMigrationIntegrity(provider, options = {}) {
|
|
|
151
91
|
const maxFindings = options.maxFindings ?? DEFAULT_MAX_FINDINGS;
|
|
152
92
|
const scoped = options.files === undefined ? null : new Set(options.files);
|
|
153
93
|
const notes = [];
|
|
154
|
-
// The revision registry spans the whole graph even when
|
|
155
|
-
//
|
|
156
|
-
// diff, and consensus about the project's migrations directory is a fact
|
|
157
|
-
// about the whole repository, not about which files changed.
|
|
94
|
+
// The revision registry spans the whole graph even when scoped to a diff — a down_revision
|
|
95
|
+
// often names a migration outside the diff, and directory consensus is a whole-repo fact.
|
|
158
96
|
const { infos, truncated: nodesTruncated } = collectMigrationRevisions(provider, options.limit);
|
|
159
97
|
const ran = infos.length > 0;
|
|
160
98
|
const revisionProvidedBy = new Map();
|
|
161
99
|
for (const info of infos) {
|
|
162
|
-
// First file wins
|
|
163
|
-
// precedent as env.ts's requiredReads.
|
|
100
|
+
// First file wins for a stable answer between runs — same precedent as env.ts's requiredReads.
|
|
164
101
|
const existing = revisionProvidedBy.get(info.revision);
|
|
165
102
|
if (existing === undefined || info.file < existing.file)
|
|
166
103
|
revisionProvidedBy.set(info.revision, info);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-integrity.js","sourceRoot":"","sources":["../../src/validation/migration-integrity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migration-integrity.js","sourceRoot":"","sources":["../../src/validation/migration-integrity.ts"],"names":[],"mappings":"AAAA;;kHAEkH;AAKlH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAsDtD,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;2EAC2E;AAC3E,MAAM,yBAAyB,GAAG,CAAC,CAAC;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,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,CAAC;IACvE,OAAO;QACL,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,mBAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE;QACvF,KAAK;QACL,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,61 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* is: **zero `.sql` files inside a migration directory across fifteen reference
|
|
9
|
-
* repositories**, against 3,301 migrations written as program code. The code half
|
|
10
|
-
* arrives through `attrs.migrationOps` and is an adapter's to produce.
|
|
11
|
-
*
|
|
12
|
-
* ## The scope fence, which is what makes this Class A
|
|
13
|
-
*
|
|
14
|
-
* Appendix B.3 settles rollback readiness as Class A against two sources that
|
|
15
|
-
* called it B, and the resolution turns entirely on what is claimed:
|
|
16
|
-
*
|
|
17
|
-
* > **"this migration contains a destructive operation"** — a fact, and a
|
|
18
|
-
* > deterministic pattern match establishes it.
|
|
19
|
-
* >
|
|
20
|
-
* > **"this migration is unsafe to roll back"** — an inference, requiring the
|
|
21
|
-
* > consumer-impact analysis §15.3 explicitly separates this check from.
|
|
22
|
-
*
|
|
23
|
-
* Every sentence produced here is written to stay behind that fence. The finding
|
|
24
|
-
* names the operation, the object and the line; it does not characterise risk.
|
|
25
|
-
*
|
|
26
|
-
* ## What counts as destructive, and the things deliberately left out
|
|
27
|
-
*
|
|
28
|
-
* Only operations that **destroy data**. `DROP INDEX`, `DROP CONSTRAINT`,
|
|
29
|
-
* `DROP VIEW`, `DROP TRIGGER` and `DROP FUNCTION` are all recoverable by
|
|
30
|
-
* re-running the definition and none of them loses a row, so including them
|
|
31
|
-
* would triple the finding count with statements nobody needs to see. A rename
|
|
32
|
-
* is carried separately: the data survives, so it is not the same claim as a
|
|
33
|
-
* drop, but every reader of the old name breaks.
|
|
34
|
-
*
|
|
35
|
-
* ## Section detection is tool-blind on purpose
|
|
36
|
-
*
|
|
37
|
-
* Directional migrations mark their halves with a comment directive. Matching a
|
|
38
|
-
* specific tool's spelling would put that tool's name in engine code — rule 1,
|
|
39
|
-
* the violation the boundary lint already caught once in this directory. So the
|
|
40
|
-
* **shape** is matched instead: a comment carrying a directive word followed by
|
|
41
|
-
* an up/down keyword, in either the `+name Up` form or a bare `-- Up`. Any tool
|
|
42
|
-
* using that shape works; none of them is named.
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* What an operation does to data.
|
|
46
|
-
*
|
|
47
|
-
* `RENAME` is separate because it is a different claim: the rows survive, and
|
|
48
|
-
* what breaks is every reader of the old name.
|
|
49
|
-
*/
|
|
1
|
+
/** §15.3's rollback-readiness check, format half — DDL is a format, not a
|
|
2
|
+
* language, so it stays below the IR boundary. DEC-122: zero `.sql` files
|
|
3
|
+
* across 15 repos vs 3,301 migrations as code (adapter's territory).
|
|
4
|
+
* Class A (Appx B.3): reports only "this drops data", never the inference
|
|
5
|
+
* "unsafe to roll back". Section markers matched by shape, not tool name. */
|
|
6
|
+
/** What an operation does to data. `RENAME` is separate — rows survive,
|
|
7
|
+
* but every reader of the old name breaks. */
|
|
50
8
|
export type DestructiveKind = "DROP_TABLE" | "DROP_COLUMN" | "DROP_SCHEMA" | "TRUNCATE" | "RENAME";
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* `reverse` is the whole reason this field exists — a drop there undoes the
|
|
55
|
-
* forward migration and is supposed to be present. `unknown` is not a synonym
|
|
56
|
-
* for `forward`: it means the file declares no direction, and DEC-122 refuses to
|
|
57
|
-
* report on it.
|
|
58
|
-
*/
|
|
9
|
+
/** Which half of a directional migration a statement sits in. `reverse` is
|
|
10
|
+
* supposed to contain drops (undoing forward). `unknown` ≠ `forward` — no
|
|
11
|
+
* declared direction, and DEC-122 refuses to report on it. */
|
|
59
12
|
export type MigrationSection = "forward" | "reverse" | "unknown";
|
|
60
13
|
export interface MigrationOp {
|
|
61
14
|
readonly kind: DestructiveKind;
|
|
@@ -69,12 +22,8 @@ export interface MigrationOp {
|
|
|
69
22
|
export interface MigrationFile {
|
|
70
23
|
readonly file: string;
|
|
71
24
|
readonly ops: readonly MigrationOp[];
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* discounted — and so the *order* is known. Create-then-drop is a temporary
|
|
75
|
-
* object; drop-then-create is an idempotent setup script. Different reasons,
|
|
76
|
-
* and without the line they are indistinguishable.
|
|
77
|
-
*/
|
|
25
|
+
/** Objects this file creates, with line — so a later drop of one can be
|
|
26
|
+
* discounted. Create-then-drop is temporary; drop-then-create is idempotent setup. */
|
|
78
27
|
readonly creates: readonly {
|
|
79
28
|
readonly name: string;
|
|
80
29
|
readonly line: number;
|
|
@@ -92,52 +41,24 @@ export interface MigrationScan {
|
|
|
92
41
|
export interface MigrationScanOptions {
|
|
93
42
|
readonly maxDepth?: number;
|
|
94
43
|
readonly maxFiles?: number;
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* config-surface walk through `skipDirectory`, so the two cannot disagree about
|
|
98
|
-
* what counts as vendored.
|
|
99
|
-
*/
|
|
44
|
+
/** Adapters' declared noise dirs (DEC-110); shared with the config-surface
|
|
45
|
+
* walk via `skipDirectory` so the two can't disagree. */
|
|
100
46
|
readonly noiseDirectories?: readonly string[];
|
|
101
47
|
}
|
|
102
|
-
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* Path-based rather than content-based, and named after what the directory *is*
|
|
106
|
-
* rather than after any tool that creates it. A `.sql` file in a `schema/`
|
|
107
|
-
* directory is a definition, not a change, and reading it as one would report
|
|
108
|
-
* every `CREATE`-then-`DROP` setup script in the repository.
|
|
109
|
-
*/
|
|
110
|
-
/**
|
|
111
|
-
* Exported for `migration-integrity.ts`'s directory tie-break: a generic
|
|
112
|
-
* migration-directory *shape*, not a language or framework name, so reusing
|
|
113
|
-
* it there names no more than this file already does.
|
|
114
|
-
*/
|
|
48
|
+
/** A directory holding migrations — path-based, not content-based, so a
|
|
49
|
+
* `.sql` file in `schema/` (a definition, not a change) isn't misread.
|
|
50
|
+
* Exported for `migration-integrity.ts`'s tie-break: a generic shape, no tool/framework name. */
|
|
115
51
|
export declare const MIGRATION_DIRECTORY: RegExp;
|
|
116
52
|
interface Statement {
|
|
117
53
|
readonly text: string;
|
|
118
54
|
readonly line: number;
|
|
119
55
|
}
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* A plain split would cut a statement in half at the first semicolon inside a
|
|
125
|
-
* default value, which is a real thing to find in a migration.
|
|
126
|
-
*
|
|
127
|
-
* **This duplicates the splitter in `adapter-sql`, deliberately and with the
|
|
128
|
-
* cost recorded** (DEC-122). `@descryy/core` cannot depend on an adapter —
|
|
129
|
-
* adapters depend on core — so the alternative to a second copy is inverting the
|
|
130
|
-
* boundary the repository split exists to hold. If a third caller appears, the
|
|
131
|
-
* right home is `@descryy/ir`.
|
|
132
|
-
*/
|
|
56
|
+
/** Splits DDL on `;`, skipping separators inside strings/identifiers/comments.
|
|
57
|
+
* Duplicates `adapter-sql`'s splitter (core can't depend on an adapter,
|
|
58
|
+
* DEC-122) — a third caller should move this to `@descryy/ir`. */
|
|
133
59
|
export declare function statements(sql: string): readonly Statement[];
|
|
134
|
-
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* Returns `null` for everything unrecognised, which is the overwhelming
|
|
138
|
-
* majority and is correct: an unclassified statement is not a silent pass, it is
|
|
139
|
-
* counted by the caller and disclosed.
|
|
140
|
-
*/
|
|
60
|
+
/** Classifies one statement; `null` for unrecognised (the majority) is
|
|
61
|
+
* correct — the caller counts and discloses it, not a silent pass. */
|
|
141
62
|
export declare function classifyStatement(text: string, line: number, section: MigrationSection): MigrationOp | null;
|
|
142
63
|
/** Read one migration file's operations, tracking which section each sits in. */
|
|
143
64
|
export declare function readMigration(text: string): Omit<MigrationFile, "file">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/validation/migrations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/validation/migrations.ts"],"names":[],"mappings":"AAAA;;;;8EAI8E;AAO9E;+CAC+C;AAC/C,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,aAAa,GACb,aAAa,GACb,UAAU,GACV,QAAQ,CAAC;AAEb;;+DAE+D;AAC/D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,sEAAsE;IACtE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,SAAS,WAAW,EAAE,CAAC;IACrC;2FACuF;IACvF,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC9E,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,E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