@neralabs/rerail-pack-alembic 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,213 @@
1
+ .policy "alembic-practice-model-import-in-migration" revision 1
2
+ .description "Declare the tables an Alembic migration reads or writes inside the migration instead of importing the application's ORM models; their enums, types and constants are fine."
3
+ .language python
4
+ .mode steer
5
+ .scope include "**/*.py"
6
+ // Rerail's own rule, not a port. A migration must keep working "in perpetuity", but "your ORM models may have changed so
7
+ // would no longer work in this migration once it's older" (zzzeek, sqlalchemy/alembic#679): the model follows today's
8
+ // schema, so an old revision's query names columns that do not exist yet at that revision (a fresh install or CI from an
9
+ // empty database breaks) or writes the wrong ones. The Alembic cookbook's data migrations declare the table with
10
+ // `sa.table()`/`sa.column()`; django-migration-linter makes the Django equivalent an error (RUNPYTHON_MODEL_IMPORT).
11
+ // Reported, in an Alembic revision outside test code (module level, upgrade(), downgrade() or a helper):
12
+ // from app.models.group import Group one finding per imported name that is a mapped class
13
+ // from app.models import User a re-export, followed to the class
14
+ // from app.models import user as m; db.query(m.User) a model module imported whole: its first use of each model
15
+ // (outside type annotations)
16
+ // A mapped class is a class of the run that declares `__tablename__`, is a sqlmodel `table=True` class, subclasses
17
+ // either (lib/alembic's al_model_q), or subclasses a declarative base (`class Base(DeclarativeBase)`, `Base = declarative_base()`,
18
+ // Flask-SQLAlchemy's `db.Model` for a module-level `db = SQLAlchemy(...)`, all resolved through imports) without
19
+ // `__abstract__ = True` (Netflix/dispatch names every table with a `declared_attr` on its base). A model imported only
20
+ // for its table name (`User.__tablename__`, `User.__table__.name`) gets a message of its own: nothing queries its
21
+ // columns, but the import still loads the application when the migration runs.
22
+ // Left alone:
23
+ // from app.models.types import GUID, JSONDict column types and TypeDecorators
24
+ // from app.models.user import UserRole, ADMIN_ROLES enums and constants
25
+ // from app.models.base import Base, TimestampMixin the declarative base and mixins (Base.metadata is schema-free)
26
+ // from app.models.hero import HeroBase a sqlmodel class without table=True (a pydantic schema)
27
+ // class Group(declarative_base()): __tablename__ = ... a model declared in the migration: the safe pattern
28
+ // from migrations.shared.frozen import Permission a model of a module under migrations/ or alembic/: frozen for
29
+ // the migrations (superset's migrations/shared)
30
+ // `if TYPE_CHECKING:` imports, annotations, env.py, revisions in test trees.
31
+ // Gaps: a model module bound to a local name (`m = importlib.import_module(...)`); a base assigned from
32
+ // `declarative_base()` in the same module as its models (the base reference does not resolve); models from an
33
+ // installed package.
34
+ // Corpus (8 Alembic repositories): 13 matches, all read, all real; see the README's rule details.
35
+
36
+ #include "lib/alembic.rerail"
37
+
38
+ .violation ModelImport(at: node, x: symbol) "This migration imports {x}, an application ORM model that follows today's schema, not this revision's. Declare the table here with `sa.table()` and `sa.column()`. Enums, types and constants are fine."
39
+ .violation ModelUse(at: node, x: symbol) "This migration uses {x}, an application ORM model that follows today's schema, not this revision's. Declare the table here with `sa.table()` and `sa.column()`. Enums, types and constants are fine."
40
+ .violation ModelTableName(at: node, x: symbol) "This migration imports {x} only for its table name, which loads the application when the migration runs. Write the table name as a string instead; leave it if the app must load anyway."
41
+
42
+ // ---- mapped classes ----------------------------------------------------------------------------------------------
43
+ // Classes are read by symbol (decision 0677): each file states its classes, their ancestry (python/names' class_anc,
44
+ // the phase py_names) and its declarative bases by qualified name; which classes are models, and which name a
45
+ // migration's import denotes, is joined by symbol, and each finding reads its node in its own file.
46
+ // mi_base(q): q is a declarative base: `class Base(DeclarativeBase)` or a module-level `Base = declarative_base()`.
47
+ // Each file states its own (mi_base_at); the run's bases, by qualified name, span files on purpose (cross_file).
48
+ .decl mi_decl_root(q: symbol)
49
+ mi_decl_root("sqlalchemy.orm.DeclarativeBase"). mi_decl_root("sqlalchemy.orm.DeclarativeBaseNoMeta").
50
+ mi_decl_root("sqlalchemy.orm.decl_api.DeclarativeBase").
51
+ .decl mi_base_factory(q: symbol)
52
+ mi_base_factory("sqlalchemy.orm.declarative_base"). mi_base_factory("sqlalchemy.ext.declarative.declarative_base").
53
+ mi_base_factory("sqlalchemy.orm.decl_api.declarative_base").
54
+ .decl mi_base_at(d: number, q: symbol)
55
+ mi_base_at(d, q) :- class_def(k, q), class_base(k, r), mi_decl_root(r), docof(k, d).
56
+ mi_base_at(d, q) :- al_top_assign(d, x, v), unparen(v, c), kind(c, "call"), field(c, "function", f), sym_of(f, r),
57
+ mi_base_factory(r), doc(d, _, m), q = @dot(m, x).
58
+ // Flask-SQLAlchemy: `db = SQLAlchemy(...)` at module level makes `db.Model` a declarative base.
59
+ mi_base_at(d, q) :- al_top_assign(d, x, v), unparen(v, c), kind(c, "call"), field(c, "function", f), sym_of(f, r),
60
+ prefix("flask_sqlalchemy.", r), suffix(".SQLAlchemy", r), doc(d, _, m), q = @dot(@dot(m, x), "Model").
61
+ .decl mi_base(q: symbol) cross_file
62
+ mi_base(q) :- mi_base_at(_, q).
63
+ .decl mi_abstract(k: node)
64
+ mi_abstract(k) :- al_class_stmt(k, a), field(a, "left", l), text(l, "__abstract__"), field(a, "right", v),
65
+ unparen(v, u), kind(u, "true").
66
+ // mi_frozen_doc(d): a migration, or a module under a migrations/ or alembic/ directory: a model declared there is the
67
+ // migrations' own copy, frozen at the schema they expect.
68
+ .decl mi_frozen_doc(d: number)
69
+ mi_frozen_doc(d) :- al_migration_doc(d).
70
+ mi_frozen_doc(d) :- doc(d, _, _), (path_part(d, "migrations") ; path_part(d, "alembic")).
71
+ // mi_cls_at(d, q, x, a, p, top): class q, named x, of document d (path p) outside the migrations' own modules; a
72
+ // "abstract" when it says `__abstract__ = True`; top "top" when it is defined at module level. mi_anc_at(d, q, b):
73
+ // it inherits from b, at any depth (class_anc).
74
+ .decl mi_cls_at(d: number, q: symbol, x: symbol, a: symbol, p: symbol, top: symbol)
75
+ mi_cls_at(d, q, x, a, p, top) :- class_def(k, q), def_name(k, x), docof(k, d), !mi_frozen_doc(d), doc(d, p, _),
76
+ mi_abs(k, a), mi_top(k, top).
77
+ .decl mi_abs(k: node, a: symbol)
78
+ mi_abs(k, "abstract") :- class_def(k, _), mi_abstract(k).
79
+ mi_abs(k, "concrete") :- class_def(k, _), !mi_abstract(k).
80
+ .decl mi_top(k: node, top: symbol)
81
+ mi_top(k, "top") :- class_def(k, _), nearest(k, s, scope), kind(s, "module").
82
+ mi_top(k, "nested") :- class_def(k, _), nearest(k, s, scope), !kind(s, "module").
83
+ .decl mi_anc_at(d: number, q: symbol, b: symbol)
84
+ mi_anc_at(d, q, b) :- class_def(k, q), class_anc(k, b), docof(k, d), !mi_frozen_doc(d).
85
+ // mi_model(d, q, x): class q of document d, named x, is a mapped class of the application: it names its table, or
86
+ // inherits from one that does (al_model_q), or from a declarative base and is not abstract (mi_base).
87
+ .decl mi_cls_anc_at(d: number, q: symbol, x: symbol, a: symbol, b: symbol)
88
+ mi_cls_anc_at(d, q, x, a, b) :- mi_cls_at(d, q, x, a, _, _), mi_anc_at(d, q, b).
89
+ .decl mi_model(d: number, q: symbol, x: symbol)
90
+ mi_model(d, q, x) :- mi_cls_at(d, q, x, _, _, _), al_model_q(q).
91
+ mi_model(d, q, x) :- mi_cls_anc_at(d, q, x, _, b), al_model_q(b).
92
+ mi_model(d, q, x) :- mi_cls_anc_at(d, q, x, "concrete", b), mi_base(b).
93
+
94
+ // ---- what a migration reads --------------------------------------------------------------------------------------
95
+ .decl mi_doc(d: number)
96
+ mi_doc(d) :- al_migration_doc(d), !al_test_doc(d).
97
+ // mi_typing_only(a): a sits under `if TYPE_CHECKING:` or in an annotation, which never runs a query.
98
+ .decl mi_typing_only(a: node)
99
+ mi_typing_only(a) :- type_checking_block(b), within(a, b).
100
+ mi_typing_only(a) :- kind(t, "type"), within(a, t).
101
+ // mi_import(a, q0): alias a of a migration's `from m import y` names q0 = "m.y".
102
+ .decl mi_import(a: node, q0: symbol)
103
+ mi_import(a, q0) :- import_alias(_, a, m, y, _), y != "", docof(a, d), mi_doc(d), !mi_typing_only(a), q0 = @dot(m, y).
104
+ // mi_attr(n, d, q0): attribute expression n of migration d (outside annotations) reads the qualified name q0.
105
+ .decl mi_attr(n: node, d: number, q0: symbol)
106
+ mi_attr(n, d, q0) :- kind(n, "attribute"), docof(n, d), mi_doc(d), !mi_typing_only(n), sym_of(n, q0).
107
+ // mi_query_at(d, q0, q): migration d names q0, which denotes q: module m's export x for q0 = "m.x", followed through
108
+ // re-exports (the phase py_names, read by a module d reads), or q0 itself where no module exports it.
109
+ .decl mi_query(d: number, q0: symbol)
110
+ mi_query(d, q0) :- mi_import(a, q0), docof(a, d).
111
+ mi_query(d, q0) :- mi_attr(_, d, q0).
112
+ .decl mi_exported(d: number, q0: symbol, q: symbol)
113
+ mi_exported(d, q0, q) :- mi_query(d, q0), split_dot(q0, m, x), doc(d, p, _), py_names__reads_at(p, m),
114
+ py_names__exports(m, x, q).
115
+ .decl mi_is_exported(d: number, q0: symbol)
116
+ mi_is_exported(d, q0) :- mi_exported(d, q0, _).
117
+ .decl mi_query_at(d: number, q0: symbol, q: symbol)
118
+ mi_query_at(d, q0, q) :- mi_exported(d, q0, q).
119
+ mi_query_at(d, q0, q0) :- mi_query(d, q0), !mi_is_exported(d, q0).
120
+ // mi_named(q0, q, x): the name q0 a migration reads denotes model q, named x: through re-exports to its qualname, or
121
+ // (a module inside a namespace package, whose qualname lacks the package: Netflix/dispatch's `dispatch/feedback/` has
122
+ // no __init__.py) a top-level class named y of the file whose path ends in m's path, for q0 = "m.y". It joins a
123
+ // migration's names to the classes of other files, so it spans files on purpose (cross_file), by symbol and path.
124
+ .decl mi_named(q0: symbol, q: symbol, x: symbol) cross_file
125
+ mi_named(q0, q, x) :- mi_query_at(_, q0, q), mi_model(_, q, x).
126
+ mi_named(q0, q, y) :- mi_query_at(_, q0, _), split_dot(q0, m, y), mi_cls_at(e, q, y, _, p, "top"), mi_model(e, q, y),
127
+ mp = @replace_all(m, "\\.", "/"), (suffix(cat("/", mp, ".py"), cat("/", p)) ;
128
+ suffix(cat("/", mp, "/__init__.py"), cat("/", p))).
129
+ // `from m import X [as Y]`: one finding per imported name that resolves to a model; a model the migration uses only
130
+ // for its table name gets ModelTableName.
131
+ ModelImport(a, x) :- mi_import(a, q0), mi_named(q0, _, x), !mi_name_only(a, q0).
132
+ ModelTableName(a, x) :- mi_import(a, q0), mi_named(q0, _, x), mi_name_only(a, q0).
133
+ // mi_ref(a, q0, n): identifier n of the importing migration, outside import statements, names the imported q0.
134
+ .decl mi_ref(a: node, q0: symbol, n: node)
135
+ mi_ref(a, q0, n) :- mi_import(a, q0), docof(a, d), kind(n, "identifier"), docof(n, d), sym_of(n, q0), !mi_in_import(n).
136
+ .decl mi_in_import(n: node)
137
+ mi_in_import(n) :- (kind(s, "import_from_statement") ; kind(s, "import_statement")), within(n, s).
138
+ // mi_name_use(n): n is read only for its table name: `n.__tablename__` or `n.__table__.name`.
139
+ .decl mi_name_use(n: node)
140
+ mi_name_use(n) :- attr_of(p, n, "__tablename__").
141
+ mi_name_use(n) :- attr_of(p, n, "__table__"), attr_of(_, p, "name").
142
+ .decl mi_full_use(a: node, q0: symbol)
143
+ mi_full_use(a, q0) :- mi_ref(a, q0, n), !mi_name_use(n).
144
+ .decl mi_name_only(a: node, q0: symbol)
145
+ mi_name_only(a, q0) :- mi_ref(a, q0, n), mi_name_use(n), !mi_full_use(a, q0).
146
+ // `m.X` where m names a model module: the first use of each model in the file. Each attribute is stated by its term
147
+ // (al_term) and its rank among the file's such attributes (mi_rank, compared in the file: no position leaves it):
148
+ // mi_attr_at(d, nt, i, q0), it reads q0; mi_obj_at(d, nt, w, oq), its object is an attribute (w "attr") or a name
149
+ // (w "ident") that reads oq.
150
+ .decl mi_attr_n(n: node, d: number)
151
+ mi_attr_n(n, d) :- mi_attr(n, d, _).
152
+ .decl mi_rank(n: node, d: number, i: number)
153
+ mi_rank(n, d, i) :- mi_attr_n(n, d), i = count : { mi_attr_n(p, d), earlier(p, n) }.
154
+ // mi_attr_node(n, d, nt, i): attribute n of migration d, of term nt and rank i, a finding reads back.
155
+ .decl mi_attr_node(n: node, d: number, nt: symbol, i: number)
156
+ mi_attr_node(n, d, nt, i) :- mi_rank(n, d, i), al_term(n, d, nt).
157
+ .decl mi_attr_at(d: number, nt: symbol, i: number, q0: symbol)
158
+ mi_attr_at(d, nt, i, q0) :- mi_attr(n, d, q0), mi_attr_node(n, d, nt, i).
159
+ .decl mi_obj_at(d: number, nt: symbol, w: symbol, oq: symbol)
160
+ mi_obj_at(d, nt, "attr", oq) :- mi_attr_node(n, d, nt, _), field(n, "object", o), mi_attr(o, _, oq).
161
+ mi_obj_at(d, nt, "ident", oq) :- mi_attr_node(n, d, nt, _), field(n, "object", o), kind(o, "identifier"),
162
+ sym_of(o, oq).
163
+ // mi_model_ref(d, nt): the attribute's object itself names a model (`User.Address` would be an attribute of a model,
164
+ // not of a module).
165
+ .decl mi_model_ref(d: number, nt: symbol)
166
+ mi_model_ref(d, nt) :- mi_obj_at(d, nt, "attr", oq), mi_named(oq, _, _).
167
+ mi_model_ref(d, nt) :- mi_obj_at(d, nt, "ident", oq), mi_model(_, oq, _).
168
+ // mi_attr_use(d, nt, i, q, x): attribute nt (rank i) of migration d reads model q, named x, through a module.
169
+ .decl mi_attr_use(d: number, nt: symbol, i: number, q: symbol, x: symbol)
170
+ mi_attr_use(d, nt, i, q, x) :- mi_attr_at(d, nt, i, q0), mi_named(q0, q, x), !mi_model_ref(d, nt).
171
+ ModelUse(n, x) :- mi_attr_node(n, d, nt, i), mi_attr_use(d, nt, i, q, x), i = min j : { mi_attr_use(d, _, j, q, _) }.
172
+
173
+ // The cases, `upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/`, read as one repository:
174
+ // each line ending in `# caught` is reported, and no other line.
175
+ .test cases exactly
176
+ .fixture "app/__init__.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/__init__.py"
177
+ .fixture "app/ext.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/ext.py"
178
+ .fixture "app/legacy.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/legacy.py"
179
+ .fixture "app/models/__init__.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/models/__init__.py"
180
+ .fixture "app/models/base.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/models/base.py"
181
+ .fixture "app/models/hero.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/models/hero.py"
182
+ .fixture "app/models/types.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/models/types.py"
183
+ .fixture "app/models/user.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/models/user.py"
184
+ .fixture "app/plugins/billing/__init__.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/plugins/billing/__init__.py"
185
+ .fixture "app/plugins/billing/models.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/plugins/billing/models.py"
186
+ .fixture "app/schemas.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/schemas.py"
187
+ .fixture "app/widgets.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/app/widgets.py"
188
+ .fixture "migrations/__init__.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/__init__.py"
189
+ .fixture "migrations/env.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/env.py"
190
+ .fixture "migrations/shared/__init__.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/shared/__init__.py"
191
+ .fixture "migrations/shared/frozen.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/shared/frozen.py"
192
+ .fixture "migrations/versions/m1_populate_slugs.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/versions/m1_populate_slugs.py"
193
+ .fixture "migrations/versions/m2_shapes.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/versions/m2_shapes.py"
194
+ .fixture "migrations/versions/m3_module_attr.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/versions/m3_module_attr.py"
195
+ .fixture "migrations/versions/m4_safe.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/versions/m4_safe.py"
196
+ .fixture "migrations/versions/m5_namespace.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/versions/m5_namespace.py"
197
+ .fixture "migrations/versions/m6_flask_and_table_name.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/migrations/versions/m6_flask_and_table_name.py"
198
+ .fixture "tests/migrations/versions/t1_imports.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/tests/migrations/versions/t1_imports.py"
199
+ .fixture "tests/test_users.py" from "../upstream/alembic-practice/authored/alembic-practice-model-import-in-migration/tests/test_users.py"
200
+ .expect _ at "migrations/versions/m1_populate_slugs.py":7
201
+ .expect _ at "migrations/versions/m1_populate_slugs.py":8
202
+ .expect _ at "migrations/versions/m2_shapes.py":8
203
+ .expect _ at "migrations/versions/m2_shapes.py":9
204
+ .expect _ at "migrations/versions/m2_shapes.py":11
205
+ .expect _ at "migrations/versions/m2_shapes.py":33
206
+ .expect _ at "migrations/versions/m3_module_attr.py":21
207
+ .expect _ at "migrations/versions/m3_module_attr.py":24
208
+ .expect _ at "migrations/versions/m5_namespace.py":6
209
+ .expect ModelImport at "migrations/versions/m6_flask_and_table_name.py":5
210
+ .expect ModelTableName at "migrations/versions/m6_flask_and_table_name.py":6
211
+ .expect ModelTableName at "migrations/versions/m6_flask_and_table_name.py":7
212
+ .expect ModelImport at "migrations/versions/m6_flask_and_table_name.py":8
213
+ .end
@@ -0,0 +1,242 @@
1
+ .policy "alembic-practice-multiple-heads" revision 1
2
+ .description "Keep each Alembic migration history to one head: base a new revision on the current head or add a merge revision, and give an intended parallel branch a branch label."
3
+ .language python
4
+ .mode steer
5
+ .scope include "**/*.py"
6
+ // Rerail's own rule, not a port. Two revisions written on the same parent (two branches each adding a migration on the
7
+ // head they saw), or a new revision written with `down_revision = None` beside an existing line, leave the version
8
+ // directory with two heads, and `alembic upgrade head` refuses to run: "Multiple head revisions are present for given
9
+ // argument 'head'" (Alembic, "Working with Branches"; verified with Alembic 1.20.1). pytest-alembic's
10
+ // test_single_head_revision exists for the same merge conflict, which otherwise breaks only at deploy.
11
+ // It reads every revision file of the run (outside test code) as a graph. A revision's id and each parent id in its
12
+ // `down_revision` (a string, a tuple or list of them) are read as values: a literal, or a name bound to a literal in the
13
+ // same file (`PARENT = "s1"; down_revision = PARENT`). Parents resolve first among the revisions of the same directory
14
+ // and only then elsewhere, so two version directories that reuse ids ("0001", "0002") stay apart. A head is a revision
15
+ // no other revision names in its `down_revision`. Two heads belong to one history when they share an ancestor or sit
16
+ // in one version directory (the directory Alembic reads as one script location). Reported, at a head's
17
+ // `down_revision = ...`:
18
+ // a2 <- a3 (head), a2 <- a4 <- a5 (head) a3 and a5 both: they share the ancestor a2 and no merge joins them
19
+ // down_revision: Union[str, None] = "a2" annotated assignments count the same
20
+ // d1 <- d2, d1 <- d3 (depends_on = "d2") depends_on orders the upgrade but joins no heads: both reported
21
+ // a1 <- a2, b1 (down_revision = None) a second base in one directory: a2 and b1 are both heads
22
+ // PARENT = "s1"; down_revision = PARENT a parent (or id) bound to a module constant counts as the literal
23
+ // down_revision = ("r1",) a tuple or list of one is a single parent, not a merge
24
+ // n4 = ("n2", "n3") (head), n2 <- n5 (head) a merge revision can be one of the heads; the message names the
25
+ // revision with at most one parent to rebase (n3 on n4's line, n5
26
+ // on its own; a second base is rebased the same way)
27
+ // m4 = ("m2", "m3"), m5 = ("m3", "m2") two branches each merged the same heads: no single-parent revision
28
+ // to rebase, so MultipleMergeHeads says merge again or drop one
29
+ // Each head is reported once per other head of its history.
30
+ // Left alone:
31
+ // down_revision = ("b2", "b3") a merge revision (even without `from alembic import op` and with an
32
+ // empty upgrade()) joins the lines: one head; also `(LEFT, RIGHT)`
33
+ // core/versions/0002, tenant/versions/0003 heads in two directories that share no ancestor (independent
34
+ // migration trees, each with its own script location)
35
+ // l1 <- l3 (branch_labels=("reports",)) <- l4 a line that sets branch_labels between the fork (or its own base)
36
+ // and its head is an intentional branch (`alembic upgrade
37
+ // reports@head`); labels on the shared base or trunk do not silence a
38
+ // fork
39
+ // down_revision = PREV (imported), = "v1" a line holding a parent the rule cannot read (an imported name, a
40
+ // where no revision "v1" is in the run call) or an id no revision of the run has (a squashed history, a
41
+ // library's version location): its real parent is unknown
42
+ // revisions in test trees
43
+ // Gaps: a history spread over several directories (version_locations, recursive version directories) whose lines
44
+ // share no ancestor is read as separate trees; a parent imported from another module is unresolved (left alone, above);
45
+ // revisions outside the run are unseen.
46
+ // Corpus (8 Alembic repositories at release commits): 0 matches before and after this revision.
47
+
48
+ #include "lib/alembic.rerail"
49
+
50
+ .violation MultipleHeads(at: node, r: symbol, o: symbol, x: symbol) "Heads {r} and {o} make `alembic upgrade head` fail. If {x} never ran on a shared database, set its down_revision to \"{o}\"; else run `alembic merge heads`. Label an intended branch (branch_labels)."
51
+ .violation MultipleMergeHeads(at: node, r: symbol, o: symbol) "Heads {r} and {o} make `alembic upgrade head` fail. Run `alembic merge heads`, or delete one that is a merge never run on a shared database. Label an intended branch (branch_labels)."
52
+
53
+ // ---- the revision graph ------------------------------------------------------------------------------------------
54
+ // The rule keeps its own graph: lib/alembic's al_revision/al_down_revision read string literals only, and its parent
55
+ // count follows the syntax (a tuple is a merge). Here ids are values, and a parent count is a count of ids.
56
+ // mh_value(e, s): expression e is the string s: a literal, or a name bound to a literal in the same file.
57
+ .decl mh_value(e: node, s: symbol)
58
+ mh_value(e, s) :- unparen(e, u), str(u, s).
59
+ mh_value(e, s) :- unparen(e, u), kind(u, "identifier"), static_value(u, s).
60
+ .decl mh_valued(e: node)
61
+ mh_valued(e) :- mh_value(e, _).
62
+ // mh_rev(d, r): revision file d (outside test code) has id r.
63
+ .decl mh_rev(d: number, r: symbol)
64
+ mh_rev(d, r) :- al_migration_doc(d), !al_test_doc(d), al_top_assign(d, "revision", v), mh_value(v, r).
65
+ .decl mh_dir(d: number, p: symbol)
66
+ mh_dir(d, p) :- mh_rev(d, _), doc(d, f, _), p = @replace_all(cat("/", f), "/[^/]*$", "").
67
+ // mh_down_elem(d, e): e names a parent of revision d: its down_revision, or each element of a tuple or list. None
68
+ // (a base) names none.
69
+ .decl mh_down_value(d: number, u: node)
70
+ mh_down_value(d, u) :- mh_rev(d, _), al_top_assign(d, "down_revision", v), unparen(v, u).
71
+ .decl mh_down_elem(d: number, e: node)
72
+ mh_down_elem(d, u) :- mh_down_value(d, u), !kind(u, "tuple"), !kind(u, "list"), !kind(u, "none").
73
+ mh_down_elem(d, e) :- mh_down_value(d, u), (kind(u, "tuple") ; kind(u, "list")), child(u, e, _), !kind(e, "comment").
74
+ // mh_down(d, r): revision d names the parent id r.
75
+ .decl mh_down(d: number, r: symbol)
76
+ mh_down(d, r) :- mh_down_elem(d, e), mh_value(e, r).
77
+ // The graph spans the revision files of the run on purpose: each file states its own id, directory and parent ids
78
+ // (mh_rev, mh_dir, mh_down), and the cross_file relations below join them by revision id string and directory path.
79
+ // They hold documents, ids and paths: no node, no position.
80
+ // mh_known(r): some revision of the run has id r. mh_dir_has(p, r): directory p holds a revision with id r.
81
+ .decl mh_known(r: symbol) cross_file
82
+ mh_known(r) :- mh_rev(_, r).
83
+ .decl mh_dir_has(p: symbol, r: symbol) cross_file
84
+ mh_dir_has(p, r) :- mh_rev(d, r), mh_dir(d, p).
85
+ // mh_parent(n, m): n's parent m, in n's directory first, else anywhere in the run.
86
+ .decl mh_parent(n: number, m: number) cross_file
87
+ mh_parent(n, m) :- mh_dir(n, p), mh_down(n, r), mh_rev(m, r), mh_dir(m, p), m != n.
88
+ mh_parent(n, m) :- mh_dir(n, p), mh_down(n, r), !mh_dir_has(p, r), mh_rev(m, r), m != n.
89
+ // mh_unknown(d): a parent of d is unknown: an element that is no readable value (mh_unread, in d's own file), or an
90
+ // id no revision of the run has.
91
+ .decl mh_unknown(d: number)
92
+ mh_unknown(d) :- mh_unread(d).
93
+ mh_unknown(d) :- mh_down(d, r), !mh_known(r).
94
+ .decl mh_unread(d: number)
95
+ mh_unread(d) :- mh_down_elem(d, e), !mh_valued(e).
96
+ // mh_up(n, m): m is n or an ancestor of n.
97
+ .decl mh_up(n: number, m: number)
98
+ mh_up(n, n) :- mh_rev(n, _).
99
+ mh_up(n, m) :- mh_up(n, k), mh_parent(k, m).
100
+ .decl mh_has_child(m: number)
101
+ mh_has_child(m) :- mh_parent(_, m).
102
+ .decl mh_head(h: number)
103
+ mh_head(h) :- mh_rev(h, _), !mh_has_child(h).
104
+ // mh_pair(h, o): two heads with different ids of one history: they share an ancestor, or they sit in one version
105
+ // directory (a second base).
106
+ .decl mh_pair(h: number, o: number)
107
+ mh_pair(h, o) :- mh_head(h), mh_head(o), h != o, mh_rev(h, r), mh_rev(o, s), r != s, mh_up(h, a), mh_up(o, a).
108
+ mh_pair(h, o) :- mh_head(h), mh_head(o), h != o, mh_rev(h, r), mh_rev(o, s), r != s, mh_dir(h, p), mh_dir(o, p).
109
+ // mh_line(h, o, x): x is on h's own line: h or an ancestor of h that is not o or an ancestor of o.
110
+ .decl mh_line(h: number, o: number, x: number)
111
+ mh_line(h, o, x) :- mh_pair(h, o), mh_up(h, x), !mh_up(o, x).
112
+ // mh_marked(h, o): h's line sets branch_labels: an intentional branch. depends_on is no mark: it joins no heads.
113
+ .decl mh_marked(h: number, o: number)
114
+ mh_marked(h, o) :- mh_line(h, o, x), al_branch_labeled(x).
115
+ // mh_doubt(h, o): h's line holds a revision whose parent is unknown, so its real place in the history is too.
116
+ .decl mh_doubt(h: number, o: number)
117
+ mh_doubt(h, o) :- mh_line(h, o, x), mh_unknown(x).
118
+ // mh_movable(n): revision n has at most one parent id (a base, a string, a tuple or list of one), so it can be rebased.
119
+ .decl mh_movable(n: number)
120
+ mh_movable(n) :- mh_rev(n, _), count : { mh_down(n, _) } <= 1.
121
+ // mh_line_root(h, o, x): x is a first revision of h's line: a movable revision whose parent lies on o's ancestry, or a
122
+ // base. Pointing x at o makes o an ancestor of h. A line made only of merges (two branches that each ran `alembic merge
123
+ // heads` on the same heads) has none.
124
+ .decl mh_line_root(h: number, o: number, x: symbol)
125
+ mh_line_root(h, o, x) :- mh_line(h, o, n), mh_movable(n), mh_parent(n, p), mh_up(o, p), mh_rev(n, x).
126
+ mh_line_root(h, o, x) :- mh_line(h, o, n), mh_movable(n), !mh_has_parent(n), mh_rev(n, x).
127
+ .decl mh_has_parent(n: number)
128
+ mh_has_parent(n) :- mh_parent(n, _).
129
+ .decl mh_has_root(h: number, o: number)
130
+ mh_has_root(h, o) :- mh_line_root(h, o, _).
131
+ // mh_down_assign(d, a): the module-level `down_revision = ...` assignment of revision d.
132
+ .decl mh_down_assign(d: number, a: node)
133
+ mh_down_assign(d, a) :- kind(a, "assignment"), field(a, "left", l), kind(l, "identifier"), text(l, "down_revision"),
134
+ nearest(a, m, scope), kind(m, "module"), docof(a, d), mh_rev(d, _).
135
+
136
+ // mh_conflict(h, o): heads h and o of one history, neither line an intentional branch, both lines fully known.
137
+ .decl mh_conflict(h: number, o: number)
138
+ mh_conflict(h, o) :- mh_pair(h, o), !mh_marked(h, o), !mh_marked(o, h), !mh_doubt(h, o), !mh_doubt(o, h).
139
+ MultipleHeads(a, r, s, x) :- mh_conflict(h, o), mh_line_root(h, o, x), mh_down_assign(h, a), mh_rev(h, r),
140
+ mh_rev(o, s).
141
+ MultipleMergeHeads(a, r, s) :- mh_conflict(h, o), !mh_has_root(h, o), mh_down_assign(h, a), mh_rev(h, r),
142
+ mh_rev(o, s).
143
+
144
+ // The cases, `upstream/alembic-practice/authored/alembic-practice-multiple-heads/`, read as one repository: each line
145
+ // ending in `# caught` is reported, and no other line.
146
+ .test cases exactly
147
+ .fixture "fork/alembic/versions/a1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/fork/alembic/versions/a1_init.py"
148
+ .fixture "fork/alembic/versions/a2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/fork/alembic/versions/a2_email.py"
149
+ .fixture "fork/alembic/versions/a3_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/fork/alembic/versions/a3_orders.py"
150
+ .fixture "fork/alembic/versions/a4_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/fork/alembic/versions/a4_tags.py"
151
+ .fixture "fork/alembic/versions/a5_tag_index.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/fork/alembic/versions/a5_tag_index.py"
152
+ .fixture "labelled/alembic/versions/l1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled/alembic/versions/l1_init.py"
153
+ .fixture "labelled/alembic/versions/l2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled/alembic/versions/l2_email.py"
154
+ .fixture "labelled/alembic/versions/l3_reports.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled/alembic/versions/l3_reports.py"
155
+ .fixture "labelled/alembic/versions/l4_report_rows.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled/alembic/versions/l4_report_rows.py"
156
+ .fixture "merged/alembic/versions/b1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b1_init.py"
157
+ .fixture "merged/alembic/versions/b2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b2_email.py"
158
+ .fixture "merged/alembic/versions/b3_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b3_orders.py"
159
+ .fixture "merged/alembic/versions/b4_merge.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b4_merge.py"
160
+ .fixture "merged/alembic/versions/b5_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b5_tags.py"
161
+ .fixture "merged/alembic/versions/b6_audit.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b6_audit.py"
162
+ .fixture "merged/alembic/versions/b7_notes.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b7_notes.py"
163
+ .fixture "merged/alembic/versions/b8_merge.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/merged/alembic/versions/b8_merge.py"
164
+ .fixture "mergehead/alembic/versions/n1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/mergehead/alembic/versions/n1_init.py"
165
+ .fixture "mergehead/alembic/versions/n2_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/mergehead/alembic/versions/n2_orders.py"
166
+ .fixture "mergehead/alembic/versions/n3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/mergehead/alembic/versions/n3_tags.py"
167
+ .fixture "mergehead/alembic/versions/n4_merge.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/mergehead/alembic/versions/n4_merge.py"
168
+ .fixture "mergehead/alembic/versions/n5_notes.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/mergehead/alembic/versions/n5_notes.py"
169
+ .fixture "remerged/alembic/versions/m1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/remerged/alembic/versions/m1_init.py"
170
+ .fixture "remerged/alembic/versions/m2_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/remerged/alembic/versions/m2_orders.py"
171
+ .fixture "remerged/alembic/versions/m3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/remerged/alembic/versions/m3_tags.py"
172
+ .fixture "remerged/alembic/versions/m4_merge.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/remerged/alembic/versions/m4_merge.py"
173
+ .fixture "remerged/alembic/versions/m5_merge.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/remerged/alembic/versions/m5_merge.py"
174
+ .fixture "services/core/versions/0001_core.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/services/core/versions/0001_core.py"
175
+ .fixture "services/core/versions/0002_core.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/services/core/versions/0002_core.py"
176
+ .fixture "services/tenant/versions/0001_tenant.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/services/tenant/versions/0001_tenant.py"
177
+ .fixture "services/tenant/versions/0002_tenant.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/services/tenant/versions/0002_tenant.py"
178
+ .fixture "services/tenant/versions/0003_tenant.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/services/tenant/versions/0003_tenant.py"
179
+ .fixture "tests/migrations/versions/x1.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/tests/migrations/versions/x1.py"
180
+ .fixture "tests/migrations/versions/x2.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/tests/migrations/versions/x2.py"
181
+ .fixture "tests/migrations/versions/x3.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/tests/migrations/versions/x3.py"
182
+ .fixture "dependson/alembic/versions/d1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dependson/alembic/versions/d1_init.py"
183
+ .fixture "dependson/alembic/versions/d2_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dependson/alembic/versions/d2_orders.py"
184
+ .fixture "dependson/alembic/versions/d3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dependson/alembic/versions/d3_tags.py"
185
+ .fixture "dependson_list/alembic/versions/e1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dependson_list/alembic/versions/e1_init.py"
186
+ .fixture "dependson_list/alembic/versions/e2_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dependson_list/alembic/versions/e2_orders.py"
187
+ .fixture "dependson_list/alembic/versions/e3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dependson_list/alembic/versions/e3_tags.py"
188
+ .fixture "two_bases/alembic/versions/a1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/two_bases/alembic/versions/a1_init.py"
189
+ .fixture "two_bases/alembic/versions/a2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/two_bases/alembic/versions/a2_email.py"
190
+ .fixture "two_bases/alembic/versions/b1_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/two_bases/alembic/versions/b1_orders.py"
191
+ .fixture "second_base_line/alembic/versions/c1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/second_base_line/alembic/versions/c1_init.py"
192
+ .fixture "second_base_line/alembic/versions/c2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/second_base_line/alembic/versions/c2_email.py"
193
+ .fixture "second_base_line/alembic/versions/k1_orders.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/second_base_line/alembic/versions/k1_orders.py"
194
+ .fixture "second_base_line/alembic/versions/k2_order_rows.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/second_base_line/alembic/versions/k2_order_rows.py"
195
+ .fixture "labelled_base/alembic/versions/g1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled_base/alembic/versions/g1_init.py"
196
+ .fixture "labelled_base/alembic/versions/g2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled_base/alembic/versions/g2_email.py"
197
+ .fixture "labelled_base/alembic/versions/h1_plugins.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/labelled_base/alembic/versions/h1_plugins.py"
198
+ .fixture "unresolved/alembic/versions/u1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/unresolved/alembic/versions/u1_init.py"
199
+ .fixture "unresolved/alembic/versions/u2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/unresolved/alembic/versions/u2_email.py"
200
+ .fixture "unresolved/alembic/versions/u3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/unresolved/alembic/versions/u3_tags.py"
201
+ .fixture "dangling/alembic/versions/v2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dangling/alembic/versions/v2_email.py"
202
+ .fixture "dangling/alembic/versions/v3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dangling/alembic/versions/v3_tags.py"
203
+ .fixture "dangling/alembic/versions/w1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/dangling/alembic/versions/w1_init.py"
204
+ .fixture "constant/alembic/versions/s1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant/alembic/versions/s1_init.py"
205
+ .fixture "constant/alembic/versions/s2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant/alembic/versions/s2_email.py"
206
+ .fixture "constant/alembic/versions/s3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant/alembic/versions/s3_tags.py"
207
+ .fixture "constant_revision/alembic/versions/x1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_revision/alembic/versions/x1_init.py"
208
+ .fixture "constant_revision/alembic/versions/x2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_revision/alembic/versions/x2_email.py"
209
+ .fixture "constant_revision/alembic/versions/x3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_revision/alembic/versions/x3_tags.py"
210
+ .fixture "constant_merge/alembic/versions/t1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_merge/alembic/versions/t1_init.py"
211
+ .fixture "constant_merge/alembic/versions/t2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_merge/alembic/versions/t2_email.py"
212
+ .fixture "constant_merge/alembic/versions/t3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_merge/alembic/versions/t3_tags.py"
213
+ .fixture "constant_merge/alembic/versions/t4_merge.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/constant_merge/alembic/versions/t4_merge.py"
214
+ .fixture "single_tuple/alembic/versions/r1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/single_tuple/alembic/versions/r1_init.py"
215
+ .fixture "single_tuple/alembic/versions/r2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/single_tuple/alembic/versions/r2_email.py"
216
+ .fixture "single_tuple/alembic/versions/r3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/single_tuple/alembic/versions/r3_tags.py"
217
+ .fixture "single_list/alembic/versions/j1_init.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/single_list/alembic/versions/j1_init.py"
218
+ .fixture "single_list/alembic/versions/j2_email.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/single_list/alembic/versions/j2_email.py"
219
+ .fixture "single_list/alembic/versions/j3_tags.py" from "../upstream/alembic-practice/authored/alembic-practice-multiple-heads/single_list/alembic/versions/j3_tags.py"
220
+ .expect _ at "fork/alembic/versions/a3_orders.py":8
221
+ .expect _ at "fork/alembic/versions/a5_tag_index.py":6
222
+ .expect _ at "mergehead/alembic/versions/n4_merge.py":4
223
+ .expect _ at "mergehead/alembic/versions/n5_notes.py":6
224
+ .expect _ at "remerged/alembic/versions/m4_merge.py":4
225
+ .expect _ at "remerged/alembic/versions/m5_merge.py":4
226
+ .expect _ at "dependson/alembic/versions/d2_orders.py":6
227
+ .expect _ at "dependson/alembic/versions/d3_tags.py":6
228
+ .expect _ at "dependson_list/alembic/versions/e2_orders.py":8
229
+ .expect _ at "dependson_list/alembic/versions/e3_tags.py":8
230
+ .expect _ at "two_bases/alembic/versions/a2_email.py":6
231
+ .expect _ at "two_bases/alembic/versions/b1_orders.py":8
232
+ .expect _ at "second_base_line/alembic/versions/c2_email.py":6
233
+ .expect _ at "second_base_line/alembic/versions/k2_order_rows.py":6
234
+ .expect _ at "constant/alembic/versions/s2_email.py":6
235
+ .expect _ at "constant/alembic/versions/s3_tags.py":8
236
+ .expect _ at "constant_revision/alembic/versions/x2_email.py":9
237
+ .expect _ at "constant_revision/alembic/versions/x3_tags.py":6
238
+ .expect _ at "single_tuple/alembic/versions/r2_email.py":6
239
+ .expect _ at "single_tuple/alembic/versions/r3_tags.py":6
240
+ .expect _ at "single_list/alembic/versions/j2_email.py":8
241
+ .expect _ at "single_list/alembic/versions/j3_tags.py":6
242
+ .end