"""drop machine-written uses edges that cross projects Revision ID: 0125 Revises: 0124 Create Date: 2026-10-26 A `uses` edge with basis `reference` is the proposer's by-name reading: the shape's body names a canon's symbol. A body never calls a function defined in another project's repository, so such an edge across projects is a common word matched, not a call. The proposer no longer writes them, and this removes the ones it wrote before. Edges a person or an audit judged keep their own basis and are left alone. Rows within one project are re-read on the next coverage refresh, which replaces their reference edges under the same rule. Downgrade restores nothing: the removed edges were never facts. """ from alembic import op revision = "0125" down_revision = "0124" branch_labels = None depends_on = None def upgrade() -> None: op.execute( "DELETE FROM code_shape_uses u USING code_shapes s, notes n " "WHERE u.shape_id = s.id AND u.snippet_id = n.id " "AND u.basis = 'reference' " "AND n.project_id IS NOT NULL AND n.project_id <> s.project_id" ) def downgrade() -> None: pass