Skip to content

feat: preserve glob imports in generated migrations - #662

Open
oxura wants to merge 1 commit into
cot-rs:masterfrom
oxura:fix/69-migration-glob-imports
Open

feat: preserve glob imports in generated migrations#662
oxura wants to merge 1 commit into
cot-rs:masterfrom
oxura:fix/69-migration-glob-imports

Conversation

@oxura

@oxura oxura commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The symbol resolver cannot enumerate names introduced by a glob import, so model field types reached generated migrations without either a fully resolved path or the import that made the name visible. It also emitted a warning even though the generator can preserve the original scope another way.

The resolver now extracts top-level glob branches from ordinary and grouped use trees. It rewrites self and super prefixes to stable crate-relative paths, preserves attributes such as cfg, and leaves explicit imports on the existing symbol-resolution path. Models carry those imports into generated migrations; imports from multiple changed models are deduplicated before emission.

Verification:

  • red/green regression for crate-relative and super glob imports
  • generated migration compile regression using a model whose macro and field type come from a glob
  • Cot Codegen suites: 59 passed
  • Cot CLI library suite: 52 passed
  • migration generator integration suite: 15 passed
  • cargo +1.94.0 fmt --all -- --check
  • Cot Codegen and CLI Clippy across all targets/features with warnings denied (unknown-lints allowed for the upstream toolchain compatibility issue)

Closes #69.

@github-actions github-actions Bot added C-cli Crate: cot-cli (issues and Pull Requests related to Cot CLI) C-codegen Crate: cot-codegen labels Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cli Crate: cot-cli (issues and Pull Requests related to Cot CLI) C-codegen Crate: cot-codegen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle glob imports in the migration generator

1 participant