Skip to content

Add config option to suppress CE starvation warnings#39

Merged
rochala merged 4 commits intomainfrom
suppress-starvation-warnings
Apr 15, 2026
Merged

Add config option to suppress CE starvation warnings#39
rochala merged 4 commits intomainfrom
suppress-starvation-warnings

Conversation

@rochala
Copy link
Copy Markdown
Contributor

@rochala rochala commented Apr 10, 2026

Summary

  • Adds starvation-checks.enabled config option (default: false — disabled for end users)
  • Overrides runtimeConfig to set cpuStarvationCheckInitialDelay = Duration.Inf when disabled
  • Replaces IO-based Config.load with sync Config.global lazy val
  • Drops --config flag — config is loaded from default locations only (user-level + project-level)
  • Checks in .cellar/cellar.conf with starvation-checks.enabled = true for development
  • Env var override: CELLAR_STARVATION_CHECKS_ENABLED=true

Test plan

  • ./mill cli.compile — compiles
  • ./mill lib.test — all tests pass
  • Run cellar from a user project — no starvation warnings
  • Run cellar from the cellar repo root — starvation warnings visible (if triggered)

🤖 Generated with Claude Code

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a configuration flag to control whether Cats Effect CPU starvation warnings are emitted, defaulting to suppression for end users while enabling warnings when developing Cellar itself.

Changes:

  • Add suppress-starvation-warnings to Config (default true) and document it in README.md
  • Override CellarApp.reportCpuStarvation to respect the new suppression setting
  • Check in .cellar/cellar.conf for repo development and narrow .gitignore to ignore only .cellar/cache

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents the new suppress-starvation-warnings config option and its default.
lib/src/cellar/Config.scala Adds suppressStarvationWarnings to the typed config model with a default value.
cli/src/cellar/cli/CellarApp.scala Suppresses Cats Effect CPU starvation reporting based on config.
CLAUDE.md Adds guidance to keep docs in sync and notes code conventions.
.gitignore Stops ignoring all of .cellar, continues ignoring .cellar/cache.
.cellar/cellar.conf Repo-local config enabling starvation warnings during Cellar development.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +20 to +24
override def reportCpuStarvation(exceeded: FiniteDuration): IO[Unit] =
Config.default.flatMap { config =>
if config.suppressStarvationWarnings then IO.unit
else super.reportCpuStarvation(exceeded)
}
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reportCpuStarvation reloads the full config from disk every time a starvation event is reported, and it always uses Config.default (user+project config) rather than the config file selected via --config. This can be expensive during a starvation incident and also means users who explicitly set suppress-starvation-warnings = false in a custom config passed with --config still won’t see warnings.

Consider loading the config once during app startup/command execution (using the same configOpt used by the command, when present), caching just the boolean flag, and making reportCpuStarvation a pure check against that cached value (also defaulting safely if config loading fails).

Copilot uses AI. Check for mistakes.
- Add StarvationChecksConfig with `enabled` flag (default: false via reference.conf)
- Override runtimeConfig to disable starvation checker when not enabled
- Make Config fully synchronous (loadSync/bootstrap) so runtimeConfig can read it
- Simplify configOpt from Opts[IO[Config]] to Opts[Config]
- Add .cellar/cellar.conf with starvation-checks.enabled=true for dev use
- Update .gitignore to track .cellar/ (except cache)
- Document new config in README and add docs note to CLAUDE.md
- Env var override: CELLAR_STARVATION_CHECKS_ENABLED

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rochala rochala force-pushed the suppress-starvation-warnings branch from 01f5060 to 4072565 Compare April 14, 2026 16:04
@rochala rochala requested a review from Copilot April 14, 2026 16:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +61 to +63
private val configOpt: Opts[Config] =
Opts.option[Path]("config", "Path to config file", "c").orNone
.map(p => if p.isDefined then Config.loadSync(p) else Config.bootstrap)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config.loadSync/Config.bootstrap can throw ConfigReaderException/IO exceptions; calling it inside Opts.map means failures happen during option parsing and may crash with a stack trace instead of a user-friendly CLI error. Consider using decline validation (mapValidated/orElse) to convert failures into a Help/ValidationFailed, or keep this as IO[Config] and handle errors when running the command.

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +14
case class StarvationChecksConfig(enabled: Boolean) derives ConfigReader

object Config {
lazy val default: IO[Config] = load(None)
case class Config(mill: MillConfig, sbt: SbtConfig, starvationChecks: StarvationChecksConfig) derives ConfigReader
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR metadata describes a suppress-starvation-warnings option (default suppressed) and overriding reportCpuStarvation, but the implementation introduces starvation-checks.enabled and disables the checker via runtimeConfig. Please align the PR description (and any external references) with the actual config key name/semantics and the chosen implementation approach.

Copilot uses AI. Check for mistakes.
Comment on lines +172 to +176
starvation-checks {
# Enable Cats Effect CPU starvation warnings (default: false).
# Set to true during development or CI to surface warnings.
enabled = false # env: CELLAR_STARVATION_CHECKS_ENABLED
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the runtime starvation-check behavior is determined from Config.bootstrap (loaded from default locations) during runtimeConfig, configs supplied via --config won’t affect whether warnings are suppressed/enabled. Either document this limitation, or provide a separate pre-runtime override mechanism (e.g., env/sysprop) that matches the README config guidance.

Copilot uses AI. Check for mistakes.
rochala and others added 3 commits April 15, 2026 00:06
- Add StarvationChecksConfig with `enabled` flag (default: false via reference.conf)
- Override runtimeConfig to disable CE starvation checker when not enabled
- Replace IO-based Config.load with sync Config.global lazy val
- Drop --config flag — config is loaded from default locations only
- Check in .cellar/cellar.conf with starvation-checks.enabled=true for dev
- Update .gitignore to track .cellar/ (except cache)
- Document new config in README, add docs note to CLAUDE.md
- Env var override: CELLAR_STARVATION_CHECKS_ENABLED

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Config is now accessed via Config.global throughout. Handlers default
to it but accept an override for testing (e.g. custom mill binary).
CellarApp no longer passes config explicitly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rochala rochala merged commit 53e3ab1 into main Apr 15, 2026
5 checks passed
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.

2 participants