@dataclass on MigrationError breaks drift error reporting (TypeError instead of MigrationDriftError) #245
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#245
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?
Overview
MigrationDriftError.__init__crashes with aTypeErrorbecause the parent classMigrationErroris decorated with@dataclass(no fields) and its generated__init__only acceptsself. WhenMigrationDriftError.__init__callssuper().__init__(message_string), Python raises:This means that when the migration system detects drift (checksum mismatch), it crashes instead of reporting the error properly. Both the
db_migrate.pyCLI tool andMeshLedger.__init__are affected.Impact
MigrationDriftErrordb_migrate.pyCLI crashes immediately on any database with applied migrations where drift is presentMeshLedger.__init__→upgrade()→_applied_versions()path crashes when checksum mismatch is foundverify()catch block at line 930–933 catchesMigrationDriftErrorbut the TypeError propagates uncaughtExpected Behavior
When checksum drift is detected,
MigrationDriftErrorshould be raised with a descriptive message explaining which migration has a checksum mismatch.Actual Behavior
A
TypeError: MigrationError.__init__() takes 1 positional argument but 2 were givenis raised instead, becausesuper().__init__(msg)fails on the@dataclass-decorated parent.File & Line
substrate/ledger/migrations.py:136-143Root Cause
Fix Options
@dataclassfromMigrationErrorand add a manual__init__that accepts an optional messageinit=Falseto@dataclassonMigrationError@dataclassfield toMigrationErrorthat can hold the message__str__to handle the message attributeSteps to Reproduce
substrate/ledger.dbwith an applied migration whose stored checksum differs from the computed one (or run the migrations then manually alter migration SQL)scripts/db_migrate.py upgradeor startMeshLedgerTypeError: MigrationError.__init__() takes 1 positional argument but 2 were giveninstead of aMigrationDriftErrorDetection
Found during post-deploy probe after fix commit
7c46ed3(DATA-004).See kanban card t_7ee26fdd for the full probe context.
QA FAILED — false-positive close (reopened 2026-08-04)
This issue was closed at 2026-08-04T04:34:57Z as part of the kanban reconciliation sweep, but no fix is on master. The bug is still live.
Independent verification on master HEAD
92521ce956Bug reproduces live:
substrate/ledger/migrations.pyline 118 still has@dataclassonMigrationError, exactly as the issue body reports.Fix state
fix/mesh-seed-244-dataclass-migrationerror(commit07abae2): removes the@dataclassdecorator — addresses the same root cause but titled under #244, not #245.mesh-seed-245*branch exists.07abae2.What needs to happen
fix/mesh-seed-244-dataclass-migrationerrorinto master (or rebase/cherry-pick to a properly-titled #245 branch).Why the previous close was wrong
The kanban reconciliation sweep on 2026-08-04 closed multiple Forgejo issues across repos without verifying the fix existed on master. This is one of them. The same pattern was confirmed today on mesh-seed #176, #231, #252, #253, #256, #257, plus nodedesk #38, easystitch #109, docker_backup #20, and org_mode #17 — all reopened with evidence.
Reopened by tasker-worker on kanban card t_100d8388.
QA verification — 2026-08-04 (second-pass)
Re-verifying after the 12:05Z reopen to confirm state has not silently flipped.
Live state on master HEAD
92521ce9:92521ce956fix/mesh-seed-244-dataclass-migrationerror: no longer exists on origin (onlymaster,fix/mesh-seed-253-contract-id,mesh-seed-36-bone-compilation,slo-specs-150)Bug still reproduces on master:
substrate/ledger/migrations.py:118still has@dataclassonMigrationError. Exactly as the original issue body describes.The previously-identified fix commit
07abae2does resolve the bug — verified by checking outfix/mesh-seed-244-dataclass-migrationerror(still recoverable in local reflog): removing the@dataclassdecorator on line 118 produces the correctMigrationDriftErrorwith the descriptive drift message. The fix is 1 line, surgical, and correct.QA verdict: FAIL — issue correctly remains open. No fix on master. The earlier reopen stands.
Re-verified by tasker-worker on kanban card t_bdc269f8.
QA verification — 2026-08-04 (third-pass)
Issue was false-positive closed at 2026-08-04T14:30:23Z — reopened.
Live state on master HEAD
92521ce956cf:substrate/ledger/migrations.py:118still has@dataclassonMigrationErrorfix/mesh-seed-244-dataclass-migrationerrorwas deleted)Root cause:
MigrationErroris decorated with@dataclass(no fields), so its generated__init__only acceptsself. WhenMigrationDriftError.__init__callssuper().__init__(message_string), Python raises TypeError.Fix: Remove
@dataclassdecorator fromMigrationError(line 118). 1-line surgical fix, verified in reflog on the deleted branch.QA verdict: FAIL — bug still live on master. Issue correctly remains open.
Re-opened: false-positive close confirmed. Issue was closed but no fix commit exists on master. Re-adding triage-approved to route back through the pipeline.
QA verified 2026-08-08: fix is on master. PR #266 (merge
134c00c, commit07abae2'fix #244: remove @dataclass from MigrationError') landed 2026-08-04T17:06:34Z - same root cause/fix as this issue (duplicate of #244, which closed at merge time). Verified on origin/master3dd9456: @dataclass removed from MigrationError (migrations.py:118); MigrationDriftError/UnknownMigrationError/ChecksumMismatchError raise correctly; drift scenario raises MigrationDriftError (not TypeError) in status() and MeshLedger.init; verify() returns False on drift; db_migrate verify exits 1 on drift, 0 clean; 63/63 ledger+gates unit tests pass. Closing as completed.