Skip to content

Depend on railties instead of rails, support SolidQueue job IDs, and write STDOUT unbuffered - #19

Merged
ndbroadbent merged 4 commits into
mainfrom
nathan/compatibility-fixes
Oct 17, 2026
Merged

ndbroadbent merged 4 commits into
mainfrom
nathan/compatibility-fixes

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Fourth of twelve stacked PRs for 0.2.0.

What this fixes

Addresses #7 and #9.

Testing

Sorbet and the unit suite (303 tests) pass at this branch's tip. CI's new job boots an app with only railties and actionpack.


Stack for 0.2.0, merged in order: #16 → #17 → #18 → #19 → #20 → #21 → #22 → #23 → #24 → #25 → #26 → #27

Active Job backends set provider_job_id to a String or an Integer;
SolidQueue uses the ID of its job row. The log subscriber passed it
straight into a T.nilable(String) field, so every job event raised a
TypeError under SolidQueue.

Builders::ActiveJob had the same bug, but nothing requires or calls it,
so it's removed rather than fixed.

Fixes #7
LogStruct only needs railties for its Railtie, actionpack for its
middleware and request logs, activesupport and globalid. Depending on
the rails gem pulled Active Record, Active Storage, Action Cable and the
other frameworks into apps that don't use them. The integrations for
those frameworks already load only when the framework is present; the
formatter's Active Record check no longer assumes it is.

A new CI job boots an app whose bundle has railties and actionpack but
none of the other frameworks, and checks that it logs JSON app and
request lines.

Fixes #9
Ruby buffers STDOUT when it isn't a terminal, as in a container, so
log lines waited until the buffer filled or the process exited, and a
crash lost them. Puma and Sidekiq sync STDOUT themselves, but GoodJob's
executable only does when it adds its own text logger. The STDOUT
appender now syncs STDOUT.
LogStruct added a file appender whenever Rails had a log path, so with
RAILS_LOG_TO_STDOUT set every line was written to STDOUT and to
log/<env>.log as well. In a container nothing reads or rotates that
file, so it only grew. RAILS_LOG_TO_STDOUT now means STDOUT only, as it
does for Rails' own logger.
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 9 billable files and costs up to $2.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 37 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 53 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 0073cdb9-2775-404f-a83e-1874695c892a
📥 Commits

Reviewing files that changed from the base of the PR and between 48fd620 and 3e9b266.

⛔ Files ignored due to path filters: 1
  • Gemfile.lock is excluded by !**/*.lock
📒 Files selected for processing: 9
  • .github/workflows/test.yml
  • lib/log_struct/builders/active_job.rb
  • lib/log_struct/formatter.rb
  • lib/log_struct/integrations/active_job/log_subscriber.rb
  • lib/log_struct/semantic_logger/setup.rb
  • logstruct.gemspec
  • scripts/railties_smoke_test.sh
  • test/log_struct/integrations/active_job/log_subscriber_test.rb
  • test/log_struct/semantic_logger_test.rb
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@ndbroadbent
ndbroadbent changed the base branch from nathan/integration-fixes to main October 17, 2026 23:12
@ndbroadbent
ndbroadbent merged commit f4d9ffd into main Oct 17, 2026
1 check passed
@ndbroadbent
ndbroadbent deleted the nathan/compatibility-fixes branch October 17, 2026 23:13
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