Repository navigation
Sans-IO baseline: make check ledgers that freeze IO in logic - #971
Merged
Merged
Conversation
Logic never performs IO: a machine (a screen, a data/ store, the session owner, the player's foreground lifecycle, a route planner) starts no worker, reads no process-global registry and has no cfg(test) fork; its work leaves as a typed effect and every result returns as one addressed event. The migrations that get there are many PRs, and each needs a floor it cannot fall back through while it lands. This PR is that floor and changes no product behaviour. check-deps.sh gains four rules, each an exact multiset of production sites that only shrinks (a new site, a stale line, a wrong `# count:` or a line filed in the wrong area fails): - workers: a production worker start in a machine (task::spawn, spawn_small*, spawn_off_frame*, storage_worker::submit, submit_retained, .submit_ticket). - globals: a production read of a process-global registry in a machine (client_for, current_server, current_snapshot, keypin::revision/blocked_for, session::peek, grant::offers, player::TX in the player lifecycle). - forks: a production test/production fork across data/, plex/, media/ and session/ (cfg(not(test)), not(any(test, feature = "test-support")), cfg!(..)). - fxlanes: a Bridge::app_effect arm that does not push Fx::Deliver. They are seeded from the tool's own output (27 / 105 / 62 / 11 sites), one file per rule and area under ci/allow/<rule>/ so two migrations in different areas never edit one `# count:` header. The `blocking` ledger's awk becomes the shared ci/ledger.awk (a lexer that blanks comments and literals, a brace-depth enclosing-fn stack, a three-valued cfg evaluator) behind one ledger_scan / ledger_check pair in check-deps.sh; `blocking` grades exactly as before. The lexer copies and blanks stretches of a line in one piece instead of a character at a time (2.5x faster, output byte-identical over every .rs file in the tree), and one awk pass prefilters the candidate files for the three file-scanning rules, which keeps the whole script at about +1.8 s over its previous ~10 s. Also: docs/sans-io.md states the rule, the scope, each ledger and how a migration shrinks one (linked from docs/stores-as-machines.md, one bullet in AGENTS.md); tests/test_harness.py grades every rule with planted violations (new site, stale line, count mismatch, alias, test-only code) and pins the per-rule totals; machine.rs drops its stale "contract spike" paragraph and `#![allow(dead_code)]`, which nothing needs any more. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ng does now
The ledgers' scanner missed shapes a machine could use to hide a site:
- globals: `keypin::revision`, `keypin::blocked_for` and `grant::offers` could be
renamed (`use .. revision as rev`) or imported bare; both now fail like
`session::peek`. The bare-import patterns ate the closing `}` of a braced group
whose LAST item was the name (`{self, spawn}`, `{spawn}`, `{self, peek}`), so
every such call went unseen; fixed for spawn, submit, peek and the new names.
lifecycle.rs reads the player transport as `super::TX` and a bare `TX` too, and
a rename of `TX` or `player` is refused; the file is always a candidate.
- fxlanes: an arm is a site for EVERY `AppFx::X` on its head, wrapped or not, and
an arm with no variant (`other =>`, `_ =>`) is the site `AppFx::_`. The match is
found by its opening line, so arm order no longer matters.
- the test skip of a `#[cfg(test)]` item ends at the close of its own `{..}` (or
its `;`), so a signature spilling over lines or a `where` clause no longer ends
it early and grades the body as production.
- a path-qualified macro invocation at module level is an item named for its
macro: `origin.rs::?` becomes `origin.rs::latched_flag!`, the only ledger line
that moves (forks 62, unchanged); no `::?` key may be ledgered.
Docs: `blocking` is more accurate on the shared scanner than before, not
unchanged (any cfg-test item, extra attributes, `test-support`/`all(test, ..)`,
strings and block comments, a call after a "http://" string), same sites; forks
counts an inline `cfg!(..)` whatever it evaluates to; a site can move between
same-named fns of one file unseen. DepGates keeps one LEDGER_RULES.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First step of the Sans-IO series: no product behaviour changes.
make checkgains enforcing ledgers that freeze today's IO-in-logic sites, so each later PR can only shrink them.blockingledger inci/check-deps.shis generalised intoci/ledger.awkplus one shell function, and reused. A ledger is an exact multiset of<path>::<enclosing fn>[::<spelling>]. It fails on a new site, a stale line, a# count:mismatch or an alias, and it skips test code by Rust tokens (strings and comments ignored).blockingfinds the same 2 sites as before; its parsing is now stricter, and the docs say so.ci/allow/<rule>/<area>.txt— one file per crate, one per module fordata/— so two later PRs never edit the same count line:workerstask::spawn*,spawn_small*,spawn_off_frame*,storage_worker::submit*, bare and braced imports) in screens, ui, appkit, machine, data, session,plex/session.rs, player lifecycle, route planglobalsclient_for,current_server,current_snapshot,keypin::revision/blocked_for,session::peek,grant::offers,player::TXin lifecycle.rs, including renamed importsforkscfg(not(test)),cfg(not(any(test, …))),cfg!(test), multi-line forms) across data, plex, media, sessionfxlanesAppFxarms ofBridge::app_effectthat don't go throughFx::Deliver, including or-patterns and catch-all armsdocs/sans-io.md(the rule, the scope, each ledger, how a migration PR deletes its lines), linked fromdocs/stores-as-machines.md, plus oneAGENTS.mdworking rule.machine/src/machine.rsdrops its stale "Phase 2-i contract spike" paragraph and#![allow(dead_code)]; nothing needed it.No Makefile, Cargo or workflow change, so there is no build-bench table.
Verification
make checkon the committed head 5072bfa: green.test result: ok. 1867 passed; 0 failed; 64 ignored; 0 measured; 0 filtered out; finished in 61.04s; harnessRan 539 tests/OK; check-depsok — blocking (2 sites),workers (27 sites),globals (105 sites),forks (62 sites),fxlanes (11 sites).make check-nodefclean.DepGatestests, each planting into a private copy of the tree. They are red against the old script, except the ones that checkblockingis unchanged and that test code is skipped: those pass on both by design.#[cfg(test)]mod or fn passes;letanduse … asaliases,{self, spawn},{self, peek}, a barekeypin::revision,super::TX, a new side-queue arm, an or-pattern arm, a catch-all arm, a deleted ledgered site, a misfiled line, a wrong count.check-deps.shtime: 10.3 s before, 12.3 s after.use …::keypin::{self as k}followed byk::revision()still gets through. Matching{self as x}would flag ordinary imports.Closes #970
🤖 Generated with Claude Code