Shopify / Shopify/cli-ui

Weak guarantees for `IO#write` override

Open
#434 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.1k
Forks
57
Avg merge
2h 55m
Merged PRs (30d)
2

Description

During CI bug investigation we noticed this code: https://github.com/Shopify/cli-ui/blob/f6294ff1864dc3279fa7ca08ec79d17b338fe1f5/lib/cli/ui/stdout_router.rb#L402-L410 overriding IO#write for STDOUT and STDERR. This is quietly disabled by any call on IO#reopen, for example: a test calling #capture from https://github.com/rails/rails/blob/0e99d0893b0e98c626a3c7d8972eea22d29c9d25/activesupport/lib/active_support/testing/stream.rb#L23-L38

If the goal of the cli-ui code to be permanent, it needs adjustments. This is true for CRuby and TruffleRuby engines.

More details: https://github.com/oracle/truffleruby/pull/3088

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/cli/ui/stdout_router.rb around lines 402-410, then inspect the ActiveSupport stream capture code linked in the issue and the referenced TruffleRuby pull request. Reproduce how IO#reopen affects the STDOUT and STDERR write overrides on CRuby and TruffleRuby; done means the intended cli-ui behavior remains reliable after reopen.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.