fix: make dead_lettering.cr compile standalone - #2172
Open
viktorerlingsson wants to merge 1 commit into
Open
Conversation
`dead_lettering.cr` references `AMQP::Queue` in the `Task` alias but never required it, so the CI job that compiles each changed `*.cr` file on its own failed on this file. Requiring `../queue/queue` at the top doesn't work: `queue.cr` does `include Argument::DeadLettering`, and an `include` needs the module body already processed, so entering from this file fails the other way around. Requiring it after the module is defined satisfies both entry points - the in-progress require is a no-op on the second pass, and the alias target resolves in the later semantic phase.
|
No issues found. The change adds |
viktorerlingsson
marked this pull request as ready for review
August 7, 2026 11:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CI job that compiles each changed
*.crfile independently has been failing onsrc/lavinmq/amqp/argument/dead_lettering.cr:The file references
AMQP::Queueinalias Task = {AMQP::Queue, Message} | MessageRoutedCallbackbut never requires it. It only builds as part of the full program becausequeue.crrequires it.Requiring
../queue/queueat the top doesn't work -queue.crdoesinclude Argument::DeadLettering, and anincludeneeds the module body already processed, so entering fromdead_lettering.crjust fails the other way (undefined constant Argument::DeadLettering). Requiring it after the module is defined satisfies both entry points: the in-progress require is a no-op on the second pass, and the alias target resolves in the later semantic phase.Note this wasn't introduced by 8256eff - the file already failed standalone before it. That commit was just the first to touch the file after the changed-files check landed, which is where it surfaced.
Test plan
crystal build --no-codegen --error-on-warnings src/lavinmq/amqp/argument/dead_lettering.crpassessrc/**/*.cr- this was the only failure repo-widecrystal build --no-codegen --error-on-warnings src/lavinmq.cr,make lint,crystal tool format --check src/all cleanmake testgreen🤖 Generated with Claude Code