Skip to content

fix(codegen-kotlin): import cross-package Table objects in MetadataStartupValidator#48

Merged
dmealing merged 1 commit into
mainfrom
fix/codegen-kotlin-validator-cross-package-imports
Jun 20, 2026
Merged

fix(codegen-kotlin): import cross-package Table objects in MetadataStartupValidator#48
dmealing merged 1 commit into
mainfrom
fix/codegen-kotlin-validator-cross-package-imports

Conversation

@dmealing

Copy link
Copy Markdown
Member

What

KotlinValidatorGenerator emitted the generated MetadataStartupValidator registry with bare <Entity>Table references and no imports:

package partylore
private val tablesToValidate = listOf(
    "partylore::arc::ActiveStoryArc" to ActiveStoryArcTable,  // ← unresolved
    ...
)

But each <Entity>Table lives in its entity's own package (partylore.arc.ActiveStoryArcTable, partylore.compliance.ConsentRecordTable, …), while the validator is emitted into a single configured package. Any entity in a different package than the validator → "unresolved reference" compile error. That's every real multi-package project (it surfaced wiring the startup validator over a 16-package domain).

Fix

The validator now imports each Table object whose package differs from the validator's own package — exactly the cross-package import handling KotlinExposedTableGenerator already does for FK targets.

Tests

  • New multi-package regression test asserts import acme.blog.AuthorTable / import acme.shop.OrderTable are emitted when entities live in different packages.
  • Existing single-package test unchanged (no imports when packages match).

🤖 Generated with Claude Code

…artupValidator

KotlinValidatorGenerator emitted bare `<Entity>Table` references in the
generated MetadataStartupValidator registry, but the Table objects live in
their entity's own package (`partylore.arc.ActiveStoryArcTable`, …) while the
validator is emitted into a single configured package. Any entity in a
different package than the validator produced an "unresolved reference"
compile error — i.e. every multi-package project.

The validator now imports each Table object whose package differs from its
own, mirroring the cross-package import handling in KotlinExposedTableGenerator.
Adds a multi-package regression test; the existing single-package test is
unchanged (no imports emitted when packages match).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dmealing
dmealing enabled auto-merge June 20, 2026 06:07
@dmealing
dmealing merged commit 95ed8a2 into main Jun 20, 2026
29 checks passed
@dmealing
dmealing deleted the fix/codegen-kotlin-validator-cross-package-imports branch June 20, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant