The Reloading Lab
Follow the Brass
The complete Ruby project behind the Lab — browse every file, or download the zip and run the suite yourself.
root
- .rspec 2 lines
- first_draft.rb 11 lines
- Gemfile 3 lines
- Gemfile.lock 35 lines
- README.md 41 lines
lib
- admission.rb 15 lines
- batch_record.rb 13 lines
- caliber_batch.rb 34 lines
- caliber_specification.rb 11 lines
- cartridge_case.rb 13 lines
- case_classifier.rb 22 lines
- classification.rb 8 lines
- fact_station.rb 9 lines
- final_inspection.rb 13 lines
- foreign_object.rb 3 lines
- halted_run.rb 16 lines
- placement.rb 11 lines
- press_recovery.rb 33 lines
- press_results.rb 23 lines
- production_line.rb 3 lines
- production_readiness_gate.rb 59 lines
- production_run.rb 76 lines
- progressive_press.rb 70 lines
- run_result.rb 14 lines
- work_in_progress.rb 15 lines
spec
- caliber_batch_spec.rb 53 lines
- case_classifier_spec.rb 32 lines
- follow_the_brass_spec.rb 51 lines
- press_recovery_spec.rb 61 lines
- production_readiness_gate_spec.rb 95 lines
- production_run_fault_spec.rb 92 lines
- production_run_spec.rb 75 lines
- progressive_press_spec.rb 86 lines
- reloading_lab_spec.rb 122 lines
- run_result_spec.rb 16 lines
- spec_helper.rb 3 lines
spec/support/fakes
- fake_fault_once_station.rb 21 lines
The Reloading Lab: the code
The runnable miniature for the published
Reloading Lab tutorial.
The earlier first-draft loop remains in first_draft.rb, which nothing
requires: it calls methods that exist nowhere, deliberately. If a tutorial
snippet and this source disagree, the source is right and the tutorial has
drifted.
Plain Ruby and RSpec. No Rails and no hidden globals. The inner fault spec uses
owned-type doubles to pin the ProductionRun protocol. The outer lab spec
composes real collaborators with one reusable fault fake so the wiring can
catch a lying mock.
Requires Ruby 3.2 or newer (Data.define). Check first:
ruby -v
bundle install
bundle exec rspec
The 37-example suite tells the story from several altitudes:
- mixed cleaning output classified into expected, wrong-context, and foreign exits;
- a caliber carrier that refuses invalid placement without retaining it;
- readiness derived from six facts against an injected caliber specification;
- a four-position press that returns per-position truth and holds on fault;
- repeatable recovery assessment from established facts;
- a completed run with batch provenance; and
- a halted run that preserves faults, positions, pre-production exits, and a recovery plan without executing it.
The unsized regression example exists because the readiness rule was wrong
once. The fault-once system example exists because the first production loop
silently retried. Both corrections stay visible in the suite.
The model deliberately does not execute recovery, model operator authorization, or prove the physical press. Interrupted-run provenance also remains an open ownership decision in the tutorial.