Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[turborepo] Logging colors are non-deterministic #2564

Closed
preynal opened this issue Nov 2, 2022 · 5 comments
Closed

[turborepo] Logging colors are non-deterministic #2564

preynal opened this issue Nov 2, 2022 · 5 comments
Labels
area: logging Improvements to logging good first issue Good for newcomers kind: bug Something isn't working owned-by: turborepo

Comments

@preynal
Copy link

preynal commented Nov 2, 2022

What version of Turborepo are you using?

1.6.3

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

CLI colors are changing between runs for the same package.
It sure looks pretty for VC demos, but is very confusing, as a user expects the package name to have the same color between consecutive runs.

Screenshot 2022-11-02 at 17 22 32

Screenshot 2022-11-02 at 17 23 05

Expected Behavior

Colors of a package name in the CLI must remain the same no matter when or where you run the CLI

To Reproduce

Run a turbo repo command twice, the colours will randomly change.

Reproduction Repo

No response

@preynal preynal added the kind: bug Something isn't working label Nov 2, 2022
@mehulkar
Copy link
Contributor

mehulkar commented Nov 2, 2022

I believe this is not deterministic because the order of tasks running is also not deterministic (by design). We could base the color on the task name itself to make it deterministic, but I'm not sure how we'd support an unbounded number of colors (I'm sure it's possible, just not sure off the top of my head what's available)

The code is here:

https://github.com/vercel/turbo/blob/261d22177f6c7301f9c5e93518112b025b15d7aa/cli/internal/colorcache/colorcache.go#L33-L45

@mehulkar mehulkar changed the title [turborepo] [turborepo] Logging colors are non-deterministic Nov 2, 2022
@mehulkar mehulkar added area: turborepo area: logging Improvements to logging labels Nov 2, 2022
@scamden
Copy link

scamden commented Jan 7, 2023

wouldn't have to be unbound could just hash to an integer and modulus to the number of colors to least stay consistent. just a thought (i noticed this even for a single task)

@jtlapp
Copy link

jtlapp commented Feb 9, 2023

I just had a build fail and was left typing invisible characters into the shell prompt. My background was black, so maybe the characters were also black.

@Hacksore
Copy link

Hacksore commented Apr 6, 2023

What's even more undesirable is even the replayed output from a >>> FULL TURBO cached run does not yield a deterministic color 😢.

I'd imagine with the port to rust it would be a good idea to make the color be derived from the package/task name.

cc @anthonyshew since were talking about this the other day.

@anthonyshew
Copy link
Contributor

@Shaharking was awesome and got this fixed up in #9023.

While task colors aren't fully deterministic at all times with this change, they're deterministic when you run the same graph multiple times, which is likely what most folks are looking for and what we're reasonably capable of doing.

Thanks again, @Shaharking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: logging Improvements to logging good first issue Good for newcomers kind: bug Something isn't working owned-by: turborepo
Projects
None yet
Development

No branches or pull requests

7 participants