@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,80 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* it names nothing the Canonical IR boundary forbids. Same limit, too — this half
|
|
7
|
-
* sees only what is written as DDL, and DEC-122 measured exactly how little that
|
|
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
|
-
*/
|
|
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. */
|
|
44
6
|
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
45
7
|
import { join, relative, sep } from "node:path";
|
|
46
8
|
import { skipDirectory } from "./sources.js";
|
|
47
9
|
const DEFAULT_MAX_DEPTH = 8;
|
|
48
10
|
const DEFAULT_MAX_FILES = 20_000;
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* Path-based rather than content-based, and named after what the directory *is*
|
|
53
|
-
* rather than after any tool that creates it. A `.sql` file in a `schema/`
|
|
54
|
-
* directory is a definition, not a change, and reading it as one would report
|
|
55
|
-
* every `CREATE`-then-`DROP` setup script in the repository.
|
|
56
|
-
*/
|
|
57
|
-
/**
|
|
58
|
-
* Exported for `migration-integrity.ts`'s directory tie-break: a generic
|
|
59
|
-
* migration-directory *shape*, not a language or framework name, so reusing
|
|
60
|
-
* it there names no more than this file already does.
|
|
61
|
-
*/
|
|
11
|
+
/** A directory holding migrations — path-based, not content-based, so a
|
|
12
|
+
* `.sql` file in `schema/` (a definition, not a change) isn't misread.
|
|
13
|
+
* Exported for `migration-integrity.ts`'s tie-break: a generic shape, no tool/framework name. */
|
|
62
14
|
export const MIGRATION_DIRECTORY = /(^|\/)(migrations?|migrate|versions|changelogs?)(\/|$)/i;
|
|
63
15
|
/** A directive comment carrying a direction, in either common shape. */
|
|
64
16
|
const SECTION_MARKER = /^\s*--\s*(?:\+\w+\s+)?(up|down)\b/i;
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* A plain split would cut a statement in half at the first semicolon inside a
|
|
70
|
-
* default value, which is a real thing to find in a migration.
|
|
71
|
-
*
|
|
72
|
-
* **This duplicates the splitter in `adapter-sql`, deliberately and with the
|
|
73
|
-
* cost recorded** (DEC-122). `@descryy/core` cannot depend on an adapter —
|
|
74
|
-
* adapters depend on core — so the alternative to a second copy is inverting the
|
|
75
|
-
* boundary the repository split exists to hold. If a third caller appears, the
|
|
76
|
-
* right home is `@descryy/ir`.
|
|
77
|
-
*/
|
|
17
|
+
/** Splits DDL on `;`, skipping separators inside strings/identifiers/comments.
|
|
18
|
+
* Duplicates `adapter-sql`'s splitter (core can't depend on an adapter,
|
|
19
|
+
* DEC-122) — a third caller should move this to `@descryy/ir`. */
|
|
78
20
|
export function statements(sql) {
|
|
79
21
|
const found = [];
|
|
80
22
|
let buffer = "";
|
|
@@ -141,23 +83,14 @@ export function statements(sql) {
|
|
|
141
83
|
function unquote(identifier) {
|
|
142
84
|
return identifier.replace(/^["`[]+|["`\]]+$/g, "").toLowerCase();
|
|
143
85
|
}
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* Returns `null` for everything unrecognised, which is the overwhelming
|
|
148
|
-
* majority and is correct: an unclassified statement is not a silent pass, it is
|
|
149
|
-
* counted by the caller and disclosed.
|
|
150
|
-
*/
|
|
86
|
+
/** Classifies one statement; `null` for unrecognised (the majority) is
|
|
87
|
+
* correct — the caller counts and discloses it, not a silent pass. */
|
|
151
88
|
export function classifyStatement(text, line, section) {
|
|
152
89
|
const flat = text.replace(/\s+/g, " ").trim();
|
|
153
90
|
const guarded = /\bIF\s+EXISTS\b/i.test(flat);
|
|
154
|
-
// ALTER TABLE … DROP COLUMN
|
|
155
|
-
//
|
|
156
|
-
//
|
|
157
|
-
// The negative lookahead is not decoration. `ALTER TABLE t DROP CONSTRAINT c`
|
|
158
|
-
// has the same shape with the keyword omitted, and without the guard the
|
|
159
|
-
// constraint name is read as a column name — a data-loss claim about a
|
|
160
|
-
// statement that loses no data. Found by a test, which is where it belongs.
|
|
91
|
+
// ALTER TABLE … DROP COLUMN checked before bare DROP (substring match).
|
|
92
|
+
// Negative lookahead matters: `DROP CONSTRAINT c` without it reads as a
|
|
93
|
+
// column drop — a false data-loss claim. Caught by a test.
|
|
161
94
|
const dropColumn = /^ALTER\s+TABLE\s+(?:IF\s+EXISTS\s+)?([\w."`[\]]+)\s+DROP\s+(?:COLUMN\s+)?(?:IF\s+EXISTS\s+)?(?!CONSTRAINT\b|INDEX\b|CHECK\b|PRIMARY\b|FOREIGN\b|UNIQUE\b|DEFAULT\b|NOT\b|PARTITION\b)([\w."`[\]]+)/i.exec(flat);
|
|
162
95
|
if (dropColumn !== null) {
|
|
163
96
|
return {
|
|
@@ -277,6 +210,9 @@ export function scanMigrations(root, options = {}) {
|
|
|
277
210
|
directory = statSync(full).isDirectory();
|
|
278
211
|
}
|
|
279
212
|
catch {
|
|
213
|
+
// Same as an unreadable dir, on one entry (broken symlink, perm error,
|
|
214
|
+
// race). Disclosed via `unreadable` (rule 7), not dropped silently.
|
|
215
|
+
unreadable.push(rel(root, full));
|
|
280
216
|
continue;
|
|
281
217
|
}
|
|
282
218
|
if (directory) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/validation/migrations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/validation/migrations.ts"],"names":[],"mappings":"AAAA;;;;8EAI8E;AAE9E,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoD7C,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC;;kGAEkG;AAClG,MAAM,CAAC,MAAM,mBAAmB,GAAG,yDAAyD,CAAC;AAE7F,wEAAwE;AACxE,MAAM,cAAc,GAAG,oCAAoC,CAAC;AAO5D;;mEAEmE;AACnE,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,KAAK,GAAkB,IAAI,CAAC;IAChC,IAAI,OAAO,GAA4B,IAAI,CAAC;IAE5C,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAC/E,MAAM,GAAG,EAAE,CAAC;QACZ,SAAS,GAAG,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,M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BAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,SAAS;YAE9C,IAAI,IAAY,CAAC;YACjB,IAAI,CAAC;gBACH,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACpC,CAAC;YAAC,MAAM,CAAC;gBACP,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACtB,SAAS;YACX,CAAC;YACD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5B,QAAQ,IAAI,CAAC,CAAC;gBACd,SAAS;YACX,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACd,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACnD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACpD,CAAC;AAED,SAAS,GAAG,CAAC,IAAY,EAAE,IAAY;IACrC,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/B,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -10,7 +10,9 @@ import type { AdjacencyProvider } from "../query/provider.ts";
|
|
|
10
10
|
* The node types that stand for a whole file.
|
|
11
11
|
*
|
|
12
12
|
* **Every shipped adapter emits `MODULE` for a file and not one of them emits
|
|
13
|
-
* `FILE`** — verified across all
|
|
13
|
+
* `FILE`** — verified across all ten language adapters, not assumed. The count
|
|
14
|
+
* was written as nine and a tenth shipped; the fact it carries did not change,
|
|
15
|
+
* which is exactly why the wrong number survived. The checks in this directory
|
|
14
16
|
* were written against `FILE` alone, their tests minted `FILE` nodes, their
|
|
15
17
|
* benches minted `FILE` nodes, and all three gates passed while the graph half of
|
|
16
18
|
* every check was unable to fire on any real repository. The number stayed right
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/validation/nodes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/validation/nodes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sBAAsB,6BAA8B,CAAC;AAElE,+DAA+D;AAC/D,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,CAAC,EAAE,MAAM,GACb;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAgBpE"}
|
package/dist/validation/nodes.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* The node types that stand for a whole file.
|
|
9
9
|
*
|
|
10
10
|
* **Every shipped adapter emits `MODULE` for a file and not one of them emits
|
|
11
|
-
* `FILE`** — verified across all
|
|
11
|
+
* `FILE`** — verified across all ten language adapters, not assumed. The count
|
|
12
|
+
* was written as nine and a tenth shipped; the fact it carries did not change,
|
|
13
|
+
* which is exactly why the wrong number survived. The checks in this directory
|
|
12
14
|
* were written against `FILE` alone, their tests minted `FILE` nodes, their
|
|
13
15
|
* benches minted `FILE` nodes, and all three gates passed while the graph half of
|
|
14
16
|
* every check was unable to fire on any real repository. The number stayed right
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/validation/nodes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/validation/nodes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAC;AAElE,+DAA+D;AAC/D,MAAM,UAAU,eAAe,CAC7B,QAA2B,EAC3B,KAAc;IAEd,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,sBAAsB,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjG,SAAS,GAAG,SAAS,IAAI,GAAG,CAAC,SAAS,CAAC;QACvC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YAC7B,yEAAyE;YACzE,qCAAqC;YACrC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,SAAS;YACxD,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;gBAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** ORM model registration — the UAT phase-4 audit's "Bug B": a SQLAlchemy-style model
|
|
2
|
+
* class inherits the declarative base but is defined in a module no `__init__.py` in
|
|
3
|
+
* its own package imports. A package's `__init__.py` conventionally re-imports every
|
|
4
|
+
* model module specifically so `Base.metadata` — the registry `alembic
|
|
5
|
+
* --autogenerate` reads — actually includes them; miss the import and the model is
|
|
6
|
+
* invisible to that registry. Alembic then sees a table the database has but the
|
|
7
|
+
* declared models don't, and `--autogenerate` writes a migration that **drops** it.
|
|
8
|
+
*
|
|
9
|
+
* Both edges this reuses are already produced elsewhere in the pipeline, never
|
|
10
|
+
* reinvented here: `INHERITS` (a class descending from a base) and `IMPORTS`
|
|
11
|
+
* (whether a package's `__init__.py` reaches the defining module).
|
|
12
|
+
*
|
|
13
|
+
* ## Recognising "inherits the ORM declarative base" without naming a framework
|
|
14
|
+
*
|
|
15
|
+
* Core carries no notion of "SQLAlchemy" or "Django" above the IR boundary (rule 1),
|
|
16
|
+
* and a name check on the base class ("is it called `Base`?") is exactly the kind of
|
|
17
|
+
* heuristic rule 2 forbids. The one signal already on the graph that says "this
|
|
18
|
+
* class's inheritance chain reaches an ORM declarative base" is the extractor's own
|
|
19
|
+
* `MODEL` classification: per the golden corpus (`fixtures/golden/patterns.json`,
|
|
20
|
+
* patterns 06/07) and `capabilities.ts`'s `ORM_EXTRACTOR` doc comment, `MODEL` is
|
|
21
|
+
* minted *because* the extractor found "a persistence annotation, a declarative
|
|
22
|
+
* base, a table binding" — never a name match. So this check's recognition rule is:
|
|
23
|
+
* **a `MODEL` node with at least one outgoing `INHERITS` edge** is, by construction
|
|
24
|
+
* of the extractor that classified it, a class inheriting the ORM declarative base.
|
|
25
|
+
*
|
|
26
|
+
* An abstract intermediate class that maps no column of its own is not itself
|
|
27
|
+
* promoted to `MODEL` — see the `Base`/`Order` example in
|
|
28
|
+
* `fixtures/languages/python/src/models.py`, where the comment on `Base` reads
|
|
29
|
+
* "maps no column, so it is not itself a model." So an abstract base is never a seed
|
|
30
|
+
* here, which is exactly the "don't flag an abstract intermediate the same way as a
|
|
31
|
+
* concrete leaf model" distinction — it falls out of reusing the existing `MODEL`
|
|
32
|
+
* classification rather than needing separate chain-walking logic.
|
|
33
|
+
*
|
|
34
|
+
* ## Reachability: "own package's `__init__.py`, walking up, transitively"
|
|
35
|
+
*
|
|
36
|
+
* `IMPORTS` is file-level (vocabulary.ts), so both endpoints are `MODULE`/`FILE`
|
|
37
|
+
* nodes (`fileScopedNodes`). For a model defined in `a/b/model.py`, the candidate
|
|
38
|
+
* aggregators are `a/b/__init__.py`, `a/__init__.py`, `__init__.py` — every ancestor
|
|
39
|
+
* package's own `__init__.py`, not only the immediate one: a nested package can be
|
|
40
|
+
* reached solely through a parent's `__init__` re-export. Reachability is `bfs`
|
|
41
|
+
* (`../query/traverse.ts`, the same transitive-reachability primitive
|
|
42
|
+
* `impactOf`/`testsCovering` already use), seeded at whichever of those candidate
|
|
43
|
+
* paths actually have a MODULE/FILE node in this graph, walking `IMPORTS` outward
|
|
44
|
+
* with no depth cap (only the node budget). An `__init__.py` that imports a
|
|
45
|
+
* `models_registry.py` that in turn imports the model module is therefore reached —
|
|
46
|
+
* exactly the false-positive shape the design review called out: this traversal is
|
|
47
|
+
* not restricted to direct imports.
|
|
48
|
+
*
|
|
49
|
+
* ## Why this is a lead, never a defect
|
|
50
|
+
*
|
|
51
|
+
* `Base.metadata` can be populated by an explicit scan/glob instead of manual
|
|
52
|
+
* imports (this check cannot see that from the graph), a model can be an
|
|
53
|
+
* intentionally unmigrated abstract/mixin base, or deliberately excluded from
|
|
54
|
+
* migrations for now. Promoting straight to `defect` needs a measured precision
|
|
55
|
+
* this check has not been run against yet — the same discipline this codebase
|
|
56
|
+
* already holds itself to elsewhere (a heuristic measured at 25% precision against
|
|
57
|
+
* a 90% bar was not shipped as a defect). So every finding here carries
|
|
58
|
+
* `claim: "lead"` and says so in its own text, never promoted silently. */
|
|
59
|
+
import type { ResolutionLevel } from "@descryy/ir";
|
|
60
|
+
import type { ContractClaim } from "../contracts/orphans.ts";
|
|
61
|
+
import type { AdjacencyProvider, QueryResult } from "../query/provider.ts";
|
|
62
|
+
export type OrmRegistrationFindingKind = "MODEL_NOT_REACHED_BY_INIT";
|
|
63
|
+
export interface OrmRegistrationFinding {
|
|
64
|
+
readonly kind: OrmRegistrationFindingKind;
|
|
65
|
+
/** Always "lead" today — see the header's "Why this is a lead, never a defect". */
|
|
66
|
+
readonly claim: ContractClaim;
|
|
67
|
+
readonly model: string;
|
|
68
|
+
readonly modelId: string;
|
|
69
|
+
readonly file: string;
|
|
70
|
+
readonly line: number;
|
|
71
|
+
/** The sentence a developer reads, including the reasoning for `claim: "lead"`. */
|
|
72
|
+
readonly detail: string;
|
|
73
|
+
readonly resolution: ResolutionLevel;
|
|
74
|
+
}
|
|
75
|
+
export interface OrmRegistrationReport {
|
|
76
|
+
readonly findings: readonly OrmRegistrationFinding[];
|
|
77
|
+
/** The count before `maxFindings` capped it — P27's disclosed remainder: a structured field, not only a prose note. */
|
|
78
|
+
readonly findingsTotal: number;
|
|
79
|
+
readonly examined: {
|
|
80
|
+
/** MODEL nodes with at least one outgoing INHERITS edge — this check's population. */
|
|
81
|
+
readonly candidates: number;
|
|
82
|
+
};
|
|
83
|
+
/** True when at least one candidate was examined. */
|
|
84
|
+
readonly ran: boolean;
|
|
85
|
+
readonly withheld: {
|
|
86
|
+
/** A candidate whose package tree carries no `__init__.py` node anywhere in this
|
|
87
|
+
* graph — nothing to check reachability against, so refused rather than guessed. */
|
|
88
|
+
readonly noInitInPackage: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export interface OrmRegistrationOptions {
|
|
92
|
+
/** Restrict candidates to these repo-relative files. Reachability is still resolved
|
|
93
|
+
* against the whole graph — a reaching `__init__.py` commonly sits outside the diff. */
|
|
94
|
+
readonly files?: readonly string[];
|
|
95
|
+
readonly maxFindings?: number;
|
|
96
|
+
/** Cap on MODEL/file-scoped nodes enumerated. Truncation is reported. */
|
|
97
|
+
readonly limit?: number;
|
|
98
|
+
/** Node budget per candidate's reachability traversal. */
|
|
99
|
+
readonly budget?: number;
|
|
100
|
+
}
|
|
101
|
+
/** Every `__init__.py` path that could aggregate `file`'s module: its own package's,
|
|
102
|
+
* and every ancestor package's, own package first. Pure path arithmetic — whether any
|
|
103
|
+
* of these actually exist as a node in the graph is decided by the caller. */
|
|
104
|
+
export declare function ancestorInitPaths(file: string): readonly string[];
|
|
105
|
+
export declare function checkOrmModelRegistration(provider: AdjacencyProvider, options?: OrmRegistrationOptions): QueryResult<OrmRegistrationReport>;
|
|
106
|
+
//# sourceMappingURL=orm-registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orm-registration.d.ts","sourceRoot":"","sources":["../../src/validation/orm-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAyD4E;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAc,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIvF,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;IAC1C,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC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** ORM model registration — the UAT phase-4 audit's "Bug B": a SQLAlchemy-style model
|
|
2
|
+
* class inherits the declarative base but is defined in a module no `__init__.py` in
|
|
3
|
+
* its own package imports. A package's `__init__.py` conventionally re-imports every
|
|
4
|
+
* model module specifically so `Base.metadata` — the registry `alembic
|
|
5
|
+
* --autogenerate` reads — actually includes them; miss the import and the model is
|
|
6
|
+
* invisible to that registry. Alembic then sees a table the database has but the
|
|
7
|
+
* declared models don't, and `--autogenerate` writes a migration that **drops** it.
|
|
8
|
+
*
|
|
9
|
+
* Both edges this reuses are already produced elsewhere in the pipeline, never
|
|
10
|
+
* reinvented here: `INHERITS` (a class descending from a base) and `IMPORTS`
|
|
11
|
+
* (whether a package's `__init__.py` reaches the defining module).
|
|
12
|
+
*
|
|
13
|
+
* ## Recognising "inherits the ORM declarative base" without naming a framework
|
|
14
|
+
*
|
|
15
|
+
* Core carries no notion of "SQLAlchemy" or "Django" above the IR boundary (rule 1),
|
|
16
|
+
* and a name check on the base class ("is it called `Base`?") is exactly the kind of
|
|
17
|
+
* heuristic rule 2 forbids. The one signal already on the graph that says "this
|
|
18
|
+
* class's inheritance chain reaches an ORM declarative base" is the extractor's own
|
|
19
|
+
* `MODEL` classification: per the golden corpus (`fixtures/golden/patterns.json`,
|
|
20
|
+
* patterns 06/07) and `capabilities.ts`'s `ORM_EXTRACTOR` doc comment, `MODEL` is
|
|
21
|
+
* minted *because* the extractor found "a persistence annotation, a declarative
|
|
22
|
+
* base, a table binding" — never a name match. So this check's recognition rule is:
|
|
23
|
+
* **a `MODEL` node with at least one outgoing `INHERITS` edge** is, by construction
|
|
24
|
+
* of the extractor that classified it, a class inheriting the ORM declarative base.
|
|
25
|
+
*
|
|
26
|
+
* An abstract intermediate class that maps no column of its own is not itself
|
|
27
|
+
* promoted to `MODEL` — see the `Base`/`Order` example in
|
|
28
|
+
* `fixtures/languages/python/src/models.py`, where the comment on `Base` reads
|
|
29
|
+
* "maps no column, so it is not itself a model." So an abstract base is never a seed
|
|
30
|
+
* here, which is exactly the "don't flag an abstract intermediate the same way as a
|
|
31
|
+
* concrete leaf model" distinction — it falls out of reusing the existing `MODEL`
|
|
32
|
+
* classification rather than needing separate chain-walking logic.
|
|
33
|
+
*
|
|
34
|
+
* ## Reachability: "own package's `__init__.py`, walking up, transitively"
|
|
35
|
+
*
|
|
36
|
+
* `IMPORTS` is file-level (vocabulary.ts), so both endpoints are `MODULE`/`FILE`
|
|
37
|
+
* nodes (`fileScopedNodes`). For a model defined in `a/b/model.py`, the candidate
|
|
38
|
+
* aggregators are `a/b/__init__.py`, `a/__init__.py`, `__init__.py` — every ancestor
|
|
39
|
+
* package's own `__init__.py`, not only the immediate one: a nested package can be
|
|
40
|
+
* reached solely through a parent's `__init__` re-export. Reachability is `bfs`
|
|
41
|
+
* (`../query/traverse.ts`, the same transitive-reachability primitive
|
|
42
|
+
* `impactOf`/`testsCovering` already use), seeded at whichever of those candidate
|
|
43
|
+
* paths actually have a MODULE/FILE node in this graph, walking `IMPORTS` outward
|
|
44
|
+
* with no depth cap (only the node budget). An `__init__.py` that imports a
|
|
45
|
+
* `models_registry.py` that in turn imports the model module is therefore reached —
|
|
46
|
+
* exactly the false-positive shape the design review called out: this traversal is
|
|
47
|
+
* not restricted to direct imports.
|
|
48
|
+
*
|
|
49
|
+
* ## Why this is a lead, never a defect
|
|
50
|
+
*
|
|
51
|
+
* `Base.metadata` can be populated by an explicit scan/glob instead of manual
|
|
52
|
+
* imports (this check cannot see that from the graph), a model can be an
|
|
53
|
+
* intentionally unmigrated abstract/mixin base, or deliberately excluded from
|
|
54
|
+
* migrations for now. Promoting straight to `defect` needs a measured precision
|
|
55
|
+
* this check has not been run against yet — the same discipline this codebase
|
|
56
|
+
* already holds itself to elsewhere (a heuristic measured at 25% precision against
|
|
57
|
+
* a 90% bar was not shipped as a defect). So every finding here carries
|
|
58
|
+
* `claim: "lead"` and says so in its own text, never promoted silently. */
|
|
59
|
+
import { bfs } from "../query/traverse.js";
|
|
60
|
+
import { fileScopedNodes } from "./nodes.js";
|
|
61
|
+
const DEFAULT_MAX_FINDINGS = 25;
|
|
62
|
+
const DEFAULT_TRAVERSAL_BUDGET = 500;
|
|
63
|
+
/** Every `__init__.py` path that could aggregate `file`'s module: its own package's,
|
|
64
|
+
* and every ancestor package's, own package first. Pure path arithmetic — whether any
|
|
65
|
+
* of these actually exist as a node in the graph is decided by the caller. */
|
|
66
|
+
export function ancestorInitPaths(file) {
|
|
67
|
+
const parts = file.split("/");
|
|
68
|
+
parts.pop(); // drop the file's own name
|
|
69
|
+
const paths = [];
|
|
70
|
+
for (let i = parts.length; i >= 0; i -= 1) {
|
|
71
|
+
const dir = parts.slice(0, i).join("/");
|
|
72
|
+
paths.push(dir === "" ? "__init__.py" : `${dir}/__init__.py`);
|
|
73
|
+
}
|
|
74
|
+
return paths;
|
|
75
|
+
}
|
|
76
|
+
export function checkOrmModelRegistration(provider, options = {}) {
|
|
77
|
+
const maxFindings = options.maxFindings ?? DEFAULT_MAX_FINDINGS;
|
|
78
|
+
const budget = options.budget ?? DEFAULT_TRAVERSAL_BUDGET;
|
|
79
|
+
const scoped = options.files === undefined ? null : new Set(options.files);
|
|
80
|
+
const notes = [];
|
|
81
|
+
const moduleFiles = fileScopedNodes(provider, options.limit);
|
|
82
|
+
const moduleIdByPath = new Map();
|
|
83
|
+
for (const node of moduleFiles.nodes) {
|
|
84
|
+
if (node.file !== null)
|
|
85
|
+
moduleIdByPath.set(node.file, node.id);
|
|
86
|
+
}
|
|
87
|
+
const modelSet = provider.nodesOfType("MODEL", options.limit);
|
|
88
|
+
const findings = [];
|
|
89
|
+
let candidates = 0;
|
|
90
|
+
let noInitInPackage = 0;
|
|
91
|
+
let anyTraversalTruncated = false;
|
|
92
|
+
for (const model of modelSet.nodes) {
|
|
93
|
+
if (model.file === null)
|
|
94
|
+
continue; // fileless — no package to reason about.
|
|
95
|
+
if (scoped !== null && !scoped.has(model.file))
|
|
96
|
+
continue;
|
|
97
|
+
// Recognition: a MODEL with no INHERITS edge was classified from a persistence
|
|
98
|
+
// annotation or table binding alone, not an inheritance chain — see the header.
|
|
99
|
+
const inherits = provider.outgoing(model.id, { types: ["INHERITS"] });
|
|
100
|
+
if (inherits.length === 0)
|
|
101
|
+
continue;
|
|
102
|
+
candidates += 1;
|
|
103
|
+
const ownModuleId = moduleIdByPath.get(model.file);
|
|
104
|
+
if (ownModuleId === undefined)
|
|
105
|
+
continue; // no MODULE/FILE node for its own file — IMPORTS is unreasoned-about here.
|
|
106
|
+
const initSeeds = ancestorInitPaths(model.file)
|
|
107
|
+
.map((path) => moduleIdByPath.get(path))
|
|
108
|
+
.filter((id) => id !== undefined);
|
|
109
|
+
if (initSeeds.length === 0) {
|
|
110
|
+
noInitInPackage += 1;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const outcome = bfs(provider, initSeeds, { types: ["IMPORTS"], direction: "out", budget });
|
|
114
|
+
if (outcome.truncated)
|
|
115
|
+
anyTraversalTruncated = true;
|
|
116
|
+
const reached = new Set(outcome.reached.map((r) => r.id));
|
|
117
|
+
if (reached.has(ownModuleId))
|
|
118
|
+
continue; // reached, directly or transitively — clean.
|
|
119
|
+
const base = provider.node(inherits[0].to);
|
|
120
|
+
const baseName = base?.name ?? "its declarative base";
|
|
121
|
+
const where = model.range === null ? model.file : `${model.file}:${model.range.startLine}`;
|
|
122
|
+
findings.push({
|
|
123
|
+
kind: "MODEL_NOT_REACHED_BY_INIT",
|
|
124
|
+
claim: "lead",
|
|
125
|
+
model: model.name,
|
|
126
|
+
modelId: model.id,
|
|
127
|
+
file: model.file,
|
|
128
|
+
line: model.range?.startLine ?? 0,
|
|
129
|
+
detail: `${model.name} (${where}) inherits ${baseName}, the ORM declarative base, but no ` +
|
|
130
|
+
"__init__.py in its own package — or an ancestor package's — imports the module that " +
|
|
131
|
+
"defines it, directly or transitively. If this model needs to be picked up by " +
|
|
132
|
+
"migrations, it may be silently invisible to them: the same shape as a model that never " +
|
|
133
|
+
"reaches Base.metadata and has its table dropped by the next autogenerate run. This is a " +
|
|
134
|
+
"lead, not a defect: a model registered through an explicit scan/glob rather than by " +
|
|
135
|
+
"import, or one deliberately excluded (an abstract/mixin base, or a model not yet wired " +
|
|
136
|
+
"into migrations), is expected to trigger this without being a bug.",
|
|
137
|
+
resolution: Math.min(model.resolution, inherits[0].resolution, outcome.resolutionFloor),
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
findings.sort((a, b) => a.file.localeCompare(b.file) || a.model.localeCompare(b.model));
|
|
141
|
+
const kept = findings.slice(0, maxFindings);
|
|
142
|
+
const ran = candidates > 0;
|
|
143
|
+
if (!ran) {
|
|
144
|
+
notes.push("No MODEL node in the graph carries an outgoing INHERITS edge, so nothing was checked for " +
|
|
145
|
+
"package-import reachability. This check treats a MODEL node with at least one INHERITS " +
|
|
146
|
+
"edge as a class inheriting an ORM declarative base; either no such class exists in this " +
|
|
147
|
+
"graph, or no adapter emitted both the MODEL classification and the INHERITS edge on this " +
|
|
148
|
+
"run. This is not a result of every model being correctly wired to its package's __init__.");
|
|
149
|
+
}
|
|
150
|
+
if (noInitInPackage > 0) {
|
|
151
|
+
notes.push(`${noInitInPackage} candidate(s) sit in a package with no __init__.py node anywhere in its ` +
|
|
152
|
+
"ancestor chain in this graph, so reachability from a package aggregator could not be " +
|
|
153
|
+
"evaluated at all and nothing was reported for them. Absence of a finding here is not " +
|
|
154
|
+
"evidence that they are wired in.");
|
|
155
|
+
}
|
|
156
|
+
if (scoped !== null) {
|
|
157
|
+
notes.push(`Candidates were restricted to ${scoped.size} scoped file(s), by the file the model class ` +
|
|
158
|
+
"is defined in. Reachability is still resolved against the whole graph, because the " +
|
|
159
|
+
"reaching __init__.py commonly sits outside the diff.");
|
|
160
|
+
}
|
|
161
|
+
if (kept.length < findings.length) {
|
|
162
|
+
notes.push(`${findings.length - kept.length} further finding(s) were withheld: a report is capped at ` +
|
|
163
|
+
`${maxFindings} so a short list stays worth reading. They were found, not missed.`);
|
|
164
|
+
}
|
|
165
|
+
if (anyTraversalTruncated) {
|
|
166
|
+
notes.push("At least one reachability traversal hit its node budget before finishing. A model reported " +
|
|
167
|
+
"here as unreached may in fact be reached by a path this run did not get to walk.");
|
|
168
|
+
}
|
|
169
|
+
if (modelSet.truncated || moduleFiles.truncated) {
|
|
170
|
+
notes.push("More MODEL or file-scoped nodes exist in the graph than were enumerated, so this check " +
|
|
171
|
+
"covers a prefix of the repository rather than all of it.");
|
|
172
|
+
}
|
|
173
|
+
let resolutionFloor = 4;
|
|
174
|
+
for (const finding of kept)
|
|
175
|
+
if (finding.resolution < resolutionFloor)
|
|
176
|
+
resolutionFloor = finding.resolution;
|
|
177
|
+
const stamp = { ...provider.baseStamp(), resolutionFloor };
|
|
178
|
+
return {
|
|
179
|
+
data: {
|
|
180
|
+
findings: kept,
|
|
181
|
+
findingsTotal: findings.length,
|
|
182
|
+
examined: { candidates },
|
|
183
|
+
ran,
|
|
184
|
+
withheld: { noInitInPackage },
|
|
185
|
+
},
|
|
186
|
+
stamp,
|
|
187
|
+
truncated: modelSet.truncated || moduleFiles.truncated || anyTraversalTruncated || kept.length < findings.length,
|
|
188
|
+
notes,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=orm-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orm-registration.js","sourceRoot":"","sources":["../../src/validation/orm-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAyD4E;AAM5E,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA6C7C,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC;;+EAE+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,KAAK,GA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ACD,IAAI,QAAQ,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,EAAE,CAAC;QAChD,KAAK,CAAC,IAAI,CACR,yFAAyF;YACvF,0DAA0D,CAC7D,CAAC;IACJ,CAAC;IAED,IAAI,eAAe,GAAoB,CAAC,CAAC;IACzC,KAAK,MAAM,OAAO,IAAI,IAAI;QAAE,IAAI,OAAO,CAAC,UAAU,GAAG,eAAe;YAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAE3G,MAAM,KAAK,GAAe,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,eAAe,EAAE,CAAC;IACvE,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,QAAQ,CAAC,MAAM;YAC9B,QAAQ,EAAE,EAAE,UAAU,EAAE;YACxB,GAAG;YACH,QAAQ,EAAE,EAAE,eAAe,EAAE;SAC9B;QACD,KAAK;QACL,SAAS,EACP,QAAQ,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,IAAI,qBAAqB,IAAI,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM;QACvG,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,56 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Class A at R0, and **deliberately the easy half of consumer impact**: a
|
|
6
|
-
* destructive operation is a pattern in a migration, not an inference about who
|
|
7
|
-
* reads the column. The scope fence that makes that classification safe is stated
|
|
8
|
-
* in `migrations.ts` and every sentence below stays behind it.
|
|
9
|
-
*
|
|
10
|
-
* ## The trap, measured before this was written
|
|
11
|
-
*
|
|
12
|
-
* The env check's trap was a variable read and never declared. This one is
|
|
13
|
-
* larger, and DEC-122 counted it:
|
|
14
|
-
*
|
|
15
|
-
* | repository | migrations | with a reverse section |
|
|
16
|
-
* | --- | --- | --- |
|
|
17
|
-
* | `outline` | 300 | **300** |
|
|
18
|
-
* | `dispatch` | 162 | **162** |
|
|
19
|
-
* | `directus` | 112 | 110 |
|
|
20
|
-
*
|
|
21
|
-
* **Effectively every migration in these projects declares a reverse, and a
|
|
22
|
-
* destructive operation in the reverse is supposed to be there** — it undoes the
|
|
23
|
-
* forward migration. A check that matched destructive operations without knowing
|
|
24
|
-
* which half it was reading would report `outline`'s 202 destructive files, and
|
|
25
|
-
* most of those matches are a drop that undoes a create three lines above.
|
|
26
|
-
*
|
|
27
|
-
* So `section` is to this check what `required` was to the env check: the field
|
|
28
|
-
* without which the whole thing is wrong on nearly every file it sees. And
|
|
29
|
-
* `unknown` is not a synonym for `forward`. Two of the reference repositories
|
|
30
|
-
* declare no direction at all — they hand the framework a reversal callback — and
|
|
31
|
-
* their operations are **counted and disclosed, never reported**. That refusal
|
|
32
|
-
* alone withholds 192 files' worth of matches, and it is the honest treatment:
|
|
33
|
-
* an operation whose half cannot be determined is not evidence of a forward
|
|
34
|
-
* destructive change.
|
|
35
|
-
*
|
|
36
|
-
* ## Two further refusals, both from the only real DDL in the corpus
|
|
37
|
-
*
|
|
38
|
-
* - **`DROP … IF EXISTS` paired with a `CREATE` of the same object** is an
|
|
39
|
-
* idempotent setup script, not a data-losing change. Both destructive lines in
|
|
40
|
-
* the one genuine `.sql` file found across fifteen repositories are exactly
|
|
41
|
-
* this shape.
|
|
42
|
-
* - **Dropping an object created in the same migration** is not a finding. The
|
|
43
|
-
* object did not exist before the file ran.
|
|
44
|
-
*
|
|
45
|
-
* ## Where the input comes from
|
|
46
|
-
*
|
|
47
|
-
* Two sources, and DEC-122 measured that the one the architecture implies is the
|
|
48
|
-
* smaller: **0 `.sql` files inside a migration directory** across the reference
|
|
49
|
-
* corpus, against **3,301** migrations written as program code. The format half
|
|
50
|
-
* runs today and needs no adapter; the code half arrives as `attrs.migrationOps`
|
|
51
|
-
* and is an adapter's to produce. When neither is present the check says so and
|
|
52
|
-
* does not report a clean result.
|
|
53
|
-
*/
|
|
1
|
+
/** §15.3 rollback-readiness — Class A at R0, deliberately the easy half (fence in migrations.ts).
|
|
2
|
+
* `section` is load-bearing like `required` was for env: reverse-section drops are correct code
|
|
3
|
+
* (near-100% of migrations, DEC-122), and `unknown` section is withheld, never assumed forward. */
|
|
54
4
|
import type { ResolutionLevel } from "@descryy/ir";
|
|
55
5
|
import type { AdjacencyProvider, QueryResult } from "../query/provider.ts";
|
|
56
6
|
import type { DestructiveKind, MigrationOp, MigrationScan } from "./migrations.ts";
|
|
@@ -60,12 +10,8 @@ export interface RollbackFinding {
|
|
|
60
10
|
readonly target: string;
|
|
61
11
|
readonly file: string;
|
|
62
12
|
readonly line: number;
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* Stays behind the §15.3 fence: it states that the operation is present, never
|
|
67
|
-
* that the migration is unsafe to roll back.
|
|
68
|
-
*/
|
|
13
|
+
/** The sentence a developer reads. Stays behind the §15.3 fence — states the operation is
|
|
14
|
+
* present, never that the migration is unsafe to roll back. */
|
|
69
15
|
readonly detail: string;
|
|
70
16
|
readonly resolution: ResolutionLevel;
|
|
71
17
|
}
|
|
@@ -81,12 +27,8 @@ export interface RollbackReport {
|
|
|
81
27
|
/** Destructive operations seen, before any refusal. */
|
|
82
28
|
readonly operations: number;
|
|
83
29
|
};
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* The counts are the point: they are the size of what this check chose not to
|
|
88
|
-
* say, and each has a different cause a reader can act on.
|
|
89
|
-
*/
|
|
30
|
+
/** Every operation declined, by reason. The counts are the point — the size of what this check
|
|
31
|
+
* chose not to say, each with a cause a reader can act on. */
|
|
90
32
|
readonly withheld: {
|
|
91
33
|
/** In a reverse section — undoing a forward migration. */
|
|
92
34
|
readonly reverse: number;
|
|
@@ -108,14 +50,9 @@ export interface RollbackOptions {
|
|
|
108
50
|
readonly files?: readonly string[];
|
|
109
51
|
readonly limit?: number;
|
|
110
52
|
}
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* A row with no `section`, or an unrecognised one, is **dropped rather than
|
|
115
|
-
* treated as forward**. Defaulting it would manufacture exactly the claim the
|
|
116
|
-
* reverse-section fence exists to withhold, on a corpus where the reverse
|
|
117
|
-
* section is present in effectively every file.
|
|
118
|
-
*/
|
|
53
|
+
/** Pulls `attrs.migrationOps` off a file node, refusing anything malformed. A row with no
|
|
54
|
+
* `section` (or an unrecognised one) is dropped, never defaulted to forward — that would
|
|
55
|
+
* manufacture exactly the claim the reverse-section fence exists to withhold. */
|
|
119
56
|
export declare function readMigrationOps(attrs: Readonly<Record<string, unknown>>): {
|
|
120
57
|
readonly ops: readonly MigrationOp[];
|
|
121
58
|
readonly malformed: number;
|