Skip to content

One shutdown model: a diagram takes the site's Opportunities - #508

Merged
derrynknife merged 1 commit into
devfrom
build/one-shutdown-model
Nov 21, 2026
Merged

derrynknife merged 1 commit into
devfrom
build/one-shutdown-model

Conversation

@derrynknife

Copy link
Copy Markdown
Owner

Summary

A site's shuts were described twice: as Opportunities for a part's policies and as RepairableRBD(shutdowns=) dicts for a diagram. Now shutdowns= takes an Opportunities record in model time, and the dict form stays as its shorthand.

  • Each Opportunity is a shutdown of its name: period and offset (times run both ways from the offset, so on the diagram's clock the first is the first after 0), or dates as numbers; duration (None takes no time); takes_down as the scope.
  • New, for what only a diagram uses: Opportunity(idle_ageing=, opportunistic=) and Opportunities(shut_costs=). shut_costs is the site's own cost of each shut, not a part's price.
  • The record is read as the dicts it stands for (rbd._shutdowns.as_specs, Opportunities._diagram_shutdowns). The diagram keeps and saves those dicts, so its values and seeded runs are exactly the dicts'.
  • Refusals name the fix: a record on real dates names Opportunities.on_diagram(start, end), a ShutdownPolicy names the record to give, and a deprecated price on an opportunity names shut_costs.
  • Saved opportunities without the new options are read and written as before.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / tooling
  • Breaking change

Checklist

  • Tests added/updated: test_opportunities_on_diagram.py. It checks a record against its dicts: same saved diagram, the same exact costs and seeded runs, with times, idle ageing and opportunistic renewals. It also covers saving and the refusals.
  • black, isort, flake8 and mypy on the changed files.
  • Tests of what changed, run one process: test_opportunities_on_diagram, test_opportunities, test_shutdowns, test_shutdowns_several, test_outage_opportunistic, test_maintenance_shutdowns_dated, test_help, test_messages (188 passed). Doctests of the touched modules: 4 passed.
  • Anything that must agree is updated: the guide's Shutdowns section, and the maintenance README's layers and UC-23 row. No new route: the record becomes the same dicts.
  • CHANGELOG.md updated under [Unreleased]
  • Monte-Carlo tests seeded

Notes for reviewers

Opportunities.on_diagram (real dates) still takes cost, scope and idle_ageing as arguments. It does not read the record's new options or takes_down, so its existing results do not change.


Generated by Claude Code

RepairableRBD(shutdowns=) takes an Opportunities record in model time:
each Opportunity is a shutdown of its name (period and offset or dates,
duration, takes_down as the scope), with Opportunity(idle_ageing=,
opportunistic=) and Opportunities(shut_costs=) for what only a diagram
uses. The record is read as the dicts it stands for, which the diagram
keeps and saves, so its values and seeded runs are the dicts'. Shuts on
real dates go through Opportunities.on_diagram; a ShutdownPolicy is
refused, naming the record to give.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6RpnXB87vwhYETeh7ihtA
@derrynknife
derrynknife merged commit 9629eab into dev Nov 21, 2026
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