Repository navigation
Improve boot sequence. - #61
Conversation
9c96f38 to
d182558
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Compilation, persistence compatibility, run-level validation, and boot API correctness issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 3
Open (10)
Require integer barrier levels · New Use a resolvable include path for the new header · New Migrate persisted run levels before changing their encoding · New Return badarg tuple for invalid run levels · New Implement diagnostics for hung boot troubleshooting · New Accept arbitrary terms for barrier hints · New Demonitor barriers before clearing their rows · New Centralize quorum defaults and validation · New Preserve timeout when stopping during remote restart · New Use the cluster run level for omitted run_level · New
What changed in this PR
Reworks boot sequencing around integer run levels and barriers, replacing classy_rl_changer.
Changes:
- Adds
classy_bootwith barrier-controlled transitions. - Updates hooks, votes, liveness, supervision, and tests.
- Adds public run-level constants and updates documentation.
| File | Description |
|---|---|
src/classy_boot.erl |
Implements boot and barrier management. |
src/classy_rl_changer.erl |
Removes the former run-level manager. |
src/classy.erl |
Exposes the revised run-level API. |
src/classy_node.erl |
Controls cluster and quorum barriers. |
src/classy_sup.erl |
Supervises the new boot manager. |
src/classy_hook.erl |
Registers new boot metadata hooks. |
src/classy_builtin_hooks.erl |
Emits enter/leave events. |
src/classy_liveness.erl |
Adopts enter/leave hook semantics. |
src/classy_lib.erl |
Adds quorum configuration access. |
src/classy_internal.hrl |
Defines run-level validation and events. |
include/classy.hrl |
Includes public run-level constants. |
include/classy_rl.hrl |
Defines numeric run levels. |
src/classy_vote.erl |
Adapts vote scheduling to ranges. |
src/classy_vote.hrl |
Updates persisted run-level typing. |
src/classy_vote_coordinator.erl |
Updates coordinator restoration types. |
src/classy_vote_participant.erl |
Uses the new boot state. |
src/test/classy_ct.erl |
Updates run-level test hooks. |
src/test/classy_test_fuzzer.erl |
Updates synchronization and diagnostics. |
test/classy_SUITE.erl |
Tests barriers and revised transitions. |
doc/classy.texi |
Documents the quorum default. |
rebar.config |
Updates Meck to 1.2.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| to_stopped(Reason, _Timeout) -> % FIXME | ||
| prep_stop(Reason), | ||
| classy_rl_changer:set_sync(?stopped, Timeout). | ||
| classy_boot:stop_system(). |
| verify_run_level(#{}) -> | ||
| {ok, classy_rl_changer:to_int(?cluster)}. | ||
| {ok, ?classy_rl_cluster}. |
d182558 to
3fef13c
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Boot-stage barriers, compilation, persisted-vote compatibility, and bounded shutdown contain unresolved correctness issues.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 3
Open (10)
Prevent cluster hooks before peer prerequisite · New Prevent quorum hooks before quorum is reached · New Migrate legacy persisted run-level values · New Reject zero quorum values · New Validate run-level transition direction · New Use the cluster run level for omitted run_level Preserve timeout when stopping during remote restart Implement diagnostics for hung boot troubleshooting Correct run-level count for inclusive range · New Restore priority ordering coverage for enter and leave hooks · New
Resolved since last review (7)
Migrate persisted run levels before changing their encoding Use a resolvable include path for the new header Require integer barrier levels Centralize quorum defaults and validation Demonitor barriers before clearing their rows Accept arbitrary terms for barrier hints Return badarg tuple for invalid run levels
1a5970d to
1d3396f
Compare
1d3396f to
027ac8c
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Synchronous barriers can crash the boot manager, and shutdown can deadlock while a hook calls it.
Review effort: Balanced
Findings: 2
Open (9)
Fix ETS barrier key shape mismatch · New Avoid boot server deadlock during graceful shutdown · New Use run_level(current) for enrichment hook site information · New Wait for higher-level hooks before acknowledging barriers · New Recompute target when removing barriers during transitions · New Align explicit run-level votes with documented stage thresholds · New Reject zero quorum values Use the cluster run level for omitted run_level Preserve timeout when stopping during remote restart
Resolved since last review (7)
Migrate legacy persisted run-level values Prevent quorum hooks before quorum is reached Prevent cluster hooks before peer prerequisite Validate run-level transition direction Implement diagnostics for hung boot troubleshooting Restore priority ordering coverage for enter and leave hooks Correct run-level count for inclusive range
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved readiness, shutdown, diagnostics, and persisted-vote compatibility defects affect boot correctness.
Review effort: Balanced
Findings: 5
Open (7)
Semicolon guards allow forbidden zero and stopped barriers · New Subtracting one makes the maximum run level unreachable · New Shutdown skips transition hooks and leaves active workers running · New Callback exit causes a badmatch during diagnostics · New Timed-out callbacks remain alive after vote shutdown · New Use the cluster run level for omitted run_level Preserve timeout when stopping during remote restart
Resolved since last review (7)
Avoid boot server deadlock during graceful shutdown Fix ETS barrier key shape mismatch Align explicit run-level votes with documented stage thresholds Recompute target when removing barriers during transitions Wait for higher-level hooks before acknowledging barriers Use run_level(current) for enrichment hook site information Reject zero quorum values
| classy_table:flush(?tab), | ||
| classy_table:flush(?site_info), | ||
| to_stopped(shutdown, infinity), | ||
| to_stopped(shutdown), |
| classy_boot:with_ready( | ||
| RunLevel, | ||
| fun() -> | ||
| classy_sup:ensure_vote_coordinator([true, {ID, Options}]) | ||
| end). |
There was a problem hiding this comment.
This is accepted for now, see comment.



Fixes: #27
Completely rework the run level concept.