gabriel / musehub public
0091_stable_unchanged_for.py python
36 lines 1.4 KB
Raw
sha256:b4b999434d042d74edc7032f1f2cfd20fda5b3580fe85966351db5b8eef0abb3 feat(intel): every grammar on the hub, and every intel job … Opus 5.5 minor ⚠ breaking 1 day ago
1 """musehub_intel_stable.unchanged_for: the CLI's stability measure (muse#251)
2
3 ``muse code stable`` ranks symbols by ``unchanged_for``, the number of commits since the symbol last changed (the whole walk
4 when it never did); the hub's StableProvider now computes exactly that with Muse's own library and stores it here.
5 ``days_stable`` stays as the calendar-days view of the same row.
6
7 Revision ID: 0091
8 Revises: 0090
9
10 Additive (one column with a server default; no row is rewritten beyond the default fill). Rollback: swap traffic back to the
11 previous blue/green slot, which is still running the previous image; that image never reads this column. Redeploying the
12 previous image through deploy.sh is NOT a rollback: its migration step runs ``alembic current`` against a revision graph that
13 has no 0091 and fails.
14 """
15 from __future__ import annotations
16
17 import sqlalchemy as sa
18 from alembic import op
19
20 revision: str = "0091"
21 down_revision: str = "0090"
22 branch_labels = None
23 depends_on = None
24
25
26 def upgrade() -> None:
27 # Fail fast (and retry the deploy) rather than queue behind a long-running transaction.
28 op.execute("SET LOCAL lock_timeout = '5s'")
29 op.add_column(
30 "musehub_intel_stable",
31 sa.Column("unchanged_for", sa.Integer(), nullable=False, server_default="0"),
32 )
33
34
35 def downgrade() -> None:
36 op.drop_column("musehub_intel_stable", "unchanged_for")
File History 1 commit
sha256:b4b999434d042d74edc7032f1f2cfd20fda5b3580fe85966351db5b8eef0abb3 feat(intel): every grammar on the hub, and every intel job … Opus 5.5 minor ⚠ 1 day ago