@dataclass on MigrationError breaks drift error reporting (TypeError instead of MigrationDriftError) #244
Labels
No labels
blocked:children
blocked:commit-ready-failed
blocked:depends-231
blocked:depends-236
blocked:depends-237
blocked:depends-238
blocked:depends-239
blocked:gate-fetch
blocked:gate-fetch
blocked:gate-lint
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:no-changes
blocked:no-procedure
blocked:preflight
blocked:verify-failed
bug
enhancement
feature-request
high-priority
in-progress
lint-cleanup
needs-decompose
needs-triage
ops-retry
ops-task
phase-5
quickfix
security/medium
self-building
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/mesh-seed#244
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug Report
Description
MigrationErrorbase class insubstrate/ledger/migrations.py:118is decorated with@dataclass, which generates an__init__that takes onlyself. Subclasses (MigrationDriftError,UnknownMigrationError,ChecksumMismatchError) callsuper().__init__(message), which fails because the dataclass__init__doesn't accept a message argument.Impact
When a pre-migration ledger.db is encountered (drift detection), instead of raising
MigrationDriftError, the code raises:The
db_migrate.py verifycommand (which catchesMigrationDriftError) won't report drift properly, making the migration verification path effectively broken.Reproduction Steps
python -m substrate.ledger.db_migrate verify(or any code path that triggersMeshLedger.__init__()with an existing DB)TypeErrorinstead of the expectedMigrationDriftErrorExpected Behavior
Drift detection should raise
MigrationDriftError(or a subclass) so the verification CLI can report the issue properly.Actual Behavior
Root Cause
The
@dataclassdecorator generates an__init__that conflicts with the exception protocol. Subclasses callsuper().__init__(message), which fails.Fix
Remove
@dataclassfromMigrationError(line 118). The subclasses set instance attributes manually already.Discovered By
Post-deploy probe of issue #166 (DATA-004: Database Migration)
References
Kanban card:
t_befb3f36(QA board)QA reconciliation found the issue was closed without a landed fix. The prior QA run created local commit
07abae2on branchfix/mesh-seed-244-dataclass-migrationerror, but neither commit nor branch exists on Forgejo. Currentorigin/masteris92521ce;substrate/ledger/migrations.py:118still decoratesMigrationErrorwith@dataclass. Direct reproduction on that HEAD still raisesTypeError: MigrationError.__init__() takes 1 positional argument but 2 were given. Reopening until the fix is pushed/merged and verified.Fix pushed as PR #266 (#266). Single line change: remove
@dataclassfromMigrationErrorat line 118. Awaiting merge and verification.