Skip to content

RTOS rule 10: stages emit what they deliver, dependents subscribe; no timeout ever moves work forward - #5986

Merged
joelteply merged 4 commits into
canaryfrom
fable/stages-emit-dependents-subscribe
Nov 14, 2026
Merged

joelteply merged 4 commits into
canaryfrom
fable/stages-emit-dependents-subscribe

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Adds rule 10 to CONTINUUM-ENGINE.md section 3 (RTOS Rules), in Joel's words, covering production, tests and our own tooling, with tonight's measured cost (continuum stop hung 100 s x4 on a timer vs the core's 2.2 s shutdown; two CI tests flake on machine speed; cards b5b9bef3, 13590777). Docs only.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…leep or poll ever moves work forward (RTOS rule 10)

Joel, 2026-11-14. Covers production, tests and our own tooling; a bound is only a
loud watchdog. Measured cost on the M5: continuum stop hung 100 s on four deploys
waiting on a timer (core shutdown is 2.2 s); two CI tests flake on machine speed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Nov 14, 2026
…atch; ratchets fixed

Joel (2026-11-14): independent work runs concurrently, never serial minutes; RTOS rule 10
(#5986): no timeout or sleep decides flow in the save/restore path.

- engine_generation::checkpoint_pool issues every resident's save at once and joins on
  their receipts (was one await per slot). page_io checkpoints every endpoint at once.
- page_io::settle waits on the admission gate's drain event (new AdmissionGate::drained,
  a Notify fired when the last permit releases) instead of a 50 ms poll under a deadline;
  the stop's checkpoint no longer runs under tokio::time::timeout(cap) and no longer skips
  on a spent budget. A page action that never answers ends through kv_page_action's own
  error events.
- Restores were already per mind: each mind's first act restores her own page inside her
  own admission and waits on that receipt only.
- The fork serializes page tasks: one task loop (tools/server/server-queue.cpp:138-153,
  save server-context.cpp:2809/2960, restore 2996/3076 at cd2e16d87). Measured 00:18:13Z:
  two restores issued at once, Benchy wait_ms 1,024 = Aris engine_ms 1,012.
- dyno 11 models the engine's page lanes: one lane (today) stop 13.5 s, restores to 5.6 s;
  overlapped, stop = largest save 4.9 s and each mind only her own restore (max 2.0 s).
- Ratchets: the ledger writes through durable::write_replace (no fs::write); restart.rs is
  #![cfg(test)] (one test mod in dyno.rs); the broker's unwrap_or carry their reasons.

Not compiled locally (the M5 is serving); CI is the compiler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: M and removed size: S labels Nov 14, 2026
@joelteply
joelteply merged commit 9ce1688 into canary Nov 14, 2026
11 checks passed
@joelteply
joelteply deleted the fable/stages-emit-dependents-subscribe branch November 14, 2026 02:21
joelteply added a commit that referenced this pull request Nov 14, 2026
…e ratchets

Rule 10/11 text: canary's #5986 wording kept, plus the shape-ratchet section, its
baselines and the correction that time_bounds and wall_clock never counted sleeps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
joelteply added a commit that referenced this pull request Nov 14, 2026
…ing ids counted in every core crate (RTOS rules 10-11) (#5990)

* Stages emit what they deliver and dependents subscribe: no timeout, sleep or poll ever moves work forward (RTOS rule 10)

Joel, 2026-11-14. Covers production, tests and our own tooling; a bound is only a
loud watchdog. Measured cost on the M5: continuum stop hung 100 s on four deploys
waiting on a timer (core shutdown is 2.2 s); two CI tests flake on machine speed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Rule 10: a timeout never decides deterministic flow; only the last-resort error path, behind error events and interrupts

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Merge #5986 (RTOS rules 10-11) so the shape ratchets document under rule 11

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Five shape ratchets count JS-shaped Rust in every core crate, production and tests held apart (RTOS rules 10-11)

Joel, 2026-11-14: "I can't even keep track of the thousands of these you've made." The
tracking is mechanical now. core/source-hygiene/src/shapes/ adds five token rules over the
shared lexer, each held as `<name>` (production) and `<name>_in_tests` through
ratchet::hold_sites, over every core/ workspace member (not only the audited set):

- waits_that_decide_flow: sleep/sleep_until, interval/interval_at, tick_interval: Some,
  Duration-typed consts, timeout/timeout_at/recv_timeout whose Err side carries on.
  Exempt only with `// event-exempt: <remote that may never answer>`.
- unknown_as_value: map_or(0 / 0.0, unwrap_or(0)/unwrap_or_default() on a measurement-named
  read, .max(1) guarding a division, usize/u32/u64::MAX returned as a sentinel.
- stringly_errors (library code): Result<_, String>, Result<_, ()>, map_err to format!/
  to_string/to_owned, ..Error/..Failure variants holding a bare String.
- state_as_flags: structs with 2+ bool/AtomicBool fields; match (a, b, ..) over 2+ Option
  fields of one struct declared in the same crate (crate-wide learning pass).
- string_identities: .get("lit") on JSON outside wire code; HashMap/BTreeMap<String, _>
  struct fields in library code.

Totals only fall, judged against the base by the PR's own rules; every crate's count is
recorded beside them (HeldOnly::SweptByCrate: a touched file keeps old sites, adds none).
The CI receipt now also prints every crate of every ratchet in a folded log group, the
full per-crate baseline a floor-up sweep reads.

The reason-marker check moves from time_bounds into lexer::marker_with_reason, the one
owner both rules use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* contract_shape: loose call contracts counted per crate (rule 6, Joel: "group params ... pass by reference")

Joel, 2026-11-14: "group params as part of structs when they belong together. Pass by
reference and assign mutability and optional at contract." Library fns with 5+ parameters
or 3+ consecutive same-primitive parameters (swappable), `.clone()` passed straight as a
call argument (anywhere), and pub fn parameters taking an owned String/Vec. Held like the
other five, production and tests apart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The shape rules borrow their ranges: contract_shape held them to their own rule (2186 -> 2197 in CI)

The first CI run counted 11 new contract_shape sites in the rules themselves, every one a
Range cloned into a call that only reads it. type_is, fields, variants, is_self, param_type
and string_keyed_map now take &Range; state_as_flags files each struct's Option fields as a
typed OptionalFields record instead of a map keyed through a cloned argument.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Rule 11 names the six shape ratchets and their baselines; the per-crate table is committed as the starting line

Baselines measured by CI (run 43541300117) over canary 7a29474 with this PR's rules,
production / tests: waits_that_decide_flow 408/290, unknown_as_value 218/34,
stringly_errors 2926/238, state_as_flags 146/9, string_identities 839/184,
contract_shape 2186/1246. Rule 10's line that time_bounds and wall_clock counted
sleeps is corrected: neither did; waits_that_decide_flow does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Shape baselines re-measured on canary 958ea30 (CI run 43547453878)

Moved since 7a29474: waits_that_decide_flow 408/290 -> 398/291, stringly_errors
2926 -> 2923, state_as_flags 146 -> 145, contract_shape 2186/1246 -> 2192/1250;
continuum-engine's total 1,454 -> 1,444. The rest held.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
joelteply added a commit that referenced this pull request Nov 14, 2026
… for a volume others filled, and a cold boot names why (#5987)

* A restart restores every mind warm: the page store keeps minds' pages for a volume others filled, and a cold boot names why

Serves resident minds' speed across a deploy (path step 1, order-of-work line 3b): a
restart should cost a mind a ~1 s page restore, not a full re-prefill of her context.

The save at stop, the format-keyed ledger and the restore before her first act already
exist and are tested (page_io::checkpoint_every_endpoint, SavedLedger fingerprint,
every_mind_resumes_where_she_left_off_across_a_stop_and_a_boot). What failed on the M5
2026-11-13: the KV page store gave 29 paged-out minds' confirmed pages to a High-tier
volume request (volume 0.85, store 3% of its budget) between 22:40Z and 00:50Z, and the
23:45Z boot's ledger restored nothing (ledger_attached loaded=0, every first act
cold_turn cause="no_page"), with no reason anywhere.

- page_store_pool: confirmed minds' pages (rung 3) yield only to the store's own
  budget pressure (High+) or a Critical volume (ColdPages); dead pages still go under
  any pressure; a keep is a typed decline (minds_pages_kept), probed on change only.
- broker: High relieves the first pool, in pressure order, that frees bytes, so a pool
  that keeps what it holds passes the request on (drops the unwrap_or(&[]) fallback).
- saved_ledger: why a ledger restored nothing is a typed LedgerUnread; a missing
  ledger is probed instead of silently returning empty.
- page_io: the stop names every endpoint it did not checkpoint (adopted engine, no
  paged engine) and probes before the drain, so a cut stop still says whom it saved.
- dyno 11 (restart.rs + fixtures/dyno/2026-11-13-restart.json): four recorded residents
  (253,321 tokens) cold: last acting at ~401 s; warm: 0 re-prefilled, ~5.6 s of restores
  plus ~13.5 s in the stop; a paged-out mind keeps her page under the recorded pressure.

Not compiled locally (the M5 is serving); CI is the compiler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The stop saves every resident at once and ends on events, not a stopwatch; ratchets fixed

Joel (2026-11-14): independent work runs concurrently, never serial minutes; RTOS rule 10
(#5986): no timeout or sleep decides flow in the save/restore path.

- engine_generation::checkpoint_pool issues every resident's save at once and joins on
  their receipts (was one await per slot). page_io checkpoints every endpoint at once.
- page_io::settle waits on the admission gate's drain event (new AdmissionGate::drained,
  a Notify fired when the last permit releases) instead of a 50 ms poll under a deadline;
  the stop's checkpoint no longer runs under tokio::time::timeout(cap) and no longer skips
  on a spent budget. A page action that never answers ends through kv_page_action's own
  error events.
- Restores were already per mind: each mind's first act restores her own page inside her
  own admission and waits on that receipt only.
- The fork serializes page tasks: one task loop (tools/server/server-queue.cpp:138-153,
  save server-context.cpp:2809/2960, restore 2996/3076 at cd2e16d87). Measured 00:18:13Z:
  two restores issued at once, Benchy wait_ms 1,024 = Aris engine_ms 1,012.
- dyno 11 models the engine's page lanes: one lane (today) stop 13.5 s, restores to 5.6 s;
  overlapped, stop = largest save 4.9 s and each mind only her own restore (max 2.0 s).
- Ratchets: the ledger writes through durable::write_replace (no fs::write); restart.rs is
  #![cfg(test)] (one test mod in dyno.rs); the broker's unwrap_or carry their reasons.

Not compiled locally (the M5 is serving); CI is the compiler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The dyno table's row 11 is a doc line

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Typed seams for the restart path: PageAction, SaveFailure, StopCheckpoint, Ratio, Result ledger

Review of #5987 (~/.continuum/evidence/js-shaped-rust-2026-11-14/review.md):
- #4 page_store_pool: Ratio newtype built only from a part and a nonzero whole; StorePressure
  { own, volume: Option<Ratio> }; an unread pressure never keeps (ColdPages::Yield); no .max(1)
  or map_or(0.0). The dyno fixture records bytes, not ratios.
- #5 CheckpointFailure<E: Error> (own file, thiserror): Engine(E) | Admission(String) |
  Save { slot, kind: SaveFailure::{Rejected, Unresolved, Uncertain} }; no format! sentences.
  checkpoint_residents returns OwnedCheckpointRefusal variants instead of strings;
  AdoptedCheckpointRefusal::Save carries { slot, kind }.
- #6 page_io::checkpoint_endpoint -> StopCheckpoint { Ended, EngineChanged, Saved,
  Failed(CheckpointFailure) }; no Err(()) -> String, no Option wrapper.
- #7 PageAction { Save, Restore, Erase } (serde lowercase on the wire via .query());
  every kv_page_action / page_action caller, the receipt judge and UnresolvedPage migrated.
- #21 SavedLedger::load -> Result<LoadedLedger, LedgerUnread>; Unreadable(io::ErrorKind).
- #22 CheckpointSave: consuming confirmed()/rejected(); unanswered drop quarantines.
- #23 stop probes keep residents as Probed<u64>.
- #24 broker sorts with total_cmp.
- low: probes record the enums with Debug; the as_str tables are deleted.

Not compiled locally (the M5 is serving); CI is the compiler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* An unread ledger binds nothing in the or-pattern

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The cut-checkpoint test cuts after slot 0's concurrent save is confirmed

Saves are now issued at once, so the cancellation case waits for slot 1's held save
and slot 0's confirmation before it cuts, instead of relying on serial order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The stop's probe reads its typed failure (no dead field)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* Tests borrow instead of cloning into calls (contract_shape stays at its base)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

* The broker test names the clone's type so it coerces at the call

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant