Skip to content

Shape ratchets: waits, unknowns, stringly errors, flag states and string ids counted in every core crate (RTOS rules 10-11) - #5990

Merged
joelteply merged 9 commits into
canaryfrom
fable/ratchet-every-shape
Nov 14, 2026
Merged

joelteply merged 9 commits into
canaryfrom
fable/ratchet-every-shape

Conversation

@joelteply

@joelteply joelteply commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

How this serves the minds: the code residents work in, and the code that runs them, gets cleaner by a gate rather than by Joel's memory. Joel, 2026-11-14: "I can't even keep track of the thousands of these you've made." This is plan Phase 3 (locks) and Phase 5 (floor-up pattern sweeps).

What

core/source-hygiene/src/shapes/ adds six token rules over the shared lexer. The lexer is zero-dependency by the crate's hard constraint, so there is no syn; strings and comments are never treated as code. Each rule covers every core/ workspace member and holds two ratchets: <name> for production and <name>_in_tests. They hold through the existing ratchet::hold_sites: the total may only fall, it is judged against the PR's base tree by the PR's rules, and each crate's count is recorded.

Ratchet Counts
waits_that_decide_flow sleep/sleep_until, interval, tick_interval: Some, Duration consts, timeout/timeout_at/recv_timeout whose Err side carries on; exempt only with // event-exempt: <remote>
unknown_as_value map_or(0/0.0, unwrap_or(0)/unwrap_or_default() on measurement-named reads, .max(1) guarding a division, usize/u32/u64::MAX returned as a sentinel
stringly_errors (library) 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; match (a, b, ..) over 2+ Option fields of one struct in the same crate
string_identities .get("..") on JSON outside wire code; HashMap/BTreeMap<String, _> struct fields in library code
contract_shape library fn with 5+ params or 3+ consecutive same-primitive params; .clone() as a call argument; pub fn taking owned String/Vec

Also changed:

  • The reason-marker check moved from time_bounds into lexer::marker_with_reason, one owner for both rules.
  • New variant HeldOnly::SweptByCrate: a touched file keeps its old sites and may add none. Since only a touched file's sites can move, the held total rises exactly when the touched files gain sites.
  • The CI receipt prints every crate of every ratchet in a folded log group, so anyone can read the per-crate baseline from any run.

Not judged per crate. A rise in one crate does not fail on its own, because a Phase 2 crate cut moves sites between crates with the total unchanged. moving_sites_into_an_existing_crate_passes_and_is_recorded pins that behaviour. Per-crate counts are receipts.

Measured

CI run 43541300117, base canary 7a29474a9, this PR's rules. Production / tests:

Ratchet Baseline
waits_that_decide_flow 408 / 290
unknown_as_value 218 / 34
stringly_errors 2,926 / 238
state_as_flags 146 / 9
string_identities 839 / 184
contract_shape 2,186 / 1,246

The ten crates with the most sites:

Crate Sites
continuum-core 1,481
continuum-engine 1,454
continuum-mind 984
continuum-kernel 835
continuum-cognition 726
continuum-live 482
continuum-academy 337
continuum-dreaming 309
continuum-cli-lifecycle 262
continuum-grid 211

The floor crates:

  • continuum-base: 15 stringly errors and 1 string identity.
  • continuum-host: 5 waits in production and 2 in tests, 2 unknowns, 1 contract.
  • continuum-pack: not on canary.

The full 49-crate table is in docs/planning/SHAPE-RATCHET-BASELINE-2026-11-14.md. Rule 11 in CONTINUUM-ENGINE.md names each ratchet with its total.

The first CI run caught the rules breaking their own rule: 11 Range clones passed as call arguments, which pushed contract_shape from 2186 to 2197. They were fixed by borrowing.

Nothing was compiled locally; this machine serves live minds, and CI is the compiler.

Stacked on #5986 (RTOS rules 10-11, docs only), merged in so the ratchets document under rule 11.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

joelteply and others added 5 commits November 13, 2026 19:03
…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
…ion 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
… "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
joelteply and others added 4 commits November 13, 2026 19:40
…r 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
…te 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
…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
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
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