Skip to content

Publish color overrides atomically - #233

Open
rksharma-owg wants to merge 4 commits into
colored-rs:masterfrom
rksharma-owg:codex/fix-atomic-color-override
Open

rksharma-owg wants to merge 4 commits into
colored-rs:masterfrom
rksharma-owg:codex/fix-atomic-color-override

Conversation

@rksharma-owg

Copy link
Copy Markdown

ShouldColorize currently publishes its manual-override flag before its value using two relaxed atomics. A concurrent reader can see a newly enabled override with the previous value, producing a color decision that matches neither the automatic setting nor the requested override.

Store automatic, forced-on and forced-off states in one private atomic byte. Public methods and environment-variable precedence stay the same. Add two Loom tests using the actual control implementation and a transition test covering restoration of all six environment decisions. Both Loom tests fail on the original implementation and pass with the fix.

Two existing CI blockers are repaired in separate commits: use iterator indices in the nested-style reset loop for current Clippy, and resolve test dependencies against the declared MSRV using modern Cargo before compiling/testing with Rust 1.80. Stable and beta continue testing their usual dependency resolution. The Clippy repair and MSRV repair are also preserved on separate fork branches.

Validation:

  • macOS, Rust 1.99: debug and release suites (173 tests each), all-features/no-color suite (134 passed, 12 existing ignored), formatting, Clippy with warnings denied, and documentation with warnings denied passed.
  • Rust 1.80.1: all 173 tests passed with the compatible lockfile.
  • Both Loom model tests passed; their original-code failures are recorded.
  • Full fork CI: all 15 jobs passed for 848b2c77336dfe3df97bb7cda5db147351471c41, including stable/beta/1.80 tests and Clippy across Linux, macOS and Windows, formatting, Loom, and semver compatibility against 5204a26619e10fda0adc77f07588811d6102a40d.
  • Independent CI repairs: all six platform jobs passed on their separate repair branches.

Fixes #229.

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.

Race condition between has_manual_override and manual_override

1 participant