fix(dealix): rename EvidencePack.metadata_ to pack_metadata

SQLAlchemy 2.0 reserves 'metadata' as a class-level attribute on
DeclarativeBase classes. Using metadata_ Python attribute with column
name 'metadata' caused issues during table creation in init_db(),
which prevented pytest from collecting tests (exit code 4).

Renamed to pack_metadata to avoid all reserved-name conflicts.

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
This commit is contained in:
Claude 2026-04-16 15:14:09 +00:00
parent 2421e41e7a
commit 37c99f43ed
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class EvidencePack(TenantModel):
assembled_by_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True) assembled_by_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True)
status = Column(Enum(EvidencePackStatus), nullable=False, default=EvidencePackStatus.ASSEMBLING) status = Column(Enum(EvidencePackStatus), nullable=False, default=EvidencePackStatus.ASSEMBLING)
contents = Column(JSONB, default=list) # list of evidence items contents = Column(JSONB, default=list) # list of evidence items
metadata_ = Column("metadata", JSONB, default=dict) pack_metadata = Column(JSONB, default=dict)
reviewed_by_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True) reviewed_by_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=True)
reviewed_at = Column(DateTime(timezone=True), nullable=True) reviewed_at = Column(DateTime(timezone=True), nullable=True)
hash_signature = Column(String(64), nullable=True) # SHA256 of contents hash_signature = Column(String(64), nullable=True) # SHA256 of contents

View File

@ -45,7 +45,7 @@ class EvidencePackService:
assembled_by_id=assembled_by_id, assembled_by_id=assembled_by_id,
status=EvidencePackStatus.READY, status=EvidencePackStatus.READY,
contents=pack_contents, contents=pack_contents,
metadata_=metadata or {}, pack_metadata=metadata or {},
hash_signature=hash_sig, hash_signature=hash_sig,
) )
db.add(pack) db.add(pack)