Skip to content

Refer to "dangerous" rather than "broken" options#1224

Merged
alexdewar merged 1 commit intomainfrom
broken-options-naming
Mar 24, 2026
Merged

Refer to "dangerous" rather than "broken" options#1224
alexdewar merged 1 commit intomainfrom
broken-options-naming

Conversation

@alexdewar
Copy link
Copy Markdown
Collaborator

Description

In various places in the code and documentation we talk about broken options being gated by the please_give_me_broken_results parameter. Strictly speaking, it is not true that all these hidden options are broken. For example, the remaining_demand_absolute_tolerance parameter is not broken: the reason for hiding it is that it is potentially dangerous for users to change it.

Change variable names, comments etc. to talk about "dangerous" rather than "broken" options, where appropriate. I have left the name of the please_give_me_broken_results parameter the same, as enabling any of these options may lead to broken (or nonsensical) results, even if the option itself is not broken.

This is mostly a developer-facing change, but I have also tweaked the schema.

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

Copilot AI review requested due to automatic review settings March 24, 2026 16:18
…ken" options

In various places in the code and documentation we talk about broken options being gated by the `please_give_me_broken_results` parameter. Strictly speaking, it is not true that all these hidden options are broken. For example, the `remaining_demand_absolute_tolerance` parameter is not broken: the reason for hiding it is that it is potentially dangerous for users to change it.

Change variable names, comments etc. to talk about "dangerous" rather than "broken" options, where appropriate. I have left the name of the `please_give_me_broken_results` parameter the same, as enabling any of these options may lead to broken (or nonsensical) _results_, even if the option itself is not broken.

This is mostly a developer-facing change, but I have also updated the language used in the schema.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.74%. Comparing base (8a89d22) to head (a5fb37c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/input/commodity.rs 0.00% 1 Missing ⚠️
src/model/parameters.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1224   +/-   ##
=======================================
  Coverage   89.74%   89.74%           
=======================================
  Files          57       57           
  Lines        8195     8195           
  Branches     8195     8195           
=======================================
  Hits         7355     7355           
  Misses        544      544           
  Partials      296      296           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

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

This PR updates internal naming and user/developer-facing messaging to refer to “dangerous” (rather than “broken”) gated options that are unlocked via please_give_me_broken_results, and reflects that wording in the input schema.

Changes:

  • Renames the model-parameter flag/exports from “broken” to “dangerous” and updates associated docs/log/error messages.
  • Updates gating checks/messages for experimental scarcity pricing.
  • Updates the model.yaml schema description for please_give_me_broken_results to better describe intended usage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/model/parameters.rs Renames the config flag and global gating mechanism; updates validation error/warn messaging and related tests.
src/model.rs Updates public re-exports to the new “dangerous” names.
src/input/commodity.rs Updates scarcity pricing gatekeeping to use the renamed gating function/constant and adjusts messaging.
schemas/input/model.yaml Clarifies schema documentation for please_give_me_broken_results as enabling potentially dangerous/experimental options.

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

Comment on lines 171 to +172
"The 'scarcity' pricing strategy is currently experimental. \
To run anyway, set the {ALLOW_BROKEN_OPTION_NAME} option to true."
To run anyway, set the {ALLOW_DANGEROUS_OPTION_NAME} option to true."
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

This \-continued multi-line error string includes indentation before “To run anyway…”, which will become leading whitespace in the emitted error message. Consider removing the indentation after the continuation (or otherwise building the string) so the user-facing message is formatted cleanly.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's not actually true; I just checked.

It's odd that Copilot trips over on some quite normal Rust constructs.

Comment on lines +184 to +186
"Setting a remaining_demand_absolute_tolerance different from the default value of \
{:e} is potentially dangerous, set {ALLOW_DANGEROUS_OPTION_NAME} to true if you want \
to allow this.",
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

These multi-line string literals use \ line continuation with indentation on the following lines, which becomes literal leading whitespace in the runtime error message. That makes the message harder to read and makes tests that match on message fragments more brittle; consider restructuring the string (e.g., no indentation after \, or build it without injected spaces).

Suggested change
"Setting a remaining_demand_absolute_tolerance different from the default value of \
{:e} is potentially dangerous, set {ALLOW_DANGEROUS_OPTION_NAME} to true if you want \
to allow this.",
"Setting a remaining_demand_absolute_tolerance different from the default value of "
"{:e} is potentially dangerous, set {ALLOW_DANGEROUS_OPTION_NAME} to true if you want "
"to allow this.",

Copilot uses AI. Check for mistakes.
@alexdewar alexdewar requested a review from tsmbland March 24, 2026 16:29
Copy link
Copy Markdown
Collaborator

@tsmbland tsmbland left a comment

Choose a reason for hiding this comment

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

Agree

@alexdewar alexdewar merged commit 302f558 into main Mar 24, 2026
8 of 9 checks passed
@alexdewar alexdewar deleted the broken-options-naming branch March 24, 2026 16:49
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.

3 participants