fix(models): rename sqlalchemy.text import to avoid shadowing by InvariantModel text column
CI / push-validation (pull_request) Successful in 40s
CI / helm (pull_request) Successful in 48s
CI / lint (pull_request) Failing after 1m39s
CI / build (pull_request) Successful in 1m38s
CI / typecheck (pull_request) Failing after 2m8s
CI / quality (pull_request) Successful in 2m38s
CI / security (pull_request) Successful in 3m18s
CI / integration_tests (pull_request) Failing after 7m43s
CI / unit_tests (pull_request) Failing after 10m31s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 2s

The InvariantModel class defined a Column named "text" which shadowed the
sqlalchemy.text() function used in server_default, postgresql_where, and
sqlite_where expressions. Renamed the import from "text" to "sa_text" and
updated all 4 usages.

ISSUES CLOSED: #8573
This commit is contained in:
2026-05-13 00:36:31 +00:00
committed by CleverThis
parent c86529e2d3
commit dbff3c7b2e
@@ -61,7 +61,7 @@ from sqlalchemy import (
Text,
UniqueConstraint,
create_engine,
text,
text as sa_text,
)
from sqlalchemy.orm import (
Mapped,
@@ -1774,7 +1774,7 @@ class ResourceLinkModel(Base): # type: ignore[misc]
Text,
nullable=False,
default="contains",
server_default=text("'contains'"),
server_default=sa_text("'contains'"),
)
# Timestamp (ISO-8601 string)
@@ -2843,8 +2843,8 @@ class DecisionModel(Base): # type: ignore[misc]
Index(
"idx_decisions_superseded",
"superseded_by",
postgresql_where=text("superseded_by IS NOT NULL"),
sqlite_where=text("superseded_by IS NOT NULL"),
postgresql_where=sa_text("superseded_by IS NOT NULL"),
sqlite_where=sa_text("superseded_by IS NOT NULL"),
),
)
@@ -3270,7 +3270,7 @@ class CorrectionAttemptModel(Base): # type: ignore[misc]
created_at = Column(
String(30),
nullable=False,
server_default=text("(strftime('%Y-%m-%dT%H:%M:%f', 'now'))"),
server_default=sa_text("(strftime('%Y-%m-%dT%H:%M:%f', 'now'))"),
)
completed_at = Column(String(30), nullable=True)
@@ -3428,11 +3428,11 @@ class InvariantModel(Base): # type: ignore[misc]
source_name = Column(String(255), nullable=False)
# Soft-delete flag (active vs archived)
active = Column(Boolean, nullable=False, default=True, server_default=text("1"))
active = Column(Boolean, nullable=False, default=True, server_default=sa_text("1"))
# Whether this invariant cannot be overridden by project-level invariants
non_overridable = Column(
Boolean, nullable=False, default=False, server_default=text("0"),
Boolean, nullable=False, default=False, server_default=sa_text("0"),
)
# Timestamp (ISO-8601 string)