Skip to content

MigrationFeature never executes discovered KatalystMigration classes (1.0.0-alpha05) #16

Description

@darkryh

Summary

On 1.0.0-alpha05, KatalystMigration classes that are correctly discovered under scanPackages(...) are never executed at startup. MigrationFeature.onReady completes without running any migration, regardless of the runAtStartup setting.

Observed behavior

  • A KatalystMigration (via SqlMigration) placed under a scanned package is discovered and registered by the DI container — but only under its own concrete class.
  • KatalystMigration::class is included in AutoBindingRegistrar's reserved secondary-binding filter, and it is also absent from multiBindingSecondaryTypes.
  • As a result, context.getAll<KatalystMigration>() inside the migration feature always returns an empty list, so no migration is ever looked up or executed. There is no error, no warning — the boot log simply shows no migration activity.

Reproduction

  1. Consumer app on 1.0.0-alpha05 with features { enableMigrations() } (and the migrations starter on the classpath).
  2. Add any KatalystMigration/SqlMigration under a scanPackages(...) root.
  3. Boot against an empty database.
  4. The migration never runs and the migration history table records nothing, even though DI discovery logs show the class was found. Verified by tracing katalyst-di's AutoBindingRegistrar and the boot log of a real application.

Impact

  • Any consumer relying on runAtStartup migrations silently gets no schema management. Apps using schema { createMissing() } mask the problem (DDL still appears, created by the schema policy instead), which makes the failure easy to miss.
  • Apps using validateOnStartup()/none() with migration-managed schemas would fail boot or run against a missing schema.
  • Direct MigrationRunner usage is unaffected (executing the same migration through MigrationRunner in a test works and is how this was isolated).

Environment

  • io.github.darkryh.katalyst:*:1.0.0-alpha05 (Maven Central)
  • JDK 21, Kotlin 2.4.x, Ktor 3.5.x, PostgreSQL (also reproducible in tests against H2)

Found while shipping the first KatalystMigration in a downstream application; as far as we can tell this affects every discovered migration on this version, not an edge case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions